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.025
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       "predicates( $subject, $object, $graph )"
91           Returns an Attean::API::Iterator of Attean::API::Term objects of
92           all predicates of quads matching the supplied pattern (using the
93           same matching semantics as "get_quads" with an "undef" predicate).
94
95       "objects( $subject, $predicate, $graph )"
96           Returns an Attean::API::Iterator of Attean::API::Term objects of
97           all objects of quads matching the supplied pattern (using the same
98           matching semantics as "get_quads" with an "undef" object).
99
100       "graphs( $subject, $predicate, $object )"
101           Returns an Attean::API::Iterator of Attean::API::Term objects of
102           all graphs of quads matching the supplied pattern (using the same
103           matching semantics as "get_quads" with an "undef" graph).
104
105       "graph_nodes( $graph )"
106           Returns an Attean::API::Iterator of Attean::API::Term objects of
107           unique subjects and objects present in the specified $graph.
108
109       "holds($s, $p, $o, $g)"
110       "holds($triple_pattern)"
111       "holds($quad_pattern)"
112           Returns true if the triple/quad pattern matches any data in the
113           model, false otherwise.
114
115       "algebra_holds($algebra, $graph)"
116       "algebra_holds($algebra, \@graphs)"
117           Returns true if the algebra, evaluated with the supplied default
118           graph(s) matches any data in the model, false otherwise. This is
119           equivalent to the result of an ASK query over the supplied algebra.
120

BUGS

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

SEE ALSO

AUTHOR

127       Gregory Todd Williams  "<gwilliams@cpan.org>"
128
130       Copyright (c) 2014--2019 Gregory Todd Williams.  This program is free
131       software; you can redistribute it and/or modify it under the same terms
132       as Perl itself.
133
134
135
136perl v5.30.0                      2019-10-31             Attean::API::Model(3)
Impressum