-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvalidator.shacl.ttl
422 lines (389 loc) · 13.7 KB
/
validator.shacl.ttl
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sdo: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@base <https://w3id.org/profile/vocpub/validator/> .
<https://w3id.org/profile/vocpub>
a owl:Ontology ;
skos:prefLabel "VocPub Validator"@en ;
skos:definition "SHACL validator for the VocPub Profile"@en ;
dcterms:creator <https://linked.data.gov.au/org/surround> ;
dcterms:publisher <https://linked.data.gov.au/org/surround> ;
dcterms:created "2020-06-14"^^xsd:date ;
dcterms:modified "2021-03-17"^^xsd:date ;
owl:versionIRI <https://w3id.org/profile/vocpub/2.0>
.
#
# ConceptScheme
#
# Requirement-2.1.1 so far un-implemented in SHACL
# Requirement-2.1.2 included below
<Requirement-2.1.2+3>
a sh:NodeShape ;
sh:targetNode skos:ConceptScheme ;
sh:property [
sh:path [ sh:inversePath rdf:type ] ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:message "Requirement 2.1.2 Each vocabulary _MUST_ be presented as a single skos:ConceptScheme object & Requirment 2.1.3 Each vocabulary MUST be presented in a single file which does not contain information other than that which is directly part of the vocabulary and the file is considered the point-of-truth" ;
] ;
.
<Requirement-2.1.4a>
a sh:NodeShape ;
sh:targetClass skos:ConceptScheme ;
sh:message "Requirement 2.1.4 Each vocabulary _MUST_ have one and only one title, a text literal, indicated using the skos:prefLabel property" ;
sh:property [
sh:path skos:prefLabel ;
sh:minCount 1 ;
sh:uniqueLang true ;
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
]
.
<Requirement-2.1.4b>
a sh:NodeShape ;
sh:targetClass skos:ConceptScheme ;
sh:message "Requirement 2.1.4 Each vocabulary _MUST_ have one and only one definition, a text literal text, indicated using the skos:definition property" ;
sh:property [
sh:path skos:definition ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
]
.
<Requirement-2.1.5>
a sh:NodeShape ;
sh:targetClass skos:ConceptScheme ;
sh:property [
sh:path dcterms:created ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:or (
[
sh:datatype xsd:dateTime ;
]
[
sh:datatype xsd:date ;
]
[
sh:datatype xsd:dateTimeStamp ;
]
) ;
sh:message "Requirement 2.1.5 Each vocabulary _MUST_ have one and only one created date indicated using the dcterms:created property that must be either an `xsd:date`, `xsd:dateTime` or `xsd:dateTimeStamp` literal value" ;
] ;
sh:property [
sh:path dcterms:modified ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:or (
[
sh:datatype xsd:dateTime ;
]
[
sh:datatype xsd:date ;
]
[
sh:datatype xsd:dateTimeStamp ;
]
) ;
sh:message "Requirement 2.1.5 Each vocabulary _MUST_ have one and only one modified date indicated using the dcterms:modified property that must be either an `xsd:date`, `xsd:dateTime or `xsd:dateTimeStamp` literal value" ;
] ;
.
<Requirement-2.1.6a>
a sh:NodeShape ;
sh:property [
sh:path dcterms:creator ;
sh:minCount 1 ;
sh:description "Requirement 2.1.6 Each creator agent associated with a vocabulary _MUST_ be typed as an `sdo:Person`, `sdo:Organization` or `sdo:GovernmentOrganization`" ;
sh:or (
[ sh:class sdo:GovernmentOrganization ]
[ sh:class sdo:Organization ]
[ sh:class sdo:Person ]
) ;
] ;
.
<Requirement-2.1.6b>
a sh:NodeShape ;
sh:property [
sh:path dcterms:publisher ;
sh:minCount 1 ;
sh:description "Requirement 2.1.6 Each publisher agent associated with a vocabulary _MUST_ be typed as an sdo:Person, sdo:Organization or sdo:GovernmentOrganization" ;
sh:or (
[ sh:class sdo:GovernmentOrganization ]
[ sh:class sdo:Organization ]
[ sh:class sdo:Person ]
) ;
] ;
.
<Requirement-2.1.7a>
a sh:NodeShape ;
sh:message "Requirement 2.1.7 Provenance for a ConceptScheme _MUST_ be indicated by at least one of the following properties: dcterms:provenance, dcterms:source or prov:wasDerivedFrom." ;
sh:or (
[
sh:minCount 1 ;
sh:path prov:wasDerivedFrom ;
sh:message "This is a message about prov:wasDerivedFrom" ;
]
[
sh:minCount 1 ;
sh:path dcterms:source ;
sh:message "This is a message about dcterms:source" ;
]
[
sh:minCount 1 ;
sh:path dcterms:provenance ;
sh:message "This is a message about dcterms:provenance" ;
]
) ;
sh:targetClass skos:ConceptScheme ;
.
<Requirement-2.1.7b>
a sh:NodeShape ;
sh:targetSubjectsOf dcterms:provenance ;
sh:property [
a sh:PropertyShape ;
sh:maxCount 1 ;
sh:path dcterms:provenance ;
sh:message "You _MUST NOT_ use dcterms:provenance property more than once on any object." ;
] ;
.
<Requirement-2.1.7c>
a sh:NodeShape ;
sh:targetSubjectsOf dcterms:source ;
sh:property [
a sh:PropertyShape ;
sh:maxCount 1 ;
sh:path dcterms:source ;
sh:message "You _MUST NOT_ use dcterms:source property more than once on any object." ;
] ;
.
<Requirement-2.1.7d>
a sh:NodeShape ;
sh:targetSubjectsOf prov:wasDerivedFrom ;
sh:property [
a sh:PropertyShape ;
sh:maxCount 1 ;
sh:path prov:wasDerivedFrom ;
sh:message "You _MUST NOT_ use prov:wasDerivedFrom property more than once on any object." ;
] ;
.
<Requirement-2.1.7e>
a sh:NodeShape ;
sh:targetSubjectsOf dcterms:source ;
sh:property [
a sh:PropertyShape ;
sh:path dcterms:source ;
sh:datatype xsd:anyURI ;
sh:message "Whenever dcterms:source is used, it must be a datatype property indicating an object of type xsd:anyURI" ;
] ;
.
<Requirement-2.1.7f>
a sh:NodeShape ;
sh:targetSubjectsOf dcterms:provenance ;
sh:property [
a sh:PropertyShape ;
sh:path dcterms:provenance ;
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
sh:message "Whenever dcterms:provenance is used, it must be a datatype property indicating an object of type xsd:string or rdf:LangString" ;
] ;
.
<Requirement-2.1.7g>
a sh:NodeShape ;
sh:targetSubjectsOf prov:wasDerivedFrom ;
sh:property [
a sh:PropertyShape ;
sh:path prov:wasDerivedFrom ;
sh:nodeKind sh:IRI ;
sh:message "Whenever prov:wasDerivedFrom is used, it must be an object property indicating an IRI" ;
] ;
.
# Requirement-2.1.8 so far un-implemented in SHACL
<Requirement-2.1.9>
a sh:NodeShape ;
sh:targetClass skos:ConceptScheme ;
sh:property [
sh:path skos:hasTopConcept ;
sh:minCount 1 ;
sh:nodeKind sh:IRI ;
] ;
sh:message "Requirement 2.1.9 Each vocabulary's skos:ConceptScheme _MUST_ link to at least one skos:Concept within the vocabulary as with the property skos:hasTopConcept" ;
.
#
# Collections
#
<Requirement-2.2.1a>
a sh:NodeShape ;
sh:targetClass skos:Collection ;
sh:message "Requirement 2.2.1 Each skos:Collection instance _MUST_ have one and only one title indicated using the skos:prefLabel property that must be a text literal value" ;
sh:property [
sh:path skos:prefLabel ;
sh:minCount 1 ;
sh:uniqueLang true ;
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
]
.
<Requirement-2.2.1b>
a sh:NodeShape ;
sh:targetClass skos:Collection ;
sh:message "Requirement 2.2.1 Each skos:Collection instance _MUST_ have one and only one definition indicated using the skos:definition property that must be a text literal value" ;
sh:property [
sh:path skos:definition ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
]
.
<Requirement-2.2.2>
a sh:NodeShape ;
sh:message "Requirement 2.1.7 Provenance for a Collection _SHOULD_ be indicated by at least one of the following properties: dcterms:provenance, dcterms:source or prov:wasDerivedFrom." ;
sh:or (
[
sh:minCount 1 ;
sh:path prov:wasDerivedFrom ;
sh:message "This is a message about prov:wasDerivedFrom" ;
]
[
sh:minCount 1 ;
sh:path dcterms:source ;
sh:message "This is a message about dcterms:source" ;
]
[
sh:minCount 1 ;
sh:path dcterms:provenance ;
sh:message "This is a message about dcterms:provenance" ;
]
) ;
sh:targetClass skos:Collection ;
sh:severity sh:Warning ;
.
#
# Concept
#
<Requirement-2.3.1a>
a sh:NodeShape ;
sh:targetClass skos:Concept ;
sh:message "Requirement 2.3.1 Each skos:Concept instance _MUST_ have one and only one title indicated using the `skos:prefLabel` property that must be a text literal value" ;
sh:property [
sh:path skos:prefLabel ;
sh:minCount 1 ;
sh:uniqueLang true ;
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
]
.
<Requirement-2.3.1b>
a sh:NodeShape ;
sh:targetClass skos:Concept ;
sh:message "Requirement 2.3.1 Each skos:Concept instance _MUST_ have one and only one definition indicated using the `skos:definition` property that must be a text literal value" ;
sh:property [
sh:path skos:definition ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
]
.
<Requirement-2.3.2>
a sh:NodeShape ;
sh:targetClass skos:Concept ;
sh:message "Requirement 2.3.2 Each skos:Concept in a vocabulary _MAY_ indicate the vocabulary that defines it by use of the `rdfs:isDefinedBy` property indicating a `skos:ConceptScheme` instance" ;
sh:property [
sh:path rdfs:isDefinedBy ;
sh:minCount 0 ;
sh:maxCount 1 ;
sh:nodeKind sh:IRI ;
]
.
<Requirement-2.3.3>
a sh:NodeShape ;
sh:targetClass skos:Concept ;
sh:or (
[
sh:property [
sh:path skos:inScheme ;
sh:minCount 1 ;
sh:class skos:ConceptScheme ;
] ;
]
[
sh:property [
sh:path skos:topConceptOf ;
sh:minCount 1 ;
sh:class skos:ConceptScheme ;
] ;
]
) ;
sh:message "Requirement 2.3.3 Each skos:Concept in a vocabulary _MUST_ indicate that it appears within that vocabulary's hierarchy of terms by use of either or both `skos:inScheme` and `skos:topConceptOf` properties" ;
.
<Requirement-2.3.4>
a sh:NodeShape ;
sh:message "Requirement 2.1.7 Provenance for a Concept _SHOULD_ be indicated by at least one of the following properties: dcterms:provenance, dcterms:source or prov:wasDerivedFrom." ;
sh:or (
[
sh:minCount 1 ;
sh:path prov:wasDerivedFrom ;
sh:message "This is a message about prov:wasDerivedFrom" ;
]
[
sh:minCount 1 ;
sh:path dcterms:source ;
sh:message "This is a message about dcterms:source" ;
]
[
sh:minCount 1 ;
sh:path dcterms:provenance ;
sh:message "This is a message about dcterms:provenance" ;
]
) ;
sh:targetClass skos:Concept ;
sh:severity sh:Warning ;
.
<Requirement-2.3.5>
a sh:NodeShape ;
sh:targetClass skos:Concept ;
sh:message "Requirement 2.3.5 Each skos:Concept in a vocabulary _SHOULD_ indicate its permanent identifier as the value of a `dcterms:identifier` property. If the permanent identifier is a URI, the value may have the datatype `xsd:anyURI`" ;
sh:property [
sh:path dcterms:identifier ;
sh:minCount 0 ;
sh:maxCount 1 ;
sh:nodeKind sh:Literal ;
] ;
sh:severity sh:Info ;
.
#
# Agent
#
# Requirement 2.4.1 is tested by the shape for Requirement 2.1.6a & 2.1.6b
<Requirement-2.4.1>
a sh:NodeShape ;
sh:targetClass sdo:Organization , sdo:Person ;
sh:property [
sh:path sdo:name ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:datatype xsd:string ;
sh:message "Requirement 2.4.2 Each agent _MUST_ indicate at least one name property with the `sdo:name` property that must be a text literal value"
] ;
.
<Requirement-2.4.3a>
a sh:NodeShape ;
sh:targetClass sdo:Organization ;
sh:property [
sh:path sdo:url ;
sh:minCount 1 ;
sh:datatype xsd:anyURI ;
] ;
sh:message "Requirement 2.4.3 Each agent _MUST_ indicate either a `sdo:url` (for organizations) or a `sdo:email` (for people) property with a URL or email value"
.
<Requirement-2.4.3b>
a sh:NodeShape ;
sh:targetClass sdo:Person ;
sh:property [
sh:path sdo:email ;
sh:minCount 1 ;
sh:datatype xsd:anyURI ;
] ;
sh:message "Requirement 2.4.3 Each agent _MUST_ indicate either a sdo:url (for organizations) or a sdo:email (for people) property with a URL or email value"
.