1RDF::Trine::Iterator(3)User Contributed Perl DocumentatioRnDF::Trine::Iterator(3)
2
3
4

NAME

6       RDF::Trine::Iterator - Iterator class for SPARQL query results
7

VERSION

9       This document describes RDF::Trine::Iterator version 1.019.
10

SYNOPSIS

12           use RDF::Trine::Iterator;
13           my $iterator = RDF::Trine::Iterator->new( \&data, 'bindings', \@names );
14           while (my $row = $iterator->next) {
15               my @vars        = keys %$row;
16               # do something with @vars
17           }
18

METHODS

20       "new ( \@results, $type, \@names, %args )"
21       "new ( \&results, $type, \@names, %args )"
22           Returns a new SPARQL Result interator object. Results must be
23           either an reference to an array containing results or a CODE
24           reference that acts as an iterator, returning successive items when
25           called, and returning undef when the iterator is exhausted.
26
27           $type should be one of: bindings, boolean, graph.
28
29       "type"
30           Returns the underlying result type (boolean, graph, bindings).
31
32       "is_boolean"
33           Returns true if the underlying result is a boolean value.
34
35       "is_bindings"
36           Returns true if the underlying result is a set of variable
37           bindings.
38
39       "is_graph"
40           Returns true if the underlying result is an RDF graph.
41
42       "to_string ( $format )"
43           Returns a string representation of the stream data in the specified
44           $format. If $format is missing, defaults to XML serialization.
45           Other options are:
46
47             http://www.w3.org/2001/sw/DataAccess/json-sparql/
48
49       "from_string ( $xml )"
50           Returns a new iterator using the supplied XML string in the SPARQL
51           XML Results format.
52
53       "from_bytes ( $xml )"
54           Returns a new iterator using the supplied XML byte sequence (note:
55           not character data) in the SPARQL XML Results format.
56
57       "from_json ( $json )"
58       "next_result"
59       "next"
60           Returns the next item in the stream.
61
62       "peek"
63           Returns the next value from the iterator without consuming it. The
64           value will remain in queue until the next call to "next".
65
66       "current"
67           Returns the current item in the stream.
68
69       "end"
70       "finished"
71           Returns true if the end of the stream has been reached, false
72           otherwise.
73
74       "open"
75           Returns true if the first element of the stream has been retrieved,
76           false otherwise.
77
78       "close"
79           Closes the stream. Future attempts to retrieve data from the stream
80           will act as if the stream had been exhausted.
81
82       "concat ( $stream )"
83           Returns a new stream resulting from the concatenation of the
84           referant and the argument streams. The new stream uses the stream
85           type, and optional binding names and "<%args"> from the referant
86           stream.
87
88       "seen_count"
89           Returns the count of elements that have been returned by this
90           iterator at the point of invocation.
91
92       "get_boolean"
93           Returns the boolean value of the first item in the stream.
94
95       "get_all"
96           Returns an array containing all the items in the stream.
97
98       "construct_args"
99           Returns the arguments necessary to pass to a stream constructor to
100           re-create this stream (assuming the same closure as the first
101           argument).
102
103       "each ( \&callback )"
104           Calls the callback function once for each item in the iterator,
105           passing the item as an argument to the function. Any arguments to
106           "each" beyond the callback function will be passed as supplemental
107           arguments to the callback function.
108

FUNCTIONS

110       "sgrep { COND } $stream"
111       "smap { EXPR } $stream"
112       "swatch { EXPR } $stream"
113

DEPENDENCIES

115       JSON
116
117       Scalar::Util
118
119       XML::SAX
120

BUGS

122       Please report any bugs or feature requests to through the GitHub web
123       interface at <https://github.com/kasei/perlrdf/issues>.
124

AUTHOR

126       Gregory Todd Williams  "<gwilliams@cpan.org>"
127
129       Copyright (c) 2006-2012 Gregory Todd Williams. This program is free
130       software; you can redistribute it and/or modify it under the same terms
131       as Perl itself.
132
133
134
135perl v5.34.0                      2021-07-22           RDF::Trine::Iterator(3)
Impressum