This repository was archived by the owner on Feb 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmanifest.shacl.ttl
More file actions
312 lines (296 loc) · 12.1 KB
/
Copy pathmanifest.shacl.ttl
File metadata and controls
312 lines (296 loc) · 12.1 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
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
@prefix manifest: <https://w3id.org/ascs-ev/envited-x/manifest/v5/> .
@prefix gx: <https://w3id.org/gaia-x/development#> .
@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#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
# The Shapes Graph URI appends "/shapes" to the Ontology URI
<https://w3id.org/ascs-ev/envited-x/manifest/v5/shapes>
a owl:Ontology ;
# The Shapes Graph must import the Domain Ontology
owl:imports <https://w3id.org/ascs-ev/envited-x/manifest/v5> .
manifest:ManifestShape a sh:NodeShape ;
sh:closed false ;
sh:property
[ sh:name "manifest reference"@en ;
sh:description "Self-reference to the manifest.json providing the structure and list of contents for a domain specific asset."@en ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:node manifest:ManifestLinkReferenceShape ;
sh:order 0 ;
sh:path manifest:hasManifestReference
] ,
[ sh:name "license"@en ;
sh:description "Defines the license valid for all content referenced in the manifest. Does not apply to linked data(sets) with explicit license terms."@en ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:node manifest:LicenseLinkReferenceShape ;
sh:order 1 ;
sh:path manifest:hasLicense
] ,
[ sh:name "artifact links"@en ;
sh:description "Defines the links to all relevant artifacts for a digital asset. This is extended by the domain specific ontology."@en ;
sh:minCount 1 ;
sh:node manifest:LinkShape ;
sh:order 2 ;
sh:path manifest:hasArtifacts
] ,
[ sh:name "external artifact links"@en ;
sh:description "Defines the links to all related referenced artifacts for a digital asset. This is extended by the domain specific ontology."@en ;
sh:minCount 0 ;
sh:node manifest:LinkShape ;
sh:order 3 ;
sh:path manifest:hasReferencedArtifacts
] ;
sh:targetClass manifest:Manifest .
#################################################################
# Shape for manifest:Link
# (specialization of manifest:Link that points to licenses)
#################################################################
manifest:LicenseLinkReferenceShape a sh:NodeShape ;
# Ensures base link metadata (filePath, mimeType, etc.)
sh:node manifest:LinkShape ;
# Specific Narrowing for Licenses:
sh:property [
sh:path manifest:hasCategory ;
sh:class manifest:LicenseCategory ;
sh:message "A link used in hasLicense must have a category belonging to manifest:LicenseCategory."@en ;
] .
## Specialized Shape for manifest references
manifest:ManifestLinkReferenceShape a sh:NodeShape ;
sh:node manifest:LinkShape ;
sh:property [
sh:path manifest:hasCategory ;
sh:class manifest:ManifestCategory ;
sh:message "A link used in hasManifestReference must have a category belonging to manifest:ManifestCategory."@en ;
] .
manifest:LinkShape a sh:NodeShape ;
sh:closed false ;
sh:property [
sh:name "IRI"@en ;
sh:description "IRI required if the file is RDF/JSON-LD."@en ;
sh:nodeKind sh:IRI ;
sh:maxCount 1 ;
sh:minCount 0 ;
sh:path manifest:iri ;
sh:message "IRI link is required if this file is an RDF/JSON-LD resource."@en ;
sh:order 0 ;
],
[
sh:description "Additional information about the manifest reference."@en ;
sh:minCount 0 ;
sh:maxCount 1 ;
sh:datatype xsd:string ;
sh:path skos:note ;
sh:message "A skos:note can provide supplementary information about the manifest reference."@en ;
],
[
sh:description "Specifies ontology conformance."@en ;
sh:minCount 0 ;
sh:nodeKind sh:IRI ;
sh:path sh:conformsTo ;
sh:message "Ontology conformance should be provided for JSON-LD files."@en ;
],
[
sh:name "access role"@en ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:class manifest:AccessRole ;
sh:path manifest:hasAccessRole ;
sh:message "Validation of accessRole failed!"@en ;
],
[
sh:name "category"@en ;
sh:description "Specifies artifact category."@en ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:class manifest:Category ;
sh:path manifest:hasCategory ;
sh:message "Each manifest:Link must have exactly one assigned category."@en ;
],
[
sh:name "file metadata"@en ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:node manifest:FileMetadataShape ;
sh:path manifest:hasFileMetadata ;
] ;
# Conditional constraint for manifest:mimeType
sh:or (
[ # Branch 1: MIME type is NOT "application/ld+json"
sh:property [
sh:path ( manifest:hasFileMetadata manifest:mimeType ) ;
sh:not [ sh:pattern "^application/ld\\+json$" ] ;
]
]
[ # Branch 2: MIME type IS "application/ld+json" but the link is part of manifest:hasManifestReference (exception)
sh:property [
sh:path ( manifest:hasFileMetadata manifest:mimeType ) ;
sh:pattern "^application/ld\\+json$" ;
sh:minCount 1 ;
] ;
sh:property [
sh:path [ sh:inversePath manifest:hasManifestReference ] ;
sh:minCount 1 ;
sh:message "This link is a manifest reference so the extra properties are not required." ;
]
]
[ # Branch 3: MIME type IS "application/ld+json" and NOT part of manifest:hasManifestReference,
# so require the additional properties.
sh:property [
sh:path ( manifest:hasFileMetadata manifest:mimeType ) ;
sh:pattern "^application/ld\\+json$" ;
sh:minCount 1 ;
] ;
sh:property [
sh:path manifest:iri ;
sh:minCount 1 ;
sh:message "If the MIME type is 'application/ld+json' and not a manifest reference, an IRI is required." ;
] ;
sh:property [
sh:path skos:note ;
sh:minCount 1 ;
sh:message "If the MIME type is 'application/ld+json' and not a manifest reference, a skos:note is required." ;
] ;
sh:property [
sh:path sh:conformsTo ;
sh:minCount 1 ;
sh:message "If the MIME type is 'application/ld+json' and not a manifest reference, ontology conformance is required." ;
]
]
) ;
sh:targetClass manifest:Link .
manifest:FileMetadataShape a sh:NodeShape ;
sh:closed false ;
sh:property
[ # Path or location for local/remote retrieval
sh:name "file location"@en ;
sh:description "A local or remote path/URL from which the file can be retrieved (e.g. './manifest_reference.json', 'ipfs://...', 's3://...', 'https://...')."@en ;
skos:example "./metadata/gxMetadata.json";
sh:datatype xsd:anyURI ;
sh:message "Validation of URI failed!"@en ;
sh:order 1 ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:path manifest:filePath
],
[
sh:name "mime type"@en ;
sh:description "Defines the MIME type of the file."@en ;
skos:example "application/pdf";
sh:datatype xsd:string;
sh:message "Validation of the MIME type failed!"@en ;
sh:order 2;
sh:maxCount 1;
sh:minCount 1;
sh:path manifest:mimeType;
sh:pattern "^(application|audio|font|example|image|message|model|multipart|text|video)/[a-zA-Z0-9!#$&^_.+-]+$|^x-[a-zA-Z0-9!#$&^_.+-]+/[a-zA-Z0-9!#$&^_.+-]+$"^^xsd:string;
],
[
sh:name "content identifier"@en ;
sh:description "Defines the IPFS CIDv1 identifier of the file."@en ;
skos:example "bafkreic6xmosvgr4a5735itquknu2ljf4fon7wohrzlmabepwkkxtih6um";
sh:datatype xsd:string;
sh:message "The CIDv1 identifier is not valid or is a CIDv0 identifier."@en ;
sh:order 3;
sh:maxCount 1;
sh:minCount 0;
sh:path manifest:cid;
sh:pattern "^((?!Qm[1-9A-HJ-NP-Za-km-z]{44,})|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})$"
],
[
sh:name "file size"@en ;
sh:description "Specifies the file size in bytes."@en ;
skos:example "1048576" ;
sh:datatype xsd:integer ;
sh:message "Validation of file size failed!"@en ;
sh:order 4 ;
sh:maxCount 1 ;
sh:minCount 0 ;
sh:path manifest:fileSize ;
],
[
sh:name "filename"@en ;
sh:description "Specifies the file name (excluding the path) along with its extension."@en ;
skos:example "example.txt" ;
sh:datatype xsd:string ;
sh:message "Filename validation failed!"@en ;
sh:order 5 ;
sh:maxCount 1 ;
sh:minCount 0 ;
sh:path manifest:filename ;
sh:pattern "^([\\w,\\s-]+(?:\\.[\\w,\\s-]+)*)\\.([A-Za-z0-9]+)$" ;
],
[
sh:name "timestamp"@en ;
sh:description "Represents a date or time associated with the file, such as recording time or creation time."@en ;
skos:example "2022-04-01T00:00:00" ;
sh:datatype xsd:dateTime ;
sh:message "Validation of timestamp failed!"@en ;
sh:order 6 ;
sh:maxCount 1 ;
sh:minCount 0 ;
sh:path manifest:timestamp ;
],
[
sh:name "file dimensions"@en ;
sh:description "Defines the dimensions for images and videos."@en ;
sh:maxCount 1 ;
sh:minCount 0 ;
sh:node manifest:DimensionsShape ;
sh:order 7 ;
sh:path manifest:hasDimensions ;
] ;
sh:targetClass manifest:FileMetadata .
manifest:DimensionsShape a sh:NodeShape ;
sh:closed false ;
sh:property
[
sh:name "unit" ;
sh:description "Specifies the unit of measurement (e.g., metres, inches)."@en ;
skos:example "metres" ;
sh:message "Unit must be a valid measurement unit."@en ;
sh:order 0 ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:path manifest:unit ;
sh:in ("metres" "inches" "pixels") ;
],
[
sh:name "width" ;
sh:description "Specifies the width (x-axis) of the item in appropriate units."@en ;
skos:example "1920.0" ;
sh:datatype xsd:float ;
sh:message "Width must be a positive number."@en ;
sh:order 1 ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:path manifest:width ;
sh:minExclusive "0.0"^^xsd:float ;
],
[
sh:name "height" ;
sh:description "Specifies the height (y-axis) of the item in appropriate units."@en ;
skos:example "1080.0" ;
sh:datatype xsd:float ;
sh:message "Height must be a positive number."@en ;
sh:order 2 ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:path manifest:height ;
sh:minExclusive "0.0"^^xsd:float ;
],
[
sh:name "depth" ;
sh:description "Specifies the depth (z-axis) of the item in appropriate units."@en ;
skos:example "0.0" ;
sh:datatype xsd:float ;
sh:message "Depth must be a positive number."@en ;
sh:order 3 ;
sh:maxCount 1 ;
sh:minCount 0 ;
sh:path manifest:depth ;
sh:minExclusive "0.0"^^xsd:float ;
];
sh:targetClass manifest:Dimensions .