| Server IP : 172.67.220.81 / Your IP : 216.73.216.166 Web Server : Apache System : Linux semi1.us.cloudlogin.co 5.10.244-xeon-hst #1 SMP Sun Sep 14 17:09:20 UTC 2025 x86_64 User : xessglobal ( 271017) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : ON Directory : /usr/share/perl5/vendor_perl/RDF/Query/ |
Upload File : |
# RDF::Query::VariableBindings
# -----------------------------------------------------------------------------
=head1 NAME
RDF::Query::VariableBindings - Variable bindings
=head1 VERSION
This document describes RDF::Query::VariableBindings version 2.918.
=head1 METHODS
Beyond the methods documented below, this class inherits methods from the
L<RDF::Trine::VariableBindings> class.
=over 4
=cut
package RDF::Query::VariableBindings;
use strict;
use warnings;
use base qw(RDF::Trine::VariableBindings);
use overload '""' => sub { $_[0]->as_string },
'bool' => sub { return 1 };
use Scalar::Util qw(blessed refaddr);
######################################################################
our ($VERSION);
BEGIN {
$VERSION = '2.918';
}
######################################################################
=item C<< new ( \%bindings ) >>
=cut
sub new {
my $class = shift;
my $bindings = shift || {};
my $data = { %$bindings };
foreach my $k (keys %$data) {
my $node = $data->{$k};
if (ref($node) and not($node->isa('RDF::Query::Node'))) {
$data->{$k} = RDF::Query::Node->from_trine( $node );
}
}
my $self = $class->SUPER::new( $data );
return $self;
}
=item C<< sse ( \%context, $indent ) >>
=cut
sub sse {
my $self = shift;
my $context = shift;
my $indent = shift;
my $more = ' ';
my @keys = sort keys %$self;
return sprintf('(row %s)', CORE::join(' ', map { '[' . CORE::join(' ', '?' . $_, ($self->{$_}) ? $self->{$_}->as_string : ()) . ']' } (@keys)));
}
=item C<< explain >>
Returns a string serialization of the variable bindings appropriate for display
on the command line.
=cut
sub explain {
my $self = shift;
my $s = shift;
my $count = shift;
my $indent = $s x $count;
my $string = "${indent}Variable Bindings\n";
my @keys = sort keys %$self;
foreach my $k (@keys) {
$string .= "${indent}${s}$k: " . $self->{$k}->as_string . "\n";
}
return $string;
}
=item C<< as_hash >>
Returns the variable bindings as a nested set of plain data structures (no objects).
=cut
sub as_hash {
my $self = shift;
my $context = shift;
my @keys = sort keys %$self;
return { type => 'bindings', bindings => { map { $_ => $self->{$_}->as_hash($context) } @keys } };
}
1;
__END__
=back
=head1 AUTHOR
Gregory Todd Williams <[email protected]>
=cut