1Attean::API::Model(3) User Contributed Perl DocumentationAttean::API::Model(3)
2
3
4
6 Attean::API::Model - RDF Model
7
9 This document describes Attean::API::Model version 0.022
10
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
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
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 "get_sequence( $graph, $head )"
74 Returns an Attean::API::Iterator of Attean::API::Term objects that
75 are members of the rdf:Sequence with the specified $head (and
76 matching restricted to only the specified $graph).
77
78 "subjects( $predicate, $object, $graph )"
79 Returns an Attean::API::Iterator of Attean::API::Term objects of
80 all subjects of quads matching the supplied pattern (using the same
81 matching semantics as "get_quads").
82
83 "predicates( $subject, $object, $graph )"
84 Returns an Attean::API::Iterator of Attean::API::Term objects of
85 all predicates of quads matching the supplied pattern (using the
86 same matching semantics as "get_quads" with an "undef" predicate).
87
88 "objects( $subject, $predicate, $graph )"
89 Returns an Attean::API::Iterator of Attean::API::Term objects of
90 all objects of quads matching the supplied pattern (using the same
91 matching semantics as "get_quads" with an "undef" object).
92
93 "graphs( $subject, $predicate, $object )"
94 Returns an Attean::API::Iterator of Attean::API::Term objects of
95 all graphs of quads matching the supplied pattern (using the same
96 matching semantics as "get_quads" with an "undef" graph).
97
98 "graph_nodes( $graph )"
99 Returns an Attean::API::Iterator of Attean::API::Term objects of
100 unique subjects and objects present in the specified $graph.
101
102 "holds($s, $p, $o, $g)"
103 "holds($triple_pattern)"
104 "holds($quad_pattern)"
105 Returns true if the triple/quad pattern matches any data in the
106 model, false otherwise.
107
108 "algebra_holds($algebra, $graph)"
109 "algebra_holds($algebra, \@graphs)"
110 Returns true if the algebra, evaluated with the supplied default
111 graph(s) matches any data in the model, false otherwise. This is
112 equivalent to the result of an ASK query over the supplied algebra.
113
115 Please report any bugs or feature requests to through the GitHub web
116 interface at <https://github.com/kasei/attean/issues>.
117
120 Gregory Todd Williams "<gwilliams@cpan.org>"
121
123 Copyright (c) 2014--2019 Gregory Todd Williams. This program is free
124 software; you can redistribute it and/or modify it under the same terms
125 as Perl itself.
126
127
128
129perl v5.28.1 2019-03-21 Attean::API::Model(3)