Attean::API::Model - RDF Model
This document describes Attean::API::Model version 0.010
The Attean::API::Model role defines a common API for all RDF models to conform to. It is provides a consistent interface for probing, counting, and retrieving Attean::API::Quads matching a pattern, as well as related functionality such as enumerating the graph names, and extracting structured data from the models' quads.
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.
$subject
$predicate
$object
$graph
Any of these terms may be:
* An Attean::API::Term object, in which case matching is equality-based
* A Attean::API::Variable object or undef, in which case that term will be considered as a wildcard for the purposes of matching
undef
* An ARRAY reference of Attean::API::Term objects, in which case the 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.
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).
get_quads
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.
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') ) will return an iterator of results containing just a mapping from 's' to subjects of all quads in the model.
$model->get_bindings( variable('s') )
's'
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 (and matching restricted to only the specified $graph).
$head
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 (and 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).
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).
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).
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).
graph_nodes( $graph )
Returns an Attean::API::Iterator of Attean::API::Term objects of unique subjects and objects present in the specified $graph.
Please report any bugs or feature requests to through the GitHub web interface at https://github.com/kasei/attean/issues.
http://www.perlrdf.org/
Gregory Todd Williams <gwilliams@cpan.org>
<gwilliams@cpan.org>
Copyright (c) 2014--2016 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Attean, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Attean
CPAN shell
perl -MCPAN -e shell install Attean
For more information on module installation, please visit the detailed CPAN module installation guide.