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
/
Statement.php
166 lines (152 loc) · 3.89 KB
/
Statement.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
<?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\Rdf;
/**
* This interface is common for RDF statement. It represents a 3-tuple and 4-tuple. A 3-tuple consists
* of subject, predicate and object, whereas a 4-tuple is a 3-tuple but also contains a graph.
*
* @api
*
* @since 0.1
*/
interface Statement
{
/**
* Returns Statements subject.
*
* @return Node subject node
*
* @api
*
* @since 0.1
*/
public function getSubject();
/**
* Returns Statements predicate.
*
* @return Node predicate node
*
* @api
*
* @since 0.1
*/
public function getPredicate();
/**
* Returns Statements object.
*
* @return Node object node
*
* @api
*
* @since 0.1
*/
public function getObject();
/**
* Returns Statements graph, if available.
*
* @return Node|null graph node, if available
*
* @api
*
* @since 0.1
*/
public function getGraph();
/**
* If this statement consists of subject, predicate, object and graph, this function returns true,
* false otherwise.
*
* @return bool true, if this statement consists of subject, predicate, object and graph, false otherwise
*
* @api
*
* @since 0.1
*/
public function isQuad();
/**
* If this statement consists of subject, predicate and object, but no graph, this function returns true,
* false otherwise.
*
* @return bool true, if this statement consists of subject, predicate and object, but no graph, false otherwise
*
* @api
*
* @since 0.1
*/
public function isTriple();
/**
* Returns true if neither subject, predicate, object nor, if available, graph, are patterns.
*
* @return bool true, if neither subject, predicate, object nor, if available, graph, are patterns,
* false otherwise
*
* @api
*
* @since 0.1
*/
public function isConcrete();
/**
* Returns true if at least subject, predicate, object or, if available, graph, are patterns.
*
* @return bool true, if at least subject, predicate, object or, if available, graph, are patterns,
* false otherwise
*
* @api
*
* @since 0.1
*/
public function isPattern();
/**
* Get a valid NQuads serialization of the statement. If the statement is not concrete i.e. it contains variable
* parts this method will throw an exception.
*
* @throws \Exception if the statment is not concrete
*
* @return string a string representation of the statement in valid NQuads syntax
*
* @api
*
* @since 0.1
*/
public function toNQuads();
/**
* Get a string representation of the current statement. It should contain a human readable description of the parts
* of the statement.
*
* @return string a string representation of the statement
*
* @api
*
* @since 0.1
*/
public function __toString();
/**
* Returns true, if the given argument matches the is statement-pattern.
*
* @param Statement $toCompare the statement to where this pattern shoul be applied to
*
* @api
*
* @since 0.1
*/
public function matches(Statement $toCompare);
/**
* Checks if a given Statement instance is equal to this instance.
*
* @param Statement $toCompare the statement to compare with
*
* @return bool true, if the given Statement instance is equal to this one
*
* @api
*
* @since 0.1
*/
public function equals(Statement $toCompare);
}