1Attean::API::Model(3) User Contributed Perl DocumentationAttean::API::Model(3)
2
3
4

NAME

6       Attean::API::Model - RDF Model
7

VERSION

9       This document describes Attean::API::Model version 0.030
10

DESCRIPTION

12       The Attean::API::Model role defines a common API for all RDF models to
13       conform to. It is provides a consistent interface for probing,
14       counting, and retrieving Attean::API::Quads matching a pattern, as well
15       as related functionality such as enumerating the graph names, and
16       extracting structured data from the models' quads.
17

REQUIRED METHODS

19       The following methods are required by the Attean::API::Model role:
20
21       "get_quads( $subject, $predicate, $object, $graph )"
22           Returns an Attean::API::Iterator for quads in the model that match
23           the supplied $subject, $predicate, $object, and $graph.
24
25           Any of these terms may be:
26
27           * An Attean::API::Term object, in which case matching is equality-
28           based
29
30           * A Attean::API::Variable object or "undef", in which case that
31           term will be considered as a wildcard for the purposes of matching
32
33           * An ARRAY reference of Attean::API::Term objects, in which case
34           the matching will be equality-based on the disjunction of the
35           supplied terms
36
37           The returned iterator conforms to both Attean::API::Iterator and
38           Attean::API::QuadIterator.
39
40       "count_quads( $subject, $predicate, $object, $graph )"
41           Returns the number of quads in the model matching the supplied
42           pattern (using the same matching semantics as "get_quads").
43
44       "count_quads_estimate( $subject, $predicate, $object, $graph )"
45           Returns an estimate of the number of quads in the model matching
46           the supplied pattern (using the same matching semantics as
47           "get_quads"). This estimate is guaranteed to non-zero if the count
48           returned from an equivalent call to `count_quads` would return a
49           non-zero result.
50
51       "get_graphs"
52           Returns an Attean::API::Iterator of distinct Attean::API::Term
53           objects that are used in the graph position of quads in the model.
54

METHODS

56       The Attean::API::Model role provides default implementations of the
57       following methods:
58
59       "get_bindings( $subject, $predicate, $object, $graph )"
60           Returns an Attean::API::Iterator of Attean::API::Result objects
61           corresponding to quads in the model matching the supplied pattern.
62           For each Attean::API::Variable in the pattern list, a mapping will
63           be present in the corresponding result object. For example,
64           "$model->get_bindings( variable('s') )" will return an iterator of
65           results containing just a mapping from 's' to subjects of all quads
66           in the model.
67
68       "get_list( $graph, $head )"
69           Returns an Attean::API::Iterator of Attean::API::Term objects that
70           are members of the rdf:List with the specified $head (and matching
71           restricted to only the specified $graph).
72
73           To check if a certain term is a list, the "holds" method may be
74           used, for example:
75
76             $model->holds($head, iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#first'), undef, $graph))
77
78           will return true if a given term $head is a list.
79
80       "get_sequence( $graph, $head )"
81           Returns an Attean::API::Iterator of Attean::API::Term objects that
82           are members of the rdf:Sequence with the specified $head (and
83           matching restricted to only the specified $graph).
84
85       "subjects( $predicate, $object, $graph )"
86           Returns an Attean::API::Iterator of Attean::API::Term objects of
87           all subjects of quads matching the supplied pattern (using the same
88           matching semantics as "get_quads").
89
90           The objects returned will not necessarily be unique. It will
91           instead be equivalent to calling "get_quads" and accessing
92           "$quad->subject" for each $quad value returned by the iterator. For
93           an iterator of unique subjects, use "$model->subjects->uniq".
94
95       "predicates( $subject, $object, $graph )"
96           Returns an Attean::API::Iterator of Attean::API::Term objects of
97           all predicates of quads matching the supplied pattern (using the
98           same matching semantics as "get_quads" with an "undef" predicate).
99
100           The objects returned will not necessarily be unique (see the note
101           for "subjects" above).
102
103       "objects( $subject, $predicate, $graph )"
104           Returns an Attean::API::Iterator of Attean::API::Term objects of
105           all objects of quads matching the supplied pattern (using the same
106           matching semantics as "get_quads" with an "undef" object).
107
108           The objects returned will not necessarily be unique (see the note
109           for "subjects" above).
110
111       "graphs( $subject, $predicate, $object )"
112           Returns an Attean::API::Iterator of Attean::API::Term objects of
113           all graphs of quads matching the supplied pattern (using the same
114           matching semantics as "get_quads" with an "undef" graph).
115
116           The objects returned will not necessarily be unique (see the note
117           for "subjects" above).
118
119       "graph_nodes( $graph )"
120           Returns an Attean::API::Iterator of Attean::API::Term objects of
121           unique subjects and objects present in the specified $graph.
122
123       "holds($s, $p, $o, $g)"
124       "holds($triple_pattern)"
125       "holds($quad_pattern)"
126           Returns true if the triple/quad pattern matches any data in the
127           model, false otherwise.
128
129       "algebra_holds($algebra, $graph)"
130       "algebra_holds($algebra, \@graphs)"
131           Returns true if the algebra, evaluated with the supplied default
132           graph(s) matches any data in the model, false otherwise. This is
133           equivalent to the result of an ASK query over the supplied algebra.
134
135       "evaluate($algebra, [ $default_graph | \@default_graphs ])"
136           Returns an Attean::API::Iterator of Attean::Result objects which
137           result from evaluating the given query algebra (e.g. one obtained
138           from parsing a query with AtteanX::Parser::SPARQL) with the
139           supplied default graph(s) against data in the model.
140

BUGS

142       Please report any bugs or feature requests to through the GitHub web
143       interface at <https://github.com/kasei/attean/issues>.
144

SEE ALSO

AUTHOR

147       Gregory Todd Williams  "<gwilliams@cpan.org>"
148
150       Copyright (c) 2014--2020 Gregory Todd Williams.  This program is free
151       software; you can redistribute it and/or modify it under the same terms
152       as Perl itself.
153
154
155
156perl v5.32.1                      2021-02-08             Attean::API::Model(3)
Impressum