Attean...:Model(3pm)

🌸 NAME 🌸

Okay so this is the Attean...:Model(3pm) page, filed under User Contributed Perl Documentation, and the main character is Attean::API::Model β€” RDF Model. Periodt. πŸ’…

πŸ’– VERSION πŸ’–

This document describes Attean::API::Model version 0.035. Slay. ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

The Attean::API::Model role defines a common API that all RDF models conform to. It gives you a consistent interface for probing, counting, and retrieving Attean::API::Quads that match a pattern, plus related functionality like enumerating graph names and extracting structured data from the models' quads. It's giving very organized, very useful, no cap. πŸ’œ

✨ REQUIRED METHODS ✨

The following methods are required by the Attean::API::Model role:

  • get_quads( $subject, $predicate, $object, $graph ) β€” Returns an Attean::API::Iterator for quads in the model that match the supplied $subject, $predicate, $object, and $graph.

Any of these terms may be:

  • An Attean::API::Term object, in which case matching is equality-based.
  • An Attean::API::Variable object or undef, in which case that term will be considered a wildcard for matching purposes.
  • An ARRAY reference of Attean::API::Term objects, in which case matching will be equality-based on the disjunction of the supplied terms.

The returned iterator conforms to both Attean::API::Iterator and Attean::API::QuadIterator. Iconic behavior honestly. 🫢

  • count_quads( $subject, $predicate, $object, $graph ) β€” Returns the number of quads in the model matching the supplied pattern, using the same matching semantics as get_quads.
  • count_quads_estimate( $subject, $predicate, $object, $graph ) β€” Returns an estimate of the number of quads in the model matching the supplied pattern, using the same matching semantics as get_quads. This estimate is guaranteed to be non-zero if the count returned from an equivalent call to count_quads would return a non-zero result.
  • get_graphs β€” Returns an Attean::API::Iterator of distinct Attean::API::Term objects that are used in the graph position of quads in the model.

πŸŽ€ METHODS πŸŽ€

The Attean::API::Model role provides default implementations of the following methods:

  • get_bindings( $subject, $predicate, $object, $graph ) β€” Returns an Attean::API::Iterator of Attean::API::Result objects corresponding to quads in the model matching the supplied pattern. For each Attean::API::Variable in the pattern list, a mapping will be present in the corresponding result object. For example, $model->get_bindings( variable('s') ) returns an iterator of results containing just a mapping from 's' to subjects of all quads in the model. Cute and efficient, bestie. 🌟
  • get_list( $graph, $head ) β€” Returns an Attean::API::Iterator of Attean::API::Term objects that are members of the rdf:List with the specified $head, with matching restricted to only the specified $graph.

To check if a certain term is a list, the holds method may be used. For example:

$model->holds($head, iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#first'), undef, $graph))

will return true if a given term $head is a list.

  • get_sequence( $graph, $head ) β€” Returns an Attean::API::Iterator of Attean::API::Term objects that are members of the rdf:Sequence with the specified $head, with matching restricted to only the specified $graph.
  • subjects( $predicate, $object, $graph ) β€” Returns an Attean::API::Iterator of Attean::API::Term objects of all subjects of quads matching the supplied pattern, using the same matching semantics as get_quads.

Heads up: the objects returned will not necessarily be unique. It will instead be equivalent to calling get_quads and accessing $quad->subject for each $quad value returned by the iterator. For an iterator of unique subjects, use $model->subjects->uniq. Not me explaining duplicates, but also yes. 😭

  • predicates( $subject, $object, $graph ) β€” Returns an Attean::API::Iterator of Attean::API::Term objects of all predicates of quads matching the supplied pattern, using the same matching semantics as get_quads with an undef predicate.

The objects returned will not necessarily be unique β€” see the note for subjects above.

  • objects( $subject, $predicate, $graph ) β€” Returns an Attean::API::Iterator of Attean::API::Term objects of all objects of quads matching the supplied pattern, using the same matching semantics as get_quads with an undef object.

The objects returned will not necessarily be unique β€” see the note for subjects above.

  • graphs( $subject, $predicate, $object ) β€” Returns an Attean::API::Iterator of Attean::API::Term objects of all graphs of quads matching the supplied pattern, using the same matching semantics as get_quads with an undef graph.

The objects returned will not necessarily be unique β€” see the note for subjects above.

  • graph_nodes( $graph ) β€” Returns an Attean::API::Iterator of Attean::API::Term objects of unique subjects and objects present in the specified $graph.
  • holds($s, $p, $o, $g) holds($triple_pattern) holds($quad_pattern) β€” Returns true if the triple/quad pattern matches any data in the model, false otherwise. Vibe check passed? True. 🌈
  • algebra_holds($algebra, $graph) algebra_holds($algebra, \@graphs) β€” Returns true if the algebra, evaluated with the supplied default graph(s), matches any data in the model, false otherwise. This is equivalent to the result of an ASK query over the supplied algebra.
  • evaluate($algebra, [ $default_graph | \@default_graphs ]) β€” Returns an Attean::API::Iterator of Attean::API::Result objects which result from evaluating the given query algebra β€” for example, one obtained from parsing a query with AtteanX::Parser::SPARQL β€” with the supplied default graph(s) against data in the model.

πŸ’€ BUGS πŸ’€

Please report any bugs or feature requests through the GitHub web interface at https://github.com/kasei/attean/issues. Do it for the plot, bestie. πŸ›

πŸ‘€ SEE ALSO πŸ‘€

No entries are listed here in the original page. It's giving empty section, and that's canon. πŸŽ€

πŸ‘‘ AUTHOR πŸ‘‘

Gregory Todd Williams "<gwilliams@cpan.org>" β€” king behavior. πŸ‘‘

Copyright (c) 2014--2022 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


πŸ’– Cute little footer moment: this page comes from perl v5.40.0, dated 2025-01-26, and it's the Attean...:Model(3pm) page. Bye bestie, go read some quads. πŸ’…

πŸ“¦ where this page comes from