RDF::T...::Graph(3pm)

πŸ“¦
version 1.019 Β· 7 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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, $o and 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 _new to 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 🧚

  • JSON
  • Scalar::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 (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