-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathrdf-syntax-shapes.ttl
More file actions
236 lines (200 loc) · 5.6 KB
/
rdf-syntax-shapes.ttl
File metadata and controls
236 lines (200 loc) · 5.6 KB
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX sparql: <http://www.w3.org/ns/sparql#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX srl: <http://www.w3.org/ns/shacl-rules#>
PREFIX srl-sh: <http://www.w3.org/ns/shacl-rules-shapes#>
PREFIX shnex: <http://www.w3.org/ns/shnex#>
#### RDF Term and variables.
## Variables
srl-sh:variableShape rdf:type sh:NodeShape ;
sh:property
[
sh:path srl:varName ;
sh:datatype xsd:string ;
sh:minCount 1 ;
sh:maxCount 1 ;
] .
## RDF Terms (blank nodes exclude syntax usage e.g. as variables)
srl-sh:termShape rdf:type sh:NodeShape ;
sh:name "RDF Term" ;
sh:xone (
srl-sh:blankNodeDataShape
[ sh:nodeKind sh:IRI ]
[ sh:nodeKind sh:Literal ]
[ sh:nodeKind sh:TripleTerm ]
) .
srl-sh:blankNodeDataShape rdf:type sh:NodeShape ;
sh:nodeKind sh:BlankNode ;
sh:not srl-sh:variableShape ;
.
srl-sh:varOrTermShape rdf:type sh:NodeShape ;
sh:name "VarOrTerm" ;
sh:xone ( [ sh:node srl-sh:variableShape ]
[ sh:node srl-sh:termShape ]
) .
srl-sh:varOrIRIShape rdf:type sh:NodeShape ;
sh:name "VarOrIRI" ;
sh:xone ( [ sh:node srl-sh:variableShape ]
[ sh:nodeKind sh:IRI ]
) .
srl-sh:blankNodeOrIRIShape rdf:type sh:NodeShape ;
sh:name "IRIorBlankNode" ;
sh:xone ( [ sh:nodeKind sh:BlankNode ]
[ sh:nodeKind sh:IRI ]
) .
#### Triples
## Symmetric RDF Triple including variables.
srl-sh:tripleShape rdf:type sh:NodeShape ;
sh:property
[ sh:path srl:subject ;
sh:name "Triple subject" ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:node srl-sh:varOrTermShape
] ;
sh:property
[ sh:path srl:predicate ;
sh:name "Triple predicate" ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:node srl-sh:varOrIRIShape
] ;
sh:property
[ sh:path srl:object ;
sh:name "Triple object" ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:node srl-sh:varOrTermShape
] ;
.
## Triple pattern (body)
srl-sh:triplePatternShape rdf:type sh:NodeShape ;
sh:node srl-sh:tripleShape ;
.
# Triple template (head)
srl-sh:tripleTemplateShape rdf:type sh:NodeShape ;
sh:node srl-sh:tripleShape ;
.
## Triple Data (DATA)
srl-sh:tripleDataShape rdf:type sh:NodeShape ;
sh:property
[ sh:path srl:subject ;
sh:name "Data triple subject" ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:node srl-sh:termShape
] ;
sh:property
[ sh:path srl:predicate ;
sh:name "Data triple predicate" ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:nodeKind sh:IRI
] ;
sh:property
[ sh:path srl:object ;
sh:name "Data triple object" ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:node srl-sh:termShape
] ;
.
#### Expressions
srl-sh:expressionShape rdf:type sh:NodeShape ;
## if [ srl:expr [ ...] ]
## sh:property
## [ sh:path srl:expr ;
## sh:minCount 1;
## sh:maxCount 1 ;
## ] ;
.
srl-sh:filterElementShape rdf:type sh:NodeShape ;
sh:property
[ sh:path srl:filter ;
sh:node srl-sh:expressionShape ;
sh:minCount 1 ;
sh:maxCount 1 ;
];
.
srl-sh:assignmentElementShape rdf:type sh:NodeShape ;
sh:property
[ sh:path srl:assign ;
sh:minCount 1;
sh:maxCount 1;
sh:property
[ sh:path srl:assignVar ;
sh:node srl-sh:variableShape ;
sh:minCount 1;
sh:maxCount 1;
];
sh:property
[ sh:path srl:assignValue ;
sh:node srl-sh:expressionShape ;
sh:minCount 1 ;
sh:maxCount 1 ;
];
];
.
srl-sh:negationElementBodyShape rdf:type sh:NodeShape ;
sh:xone (
srl-sh:triplePatternShape
srl-sh:filterElementShape
) .
srl-sh:negationElementShape rdf:type sh:NodeShape ;
sh:property
[ sh:path srl:not ;
sh:memberShape srl-sh:negationElementBodyShape ;
sh:minCount 1 ;
sh:maxCount 1 ;
] .
#### DATA
## In data blocks, allow triple terms for data triples.
srl-sh:dataBlockItemShape rdf:type sh:NodeShape ;
sh:xone (
srl-sh:tripleDataShape
[ sh:nodeKind sh:TripleTerm ]
) .
srl-sh:dataBlockShape rdf:type sh:NodeShape ;
sh:property [
sh:path srl:data ;
sh:memberShape srl-sh:dataBlockItemShape ;
] .
### Rule Elements
srl-sh:ruleBodyElement rdf:type sh:NodeShape ;
sh:xone ( srl-sh:triplePatternShape
srl-sh:filterElementShape
srl-sh:assignmentElementShape
srl-sh:negationElementShape
) .
srl-sh:ruleHeadElement rdf:type sh:NodeShape ;
sh:node srl-sh:tripleTemplateShape
.
#### Rule Shape
srl-sh:ruleHeadShape rdf:type sh:NodeShape ;
sh:property
[ sh:path srl:head ;
sh:memberShape srl-sh:ruleHeadElement ;
sh:maxCount 1;
sh:minCount 1;
] .
srl-sh:ruleBodyShape rdf:type sh:NodeShape ;
sh:property
[ sh:path srl:body ;
sh:memberShape srl-sh:ruleBodyElement;
sh:maxCount 1;
sh:minCount 1;
] .
srl-sh:ruleShape rdf:type sh:NodeShape ;
sh:node srl-sh:ruleHeadShape ;
sh:node srl-sh:ruleBodyShape ;
.
#### Rule Set
srl-sh:ruleSetShape rdf:type sh:NodeShape ;
sh:node srl-sh:dataBlockShape ;
sh:property
[ sh:path srl:rules ;
sh:memberShape srl-sh:ruleShape
];
.