1RDF::Trine::VariableBinUdsienrgsC(o3n)tributed Perl DocuRmDeFn:t:aTtriionne::VariableBindings(3)
2
3
4
6 RDF::Trine::VariableBindings - Variable bindings
7
9 This document describes RDF::Trine::VariableBindings version 1.019
10
12 use RDF::Trine qw(literal);
13 use RDF::Trine::VariableBindings;
14 my $vb = RDF::Trine::VariableBindings->new( {} );
15 $vb->set( foo => literal("bar") );
16 $vb->set( baz => literal("blee") );
17 $vb->variables; # qw(foo baz)
18
19 my $x = RDF::Trine::VariableBindings->new( { foo => literal("bar") } );
20 $x->set( greeting => literal("hello") );
21
22 my $j = $vb->join( $x ); # { foo => "bar", baz => "blee", greeting => "hello" }
23
24 my @keys = qw(baz greeting);
25 my $p = $j->project( @keys ); # { baz => "blee", greeting => "hello" }
26 print $p->{greeting}->literal_value; # "hello"
27
29 RDF::Trine::VariableBindings objects provide a mapping from variable
30 names to RDF::Trine::Node objects. The objects may be used as a hash
31 reference, with variable names used as hash keys.
32
34 "new ( \%bindings )"
35 "set ( $variable_name => $node )"
36 "join ( $row )"
37 Returns a new VariableBindings object based on the join of this
38 object and $row. If the two variable binding objects cannot be
39 joined, returns undef.
40
41 "variables"
42 "project ( @keys )"
43 Returns a new binding with values for only the keys listed.
44
45 "as_string"
46 Returns a string representation of the variable bindings.
47
48 "label ( $label => $value )"
49 Sets the named $label to $value for this variable bindings object.
50 If no $value is given, returns the current label value, or undef if
51 none exists.
52
53 "copy_labels_from ( $vb )"
54 Copies the labels from $vb, adding them to the labels for this
55 object.
56
58 Please report any bugs or feature requests to through the GitHub web
59 interface at <https://github.com/kasei/perlrdf/issues>.
60
62 Gregory Todd Williams <gwilliams@cpan.org>
63
65 Copyright (c) 2006-2012 Gregory Todd Williams. This program is free
66 software; you can redistribute it and/or modify it under the same terms
67 as Perl itself.
68
69
70
71perl v5.28.1 2018-01-05 RDF::Trine::VariableBindings(3)