1RDF::Trine::Iterator::BUisnedrinCgosn(t3r)ibuted Perl DoRcDuFm:e:nTtraitnieo:n:Iterator::Bindings(3)
2
3
4
6 RDF::Trine::Iterator::Bindings - Iterator class for bindings query
7 results
8
10 This document describes RDF::Trine::Iterator::Bindings version 1.019
11
13 use RDF::Trine::Iterator::Bindings;
14
15 my $iterator = RDF::Trine::Iterator::Bindings->new( \&data, \@names );
16 while (my $row = $iterator->next) {
17 # $row is a HASHref containing variable name -> RDF Term bindings
18 my @vars = keys %$row;
19 print $row->{ 'var' }->as_string;
20 }
21
23 Beyond the methods documented below, this class inherits methods from
24 the RDF::Trine::Iterator class.
25
26 "new ( \@results, \@names, %args )"
27 "new ( \&results, \@names, %args )"
28 Returns a new SPARQL Result interator object. Results must be
29 either a reference to an array containing results or a CODE
30 reference that acts as an iterator, returning successive items when
31 called, and returning undef when the iterator is exhausted.
32
33 "materialize"
34 Returns a materialized version of the current binding iterator.
35 The materialization process will leave this iterator empty. The
36 materialized iterator that is returned should be used for any
37 future need for the iterator's data.
38
39 "project ( @columns )"
40 Returns a new stream that projects the current bindings to only the
41 given columns.
42
43 "join_streams ( $stream, $stream )"
44 Performs a natural, nested loop join of the two streams, returning
45 a new stream of joined results.
46
47 "nested_loop_join ( $outer, $inner )"
48 Performs a natural, nested loop join of the two streams, returning
49 a new stream of joined results.
50
51 Note that the values from the $inner iterator are fully
52 materialized for this join, and the results of the join are in the
53 order of values from the $outer iterator. This suggests that:
54
55 * If sorting needs to be preserved, the $outer iterator should be
56 used to determine the result ordering.
57
58 * If one iterator is much smaller than the other, it should likely
59 be used as the $inner iterator since materialization will require
60 less total memory.
61
62 "sorted_by"
63 "binding_value_by_name ( $name )"
64 Returns the binding of the named variable in the current result.
65
66 "binding_value ( $i )"
67 Returns the binding of the $i-th variable in the current result.
68
69 "binding_values"
70 Returns a list of the binding values from the current result.
71
72 "binding_names"
73 Returns a list of the binding names.
74
75 "binding_name ( $i )"
76 Returns the name of the $i-th result column.
77
78 "bindings_count"
79 Returns the number of variable bindings in the current result.
80
81 "is_bindings"
82 Returns true if the underlying result is a set of variable
83 bindings.
84
85 "as_json ( $max_size )"
86 Returns a JSON serialization of the stream data.
87
88 "as_xml ( $max_size )"
89 Returns an XML serialization of the stream data.
90
91 "as_string ( $max_size [, \$count] )"
92 Returns a string table serialization of the stream data.
93
94 "as_statements ( $pattern | @names )"
95 Returns a RDF::Trine::Iterator::Graph with the statements of the
96 stream.
97
98 If $pattern, an RDF::Trine::Pattern object, is given as an
99 argument, each of its triples are instantiated with variable
100 bindings from each row of the iterator, and returned as
101 RDF::Trine::Statement objects from a new
102 RDF::Trine::Iterator::Graph iterator.
103
104 If 3 variable @names are supplied, their corresponding variable
105 bindings in each row of the iterator are used (in order) as the
106 subject, predicate, and object of new RDF::Trine::Statement objects
107 and returned from a new RDF::Trine::Iterator::Graph iterator.
108
109 "print_xml ( $fh, $max_size )"
110 Prints an XML serialization of the stream data to the filehandle
111 $fh.
112
113 "construct_args"
114 Returns the arguments necessary to pass to the stream constructor
115 _new to re-create this stream (assuming the same closure as the
116 first argument).
117
119 JSON
120
121 Scalar::Util
122
124 Please report any bugs or feature requests to through the GitHub web
125 interface at <https://github.com/kasei/perlrdf/issues>.
126
128 Gregory Todd Williams "<gwilliams@cpan.org>"
129
131 Copyright (c) 2006-2012 Gregory Todd Williams. This program is free
132 software; you can redistribute it and/or modify it under the same terms
133 as Perl itself.
134
135
136
137perl v5.28.0 2018-01-05 RDF::Trine::Iterator::Bindings(3)