This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
hcls-validator.shex
320 lines (314 loc) · 13.1 KB
/
hcls-validator.shex
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
PREFIX cito: <http://purl.org/spar/cito/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dctypes: <http://purl.org/dc/dcmitype/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX freq: <http://purl.org/cld/freq/>
PREFIX idot: <http://identifiers.org/idot/>
PREFIX lexvo: <http://lexvo.org/id/iso639-3/>
PREFIX pav: <http://purl.org/pav/>
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 schemaorg: <http://schema.org/>
PREFIX sd: <http://www.w3.org/ns/sparql-service-description#>
PREFIX sio: <http://semanticscience.org/resource/>
PREFIX void: <http://rdfs.org/ns/void#>
PREFIX void-ext: <http://ldf.fi/void-ext#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
<SummaryLevelShape> {
#Core
rdf:type (dctypes:Dataset),
!rdf:type (void:Dataset),
!rdf:type (dcat:Distribution),
dct:title rdf:langString,
###dct:alternative rdf:langString, is a MAY property
dct:description rdf:langString,
!dct:creator .,
!pav:createBy .,
!dct:contributor .,
!pav:authoredBy .,
!pav:curatedBy .,
!dct:created .,
!pav:createdOn .,
!pav:authoredOn .,
!pav:curatedOn .,
dct:publisher IRI,
!dct:issued .,
(foaf:page IRI)?,
(schemaorg:logo IRI)?,
(dct:license IRI)* , ### License is now a MAY property
###dct:rights rdf:langString, ### Rights is a MAY property
!dct:language .,
###dcat:theme IRI*, ### Theme is a MAY property, should match something that is a skos:Concept
###dcat:keyword xsd:string, ### Keyword is a MAY property
!void:vocabulary .,
!dct:conformsTo .,
###dct:references IRI, ###MAY property
###cito:citesAsAuthority IRI, ### citation is a MAY property
###rdfs:seeAlso IRI, ###MAY property
###dct:hasPart IRI, ###part is a MAY property, what should be the shape of the description it matches?
!void:subset .,
#Identifiers
###idot:preferredPrefix xsd:string, ### Preferred prefix is a MAY property
###idot:alternatePrefix xsd:string, ### Alternate prefix is a MAY property
!idot:identifierPattern .,
!void:uriRegexPattern .,
!idot:accessPattern ., ### Access pattern is a MAY property
!idot:exampleIdentifier .,
!void:exampleResource .,
#Provenance and Change
!void:inDataset .,
!sio:has-data-item .,
!pav:version .,
!dct:isVersionOf .,
!pav:previousVersion .,
###pav:hasCurrentVersion IRI, ### is a MAY property, should this match an @VersionShape?
!dct:source .,
!pav:retrievedFrom .,
!prov:wasDerivedFrom .,
!pav:createdWith .,
dct:accrualPeriodicity IRI?,###freq:~?, ###TODO Check freq:~ is the correct syntax
#Availability/Distributions
!dcat:distribution .,
!dcat:landingPage .,
!dct:format .,
###dcat:accessURL IRI, ### is a MAY property
!dcat:downloadURL .,
!void:dataDump .,
(void:sparqlEndpoint IRI)?,
#Statistics
!void:triples .,
!void:entities .,
!void:distinctSubjects .,
!void:properties .,
!void:distinctObjects .,
!void:classPartition .,
!void:propertyPartition .,
!void:subset .
}
<VersionLevelShape> {
#Core
rdf:type (dctypes:Dataset),
!rdf:type (void:Dataset),
!rdf:type (dcat:Distribution),
dct:title rdf:langString,
###dct:alternative rdf:langString, is a MAY property
dct:description rdf:langString,
(dct:creator IRI | pav:createdBy IRI)+,
###(dct:contributor IRI)*, ###MAY property
###(pav:authoredBy IRI)*, ###MAY property
###(pav:curatedBy IRI)*, ###MAY property
###TODO add test that one of created or issued is present
(dct:created xsd:date | dct:created xsd:dateTime | dct:created xsd:gYearMonth | dct:created xsd:gYear | pav:createdOn xsd:dateTime)?,
###(pav:createdOn xsd:date | pav:createdOn xsd:dateTime | pav:createdOn xsd:gYearMonth | pav:createdOn xsd:gYear), ###MAY property
###(pav:authoredOn xsd:date | pav:authoredOn xsd:dateTime | pav:authoredOn xsd:gYearMonth | pav:authoredOn xsd:gYear), ###MAY property
###(pav:curatedOn xsd:date | pav:curatedOn xsd:dateTime | pav:curatedOn xsd:gYearMonth | pav:curatedOn xsd:gYear), ###MAY property
dct:publisher IRI,
(dct:issued xsd:date | dct:issued xsd:dateTime | dct:issued xsd:gYearMonth | dct:issued xsd:gYear)?,
(foaf:page IRI)?,
(schemaorg:logo IRI)?,
(dct:license IRI)+ , ### License is SHOULD property, but multiple allowed
###dct:rights rdf:langString, ### Rights is a MAY property
(dct:language .)*, ###TODO define the object
###dcat:theme IRI*, ### Theme is a MAY property, should match something that is a skos:Concept
###dcat:keyword xsd:string, ### Keyword is a MAY property
!void:vocabulary .,
###dct:conformsTo IRI, ###MAY property
###dct:references IRI, ###MAY property
###cito:citesAsAuthority IRI, ### citation is a MAY property
###rdfs:seeAlso IRI, ###MAY property
###dct:hasPart IRI, ###part is a MAY property, what should be the shape of the description it matches?
!void:subset .,
#Identifiers
###idot:preferredPrefix xsd:string, ### Preferred prefix is a MAY property
###idot:alternatePrefix xsd:string, ### Alternate prefix is a MAY property
!idot:identifierPattern .,
!void:uriRegexPattern .,
!idot:accessPattern .,
!idot:exampleIdentifier .,
!void:exampleResource .,
#Provenance and Change
!sio:has-data-item .,
!void:inDataset .,
pav:version xsd:string,
dct:isVersionOf IRI,
(pav:previousVersion IRI)?,
!pav:hasCurrentVersion .,
(dct:source IRI)*,
(pav:retrievedFrom IRI)?,
(prov:wasDerivedFrom IRI)*,
(pav:createdWith IRI)?,
!dct:accrualPeriodicity . ,
#Availability/Distributions
(dcat:distribution IRI)*, ###TODO restrict the shape of the IRI but could be hard to test in practice
###dcat:landingPage IRI, ###MAY property
!dct:format .,
###dcat:accessURL IRI, ### is a MAY property
!dcat:downloadURL .,
!void:dataDump .,
!void:sparqlEndpoint ., ###SHOULD NOT being strict here
#Statistics
!void:triples .,
!void:entities .,
!void:distinctSubjects .,
!void:properties .,
!void:distinctObjects .,
!void:classPartition .,
!void:propertyPartition .,
!void:subset .
}
<DistributionLevelShape> {
#Core
(rdf:type (dctypes:Dataset))?,
###RDF datasets are being validated separately
!rdf:type (void:Dataset),
rdf:type (dcat:Distribution),
dct:title rdf:langString,
###dct:alternative rdf:langString, is a MAY property
dct:description rdf:langString,
(dct:creator IRI | pav:createdBy IRI)+,
###(dct:contributor IRI)*,
###(pav:authoredBy IRI)*,
###(pav:curatedBy IRI)*, MAY property
###TODO add test that one of created or issued is present
(dct:created xsd:date | dct:created xsd:dateTime | dct:created xsd:gYearMonth | dct:created xsd:gYear | pav:createdOn xsd:dateTime)?,
###pav:createdOn xsd:date | pav:createdOn xsd:dateTime | pav:createdOn xsd:gYearMonth | pav:createdOn xsd:gYear, ###MAY property
###pav:authoredOn xsd:date | pav:authoredOn xsd:dateTime | pav:authoredOn xsd:gYearMonth | pav:authoredOn xsd:gYear, ###MAY property
###pav:curatedOn xsd:date | pav:curatedOn xsd:dateTime | pav:curatedOn xsd:gYearMonth | pav:curatedOn xsd:gYear, ###MAY property
dct:publisher IRI,
(dct:issued xsd:date | dct:issued xsd:dateTime | dct:issued xsd:gYearMonth | dct:issued xsd:gYear)?,
(foaf:page IRI)?,
(schemaorg:logo IRI)?,
(dct:license IRI)+ , ### License is MUST property, but multiple allowed
###dct:rights rdf:langString, ### Rights is a MAY property
(dct:language .)*, ###TODO define the object
###dcat:theme IRI*, ### Theme is a MAY property, should match something that is a skos:Concept
###dcat:keyword xsd:string*, ### Keyword is a MAY property
!void:vocabulary .,
(dct:conformsTo IRI)?,
###dct:references IRI, ###MAY property
###cito:citesAsAuthority IRI, ### citation is a MAY property
###rdfs:seeAlso IRI, ###MAY property
!dct:hasPart .,
!void:subset ., ### Not for a non-RDF dataset
#Identifiers
###idot:preferredPrefix xsd:string, ### Preferred prefix is a MAY property
###idot:alternatePrefix xsd:string, ### Alternate prefix is a MAY property
###idot:identifierPattern xsd:string, ###MAY property
!void:uriRegexPattern ., ### Not for an non-RDF dataset
###idot:accessPattern idot:AccessPattern, ### Access pattern is a MAY property
(idot:exampleIdentifier xsd:string)*,
!void:exampleResource ., ### Not for an non-RDF dataset
#Provenance and Change
!sio:has-data-item ., ###Only for RDF dataset
!void:inDataset ., ### Not for a non-RDF dataset
(pav:version xsd:string)?,
!dct:isVersionOf .,
(pav:previousVersion IRI)?,
!pav:hasCurrentVersion .,
(dct:source IRI)*,
(pav:retrievedFrom IRI)?,
(prov:wasDerivedFrom IRI)*,
(pav:createdWith IRI)*,
!dct:accrualPeriodicity . ,
#Availability/Distributions
!dcat:distribution .,
###dcat:landingPage IRI,###MAY property
(dct:format IRI | dct:format xsd:string),
###dcat:accessURL IRI, ### is a MAY property
(dcat:downloadURL IRI)?,
!void:dataDump ., ### Not for a non-RDF dataset
!void:sparqlEndpoint ., #Applying strict semantics here
#Statistics
!void:triples ., ### Not for a non-RDF dataset
!void:entities ., ### Not for a non-RDF dataset
!void:distinctSubjects ., ### Not for a non-RDF dataset
!void:properties ., ### Not for a non-RDF dataset
!void:distinctObjects ., ### Not for a non-RDF dataset
!void:classPartition ., ### Not for a non-RDF dataset
!void:propertyPartition ., ### Not for a non-RDF dataset
!void:subset . ### Not for a non-RDF dataset
}
<RDFDistributionLevelShape> {
#Core
(rdf:type (dctypes:Dataset))?,
rdf:type (void:Dataset),
rdf:type (dcat:Distribution),
dct:title rdf:langString,
###dct:alternative rdf:langString, is a MAY property
dct:description rdf:langString,
(dct:creator IRI | pav:createdBy IRI)+,
###(dct:contributor IRI)*,
###(pav:authoredBy IRI)*,
###(pav:curatedBy IRI)*, MAY property
###TODO add test that one of created or issued is present
(dct:created xsd:date | dct:created xsd:dateTime | dct:created xsd:gYearMonth | dct:created xsd:gYear | pav:createdOn xsd:dateTime)?,
###pav:createdOn xsd:date | pav:createdOn xsd:dateTime | pav:createdOn xsd:gYearMonth | pav:createdOn xsd:gYear, ###MAY property
###pav:authoredOn xsd:date | pav:authoredOn xsd:dateTime | pav:authoredOn xsd:gYearMonth | pav:authoredOn xsd:gYear, ###MAY property
###pav:curatedOn xsd:date | pav:curatedOn xsd:dateTime | pav:curatedOn xsd:gYearMonth | pav:curatedOn xsd:gYear, ###MAY property
dct:publisher IRI,
(dct:issued xsd:date | dct:issued xsd:dateTime | dct:issued xsd:gYearMonth | dct:issued xsd:gYear)?,
(foaf:page IRI)?,
(schemaorg:logo IRI)?,
(dct:license IRI)+ , ### License is MUST property, but multiple allowed
###dct:rights rdf:langString, ### Rights is a MAY property
(dct:language .)*, ###TODO define the object
###dcat:theme IRI*, ### Theme is a MAY property, should match something that is a skos:Concept
###dcat:keyword xsd:string*, ### Keyword is a MAY property
void:vocabulary IRI*,
(dct:conformsTo IRI)?,
###dct:references IRI, ###MAY property
###cito:citesAsAuthority IRI, ### citation is a MAY property
###rdfs:seeAlso IRI, ###MAY property
!dct:hasPart .,
!void:subset ., ### Not for a non-RDF dataset
#Identifiers
###idot:preferredPrefix xsd:string, ### Preferred prefix is a MAY property
###idot:alternatePrefix xsd:string, ### Alternate prefix is a MAY property
###idot:identifierPattern xsd:string, ###MAY property
###void:uriRegexPattern xsd:string, ### May property
###idot:accessPattern idot:AccessPattern, ### Access pattern is a MAY property
(idot:exampleIdentifier xsd:string)*,
(void:exampleResource IRI)*,
#Provenance and Change
###(sio:has-data-item IRI)*, ###MAY property
(pav:version xsd:string)?,
!dct:isVersionOf .,
(pav:previousVersion IRI)?,
!pav:hasCurrentVersion .,
(dct:source IRI)*,
(pav:retrievedFrom IRI)?,
(prov:wasDerivedFrom IRI)*,
(pav:createdWith IRI)?,
!dct:accrualPeriodicity . ,
#Availability/Distributions
!dcat:distribution .,
###dcat:landingPage IRI,###MAY property
(dct:format IRI | dct:format xsd:string), ###Could limit the string to an RDF format
###dcat:accessURL IRI, ### is a MAY property
(dcat:downloadURL IRI)?,
(void:dataDump IRI)?,
!void:sparqlEndpoint ., #Applying strict semantics here
#Statistics
(void:triples xsd:integer)?,
(void:entities xsd:integer)?,
(void:distinctSubjects xsd:integer)?,
(void:properties xsd:integer)?,
(void:distinctObjects xsd:integer)?,
### Number of classes
(void:classPartition @<NumberOfClassesShape>)?,
### Number of graphs
(void:classPartition @<NumberofGraphsShape>)?
#Enhanced Statistics
###Not validating these!!!
###MAY properties
}
<NumberOfClassesShape> {
void:class rdfs:Class ,
void:distinctSubjects xsd:integer
}
<NumberOfGraphsShape> {
void:class sd:Graph ,
void:distinctSubjects xsd:integer
}