1RDF::Trine::Model(3)  User Contributed Perl Documentation RDF::Trine::Model(3)
2
3
4

NAME

6       RDF::Trine::Model - Model class
7

VERSION

9       This document describes RDF::Trine::Model version 1.019
10

METHODS

12       "new ( $store )"
13           Returns a new model over the supplied rdf store or a new temporary
14           model.  If you provide an unblessed value, it will be used to
15           create a new rdf store.
16
17       "temporary_model"
18           Returns a new temporary (non-persistent) model.
19
20       "dataset_model ( default => \@dgraphs, named => \@ngraphs )"
21           Returns a new model object with the default graph mapped to the
22           union of the graphs named in @dgraphs, and with available named
23           graphs named in @ngraphs.
24
25       "begin_bulk_ops"
26           Provides a hint to the backend that many update operations are
27           about to occur.  The backend may use this hint to, for example,
28           aggregate many operations into a single operation, or delay index
29           maintenence. After the update operations have been executed,
30           "end_bulk_ops" should be called to ensure the updates are committed
31           to the backend.
32
33       "end_bulk_ops"
34           Provides a hint to the backend that a set of bulk operations have
35           been completed and may be committed to the backend.
36
37       "logger ( [ $logger ] )"
38           Returns the logging object responsible for recording data inserts
39           and deletes.
40
41           If $logger is passed as an argument, sets the logger to this
42           object.
43
44       "add_statement ( $statement [, $context] )"
45           Adds the specified $statement to the rdf store.
46
47       "add_hashref ( $hashref [, $context] )"
48           Add triples represented in an RDF/JSON-like manner to the model.
49
50           See "as_hashref" for full documentation of the hashref format.
51
52       "add_iterator ( $iter )"
53           Add triples from the statement iterator to the model.
54
55       "add_list ( @elements )"
56           Adds an rdf:List to the model with the given elements. Returns the
57           node object that is the head of the list.
58
59       "get_list ( $head )"
60           Returns a list of nodes that are elements of the rdf:List
61           represented by the supplied head node.
62
63       "remove_list ( $head [, orphan_check => 1] )"
64           Removes the nodes of type rdf:List that make up the list.
65           Optionally checks each node before removal to make sure that it is
66           not used in any other statements. Returns false if the list was
67           removed completely; returns the first remaining node if the removal
68           was abandoned because of an orphan check.
69
70       "get_sequence ( $seq )"
71           Returns a list of nodes that are elements of the rdf:Seq sequence.
72
73       "remove_statement ( $statement [, $context])"
74           Removes the specified $statement from the rdf store.
75
76       "remove_statements ( $subject, $predicate, $object [, $context] )"
77           Removes all statements matching the supplied $statement pattern
78           from the rdf store.
79
80       "size"
81           Returns the number of statements in the model.
82
83       "etag"
84           If the model is based on a store that has the capability and
85           knowledge to support caching, this method returns a persistent
86           token that will remain consistent as long as the store's data
87           doesn't change. This token is acceptable for use as an HTTP ETag.
88
89       "supports ( [ $feature ] )"
90           If $feature is specified, returns true if the feature is supported
91           by the underlying store, false otherwise. If $feature is not
92           specified, returns a list of supported features.
93
94       "count_statements ( $subject, $predicate, $object )"
95           Returns a count of all the statements matching the specified
96           subject, predicate and objects. Any of the arguments may be undef
97           to match any value.
98
99       "get_statements ($subject, $predicate, $object [, $context] )"
100           Returns an iterator of all statements matching the specified
101           subject, predicate and objects from the rdf store. Any of the
102           arguments may be undef to match any value.
103
104           If three or fewer arguments are given, the statements returned will
105           be matched based on triple semantics (the graph union of triples
106           from all the named graphs). If four arguments are given (even if
107           $context is undef), statements will be matched based on quad
108           semantics (the union of all quads in the underlying store).
109
110       "get_pattern ( $bgp [, $context] [, %args ] )"
111           Returns a stream object of all bindings matching the specified
112           graph pattern.
113
114           If $context is given, restricts BGP matching to only quads with the
115           $context value.
116
117           %args may contain an 'orderby' key-value pair to request a specific
118           ordering based on variable name. The value for the 'orderby' key
119           should be an ARRAY reference containing variable name and direction
120           ('ASC' or 'DESC') tuples.  A valid %args hash, therefore, might
121           look like "orderby => [qw(name ASC)]" (corresponding to a SPARQL-
122           like request to 'ORDER BY ASC(?name)').
123
124       "get_sparql ( $sparql )"
125           Returns a stream object of all bindings matching the specified
126           graph pattern.
127
128       "get_graphs"
129       "get_contexts"
130           Returns an iterator containing the nodes representing the named
131           graphs in the model.
132
133       "as_stream"
134           Returns an iterator containing every statement in the model.
135
136       "as_hashref"
137           Returns a hashref representing the model in an RDF/JSON-like
138           manner.
139
140           A graph like this (in Turtle):
141
142             @prefix ex: <http://example.com/> .
143
144             ex:subject1
145               ex:predicate1
146                 "Foo"@en ,
147                 "Bar"^^ex:datatype1 .
148
149             _:bnode1
150               ex:predicate2
151                 ex:object2 ;
152               ex:predicate3 ;
153                 _:bnode3 .
154
155           Is represented like this as a hashref:
156
157             {
158               "http://example.com/subject1" => {
159                 "http://example.com/predicate1" => [
160                   { 'type'=>'literal', 'value'=>"Foo", 'lang'=>"en" },
161                   { 'type'=>'literal', 'value'=>"Bar", 'datatype'=>"http://example.com/datatype1" },
162                 ],
163               },
164               "_:bnode1" => {
165                 "http://example.com/predicate2" => [
166                   { 'type'=>'uri', 'value'=>"http://example.com/object2" },
167                 ],
168                 "http://example.com/predicate2" => [
169                   { 'type'=>'bnode', 'value'=>"_:bnode3" },
170                 ],
171               },
172             }
173
174           Note that the type of subjects (resource or blank node) is
175           indicated entirely by the convention of starting blank nodes with
176           "_:".
177
178           This hashref structure is compatible with RDF/JSON and with the
179           ARC2 library for PHP.
180
181       "as_graphviz"
182           Returns a GraphViz object of the RDF graph of this model, ignoring
183           graph names/contexts.
184
185           This method will attempt to load the GraphViz module at runtime and
186           will fail if the module is unavailable.
187
188   Node-Centric Graph API
189       "subjects ( $predicate, $object )"
190           Returns a list of the nodes that appear as the subject of
191           statements with the specified $predicate and $object. Either of the
192           two arguments may be undef to signify a wildcard.
193
194       "predicates ( $subject, $object )"
195           Returns a list of the nodes that appear as the predicate of
196           statements with the specified $subject and $object. Either of the
197           two arguments may be undef to signify a wildcard.
198
199       "objects ( $subject, $predicate [, $graph ] [, %options ] )"
200           Returns a list of the nodes that appear as the object of statements
201           with the specified $subject and $predicate. Either of the two
202           arguments may be undef to signify a wildcard. You can further
203           filter objects using the %options argument. Keys in %options
204           indicate the restriction type and may be 'type', 'language', or
205           'datatype'. The value of the 'type' key may be one of 'node',
206           'nil', 'blank', 'resource', 'literal', or 'variable'. The use of
207           either 'language' or 'datatype' restrict objects to literal nodes
208           with a specific language or datatype value, respectively.
209
210       "objects_for_predicate_list ( $subject, @predicates )"
211           Given the RDF::Trine::Node objects $subject and @predicates, finds
212           all matching triples in the model with the specified subject and
213           any of the given predicates, and returns a list of object values
214           (in the partial order given by the ordering of @predicates).
215
216       "bounded_description ( $node )"
217           Returns an RDF::Trine::Iterator::Graph object over the bounded
218           description triples for $node (all triples resulting from a graph
219           traversal starting with "node" and stopping at non-blank nodes).
220
221       "as_string"
222

BUGS

224       Please report any bugs or feature requests to through the GitHub web
225       interface at <https://github.com/kasei/perlrdf/issues>.
226

AUTHOR

228       Gregory Todd Williams  "<gwilliams@cpan.org>"
229
231       Copyright (c) 2006-2012 Gregory Todd Williams. This program is free
232       software; you can redistribute it and/or modify it under the same terms
233       as Perl itself.
234
235
236
237perl v5.28.0                      2018-01-05              RDF::Trine::Model(3)
Impressum