This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStore.php
177 lines (165 loc) · 6.45 KB
/
Store.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php
/*
* This file is part of Saft.
*
* (c) Konrad Abicht <[email protected]>
* (c) Natanael Arndt <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Saft\Store;
use Saft\Rdf\NamedNode;
use Saft\Rdf\Node;
use Saft\Rdf\Statement;
use Saft\Rdf\StatementIterator;
use Saft\Sparql\Result\Result;
/**
* Declaration of methods that any Store implementation must have, whether its for a Triple- or Quad store.
*
* @api
*
* @since 0.1
*/
interface Store
{
/**
* Adds multiple Statements to (default-) graph.
*
* @param StatementIterator|array $statements statementList instance must contain Statement instances which are
* 'concret-' and not 'pattern'-statements
* @param Node $graph Overrides target graph. If set, all statements will be add to that
* graph, if it is available. (optional)
* @param array $options Key-value pairs which provide additional introductions for the store
* and/or its adapter(s). (optional)
*
* @api
*
* @since 0.1
*/
public function addStatements($statements, Node $graph = null, array $options = []);
/**
* Removes all statements from a (default-) graph which match with given statement.
*
* @param Statement $statement it can be either a concrete or pattern-statement
* @param Node $graph Overrides target graph. If set, all statements will be delete in that
* graph. (optional)
* @param array $options Key-value pairs which provide additional introductions for the store and/or its
* adapter(s). (optional)
*
* @api
*
* @since 0.1
*/
public function deleteMatchingStatements(
Statement $statement,
Node $graph = null,
array $options = []
);
/**
* It gets all statements of a given graph which match the following conditions:
* - statement's subject is either equal to the subject of the same statement of the graph or
* it is null.
* - statement's predicate is either equal to the predicate of the same statement of the graph or
* it is null.
* - statement's object is either equal to the object of a statement of the graph or it is null.
*
* @param Statement $statement it can be either a concrete or pattern-statement
* @param Node $graph Overrides target graph. If set, you will get all matching statements of
* that graph. (optional)
* @param array $options It contains key-value pairs and should provide additional introductions for
* the store and/or its adapter(s). (optional)
*
* @return StatementIterator it contains Statement instances of all matching statements of the given graph
*
* @api
*
* @since 0.1
*/
public function getMatchingStatements(Statement $statement, Node $graph = null, array $options = []);
/**
* Returns true or false depending on whether or not the statements pattern
* has any matches in the given graph.
*
* @param Statement $statement it can be either a concrete or pattern-statement
* @param Node $graph Overrides target graph. (optional)
* @param array $options It contains key-value pairs and should provide additional introductions for the
* store and/or its adapter(s). (optional)
*
* @return bool returns true if at least one match was found, false otherwise
*
* @api
*
* @since 0.1
*/
public function hasMatchingStatement(Statement $statement, Node $graph = null, array $options = []);
/**
* This method sends a SPARQL query to the store.
*
* @param string $query the SPARQL query to send to the store
* @param array $options It contains key-value pairs and should provide additional introductions for the
* store and/or its adapter(s). (optional)
*
* @return Result Returns result of the query. Its type depends on the type of the query.
*
* @throws \Exception if query is no string, is malformed or an execution error occured
*
* @api
*
* @since 0.1
*/
public function query($query, array $options = []);
/**
* Get information about the store and its features.
*
* @return array array which contains information about the store and its features
*
* @api
*
* @since 0.1
*/
public function getStoreDescription();
/**
* Returns a list of all available graph URIs of the store. It can also respect access control,
* to only returned available graphs in the current context. But that depends on the implementation
* and can differ.
*
* @return array array with the graph URI as key and a NamedNode as value for each graph
*
* @api
*
* @since 0.1
*/
public function getGraphs();
/**
* Create a new graph with the URI given as Node. If the underlying store implementation doesn't
* support empty graphs this method will have no effect.
*
* @param NamedNode $graph instance of NamedNode containing the URI of the graph to create
* @param array $options it contains key-value pairs and should provide additional introductions for
* the store and/or its adapter(s)
*
* @throws \Exception if given $graph is not a NamedNode
* @throws \Exception if the given graph could not be created
*
* @api
*
* @since 0.1
*/
public function createGraph(NamedNode $graph, array $options = []);
/**
* Removes the given graph from the store.
*
* @param NamedNode $graph instance of NamedNode containing the URI of the graph to drop
* @param array $options it contains key-value pairs and should provide additional introductions for
* the store and/or its adapter(s)
*
* @throws \Exception if given $graph is not a NamedNode
* @throws \Exception if the given graph could not be droped
*
* @api
*
* @since 0.1
*/
public function dropGraph(NamedNode $graph, array $options = []);
}