RDF::T...::Graph(3pm)
π RDF::Trine::Iterator::Graph π
okay bestie, so this is the manual page for RDF::Trine::Iterator::Graph, from the User Contributed Perl Documentation collection β it's the iterator class for graph query results, and it's lowkey iconic. sit with me, we're gonna go through the whole thing together π«Ά
β¨ VERSION β¨
This document describes RDF::Trine::Iterator::Graph version 1.019. that's the one, that's the version, no cap β¨
πΈ SYNOPSIS πΈ
here's the vibe, fr fr:
use RDF::Trine::Iterator::Graph;
my $iterator = RDF::Trine::Iterator::Graph->new( \&data );
while (my $st = $iterator->next) {
# $st is a RDF::Trine::Statement object
print $st->as_string;
}
so you make the iterator, you loop on next, and every $st you pull out is a RDF::Trine::Statement object that you can just print. it's giving clean. it's giving readable. we love to see it π
π METHODS π
before we even start: beyond everything documented down here, this class inherits methods from the RDF::Trine::Iterator class. so don't come for it, it's got a whole family tree okay π
new ( \@results, %args )new ( \&results, %args )
Returns a new SPARQL Result interator object. and no, that typo is in the original, we respect the ancestors here π
Your results have to be one of two things: a reference to an array containing results, or a CODE reference that acts as an iterator β it gets called, it returns successive items, and it returns undef when the iterator is exhausted. when it's done, it's done, periodt.
$type should be one of: bindings, boolean, graph. pick your fighter π
as_bindings ( $s, $p, $o )β Returns the iterator as a Bindings iterator, using the supplied triple nodes to determine the variable bindings. you hand it$s,$p,$oand it does the whole transformation moment for you.materializeβ Returns a materialized version of the current graph iterator. β οΈ and this is the part you need to know: the materialization process will leave this iterator empty. so the materialized iterator that gets returned is the one you should use for any future need for the iterator's data. don't go back to the old one, she's gone, she's on a wellness retreat π¦uniqueβ Returns a Graph iterator that ensures the returned statements are unique. so here's the tea: while the underlying RDF graph is the same regardless of uniqueness, the iterator's serialization methods assume the results are unique, and so you should use this method before serialization. consider it a prerequisite bestie.
Uniqueness is opt-in for efficiency concerns β this method requires O(n) memory, and so may have noticeable effects on large graphs. yes it's expensive. yes it's worth it before serializing. know the cost going in π
is_graphβ Returns true if the underlying result is an RDF graph. simple. clean. a vibe check that actually tells you something π₯as_string ( $max_size [, \$count] )β Returns a string table serialization of the stream data. note the optional\$countβ she's got options πas_xml ( $max_size )β Returns an XML serialization of the stream data. xml girlies rise πprint_xml ( $fh, $max_size )β Prints an XML serialization of the stream data to the filehandle$fh. you give it the filehandle, it gives you the goods.as_json ( $max_size )β Returns a JSON serialization of the stream data. json my beloved βas_hashrefβ Returns a hashref representing the model in an RDF/JSON-like manner.
See "as_hashref" at RDF::Trine::Model for full documentation of the hashref format. iykyk, go read that one for the full lore π
construct_argsβ Returns the arguments necessary to pass to the stream constructor_newto re-create this stream (assuming the same closure as the first
okay so real talk, the original page just... ends that sentence there. mid-thought. mid-clause. the manpage truly said "anyway" and walked off π we're keeping it exactly as it is because that's the actual content, no notes, no edits, no inventing the rest π
π§ DEPENDENCIES π§
JSONScalar::Util
that's the whole list, she travels light π
π BUGS π
Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>.
(yes, "to through" β that's the original wording, we are but humble transcribers π)
π AUTHOR π
Gregory Todd Williams "<gwilliams@cpan.org>"
πΈ COPYRIGHT πΈ
Copyright (c) 2006-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page bestie!! π«Άβ¨ this was RDF::T...::Graph(3pm) β generated by perl v5.38.2, dated 2024-01-13, and it ate, no crumbs. go forth and iterate your graphs, you absolute main character ππ
π¦ where this page comes from
- debian trixie: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms