Skip to content

Commit e40e5b4

Browse files
committed
Flattened ttl files for ruleset 14_workflow_retrieval_phase.
1 parent fcd6ff1 commit e40e5b4

4 files changed

Lines changed: 344 additions & 386 deletions

File tree

Lines changed: 344 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,344 @@
1+
# Copyright (c) 2025 eScience Lab, The University of Manchester
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
@prefix ro: <./> .
16+
@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
17+
@prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> .
18+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
19+
@prefix schema: <http://schema.org/> .
20+
@prefix purl: <http://purl.org/dc/terms/> .
21+
@prefix sh: <http://www.w3.org/ns/shacl#> .
22+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
23+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
24+
25+
26+
#=== MUST shapes ===#
27+
28+
five-safes-crate:DownloadActionObjectMUSTHavesDescriptiveName
29+
a sh:NodeShape ;
30+
sh:name "DownloadAction" ;
31+
sh:targetClass schema:DownloadAction ;
32+
sh:description "" ;
33+
34+
sh:property [
35+
a sh:PropertyShape ;
36+
sh:name "name" ;
37+
sh:description "DownloadAction MUST have a human readable name string." ;
38+
sh:path schema:name ;
39+
sh:minCount 1 ;
40+
sh:maxCount 1 ;
41+
sh:datatype xsd:string ;
42+
sh:severity sh:Violation ;
43+
sh:message "DownloadAction MUST have a human readable name string." ;
44+
] .
45+
46+
47+
48+
five-safes-crate:WorkflowSameAsAndRootDataEntityMainEntityMUSTBeTheSame
49+
a sh:NodeShape ;
50+
sh:name "Downloaded Workflow" ;
51+
sh:description "" ;
52+
sh:severity sh:Violation ;
53+
54+
sh:target [
55+
a sh:SPARQLTarget ;
56+
sh:select """
57+
PREFIX schema: <http://schema.org/>
58+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
59+
60+
SELECT ?this
61+
WHERE {
62+
?this rdf:type schema:Dataset .
63+
?s rdf:type schema:DownloadAction ;
64+
schema:result ?this .
65+
}
66+
""" ;
67+
];
68+
69+
sh:sparql [
70+
a sh:SPARQLConstraint ;
71+
sh:select """
72+
PREFIX schema: <http://schema.org/>
73+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
74+
75+
SELECT $this
76+
WHERE {
77+
FILTER NOT EXISTS {
78+
$this schema:sameAs ?o .
79+
?s schema:mainEntity ?o .
80+
# ?o rdf:type schema:Dataset .
81+
}
82+
}
83+
""" ;
84+
85+
sh:description "The property `sameAs` of the entity representing the downloaded workflow MUST point to the same entity as `RootDataEntity` --> `mainEntity`." ;
86+
sh:message "The property `sameAs` of the entity representing the downloaded workflow MUST point to the same entity as `RootDataEntity` --> `mainEntity`." ;
87+
] .
88+
89+
90+
five-safes-crate:DownloadedWorkflowDistributionAndDownloadActionObjectMUSTBeTheSame
91+
a sh:NodeShape ;
92+
sh:name "Downloaded Workflow" ;
93+
sh:description "" ;
94+
sh:severity sh:Violation ;
95+
96+
sh:target [
97+
a sh:SPARQLTarget ;
98+
sh:select """
99+
PREFIX schema: <http://schema.org/>
100+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
101+
102+
SELECT ?this
103+
WHERE {
104+
?this rdf:type schema:Dataset .
105+
?s rdf:type schema:DownloadAction ;
106+
schema:result ?this .
107+
}
108+
""" ;
109+
];
110+
111+
sh:sparql [
112+
a sh:SPARQLConstraint ;
113+
sh:name "" ;
114+
sh:select """
115+
PREFIX schema: <http://schema.org/>
116+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
117+
118+
SELECT $this
119+
WHERE {
120+
?action rdf:type schema:DownloadAction .
121+
FILTER NOT EXISTS {
122+
$this schema:distribution ?url .
123+
?action schema:object ?url .
124+
}
125+
}
126+
""" ;
127+
sh:message "DownloadedWorkflow --> `distribution` MUST reference the same entity as `DownloadAction` --> `object`." ;
128+
] .
129+
130+
131+
five-safes-crate:DownloadActionActionStatusMUSTHaveAllowedValues
132+
a sh:NodeShape ;
133+
sh:name "DownloadAction" ;
134+
sh:description "" ;
135+
136+
sh:target [
137+
a sh:SPARQLTarget ;
138+
sh:select """
139+
PREFIX schema: <http://schema.org/>
140+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
141+
142+
SELECT ?this
143+
WHERE {
144+
?this rdf:type schema:DownloadAction ;
145+
schema:actionStatus ?status .
146+
}
147+
""" ;
148+
] ;
149+
150+
sh:property [
151+
a sh:PropertyShape ;
152+
sh:name "ActionStatus" ;
153+
sh:path schema:actionStatus ;
154+
sh:in (
155+
"http://schema.org/PotentialActionStatus"
156+
"http://schema.org/ActiveActionStatus"
157+
"http://schema.org/CompletedActionStatus"
158+
"http://schema.org/FailedActionStatus"
159+
) ;
160+
sh:severity sh:Violation ;
161+
sh:message "The value of actionStatus MUST be one of the allowed values: PotentialActionStatus; ActiveActionStatus; CompletedActionStatus; FailedActionStatus." ;
162+
] .
163+
164+
165+
#=== SHOULD shapes ===#
166+
167+
five-safes-crate:DownloadActionEntitySHOULDExist
168+
a sh:NodeShape ;
169+
sh:name "RootDataEntity" ;
170+
sh:description "" ;
171+
sh:targetClass ro-crate:RootDataEntity ;
172+
sh:severity sh:Warning ;
173+
174+
sh:sparql [
175+
a sh:SPARQLConstraint ;
176+
sh:name "" ;
177+
sh:select """
178+
PREFIX schema: <http://schema.org/>
179+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
180+
181+
SELECT $this
182+
WHERE {
183+
FILTER NOT EXISTS {
184+
?s rdf:type schema:DownloadAction .
185+
}
186+
}
187+
""" ;
188+
sh:message "An entity typed DownloadAction SHOULD exist." ;
189+
] .
190+
191+
192+
193+
five-safes-crate:RootDataEntitySHOULDMentionDownloadActionIfPresent
194+
a sh:NodeShape ;
195+
sh:name "RootDataEntity" ;
196+
sh:description "" ;
197+
sh:targetClass ro-crate:RootDataEntity ;
198+
sh:severity sh:Warning ;
199+
200+
sh:sparql [
201+
a sh:SPARQLConstraint ;
202+
sh:name "" ;
203+
sh:select """
204+
PREFIX schema: <http://schema.org/>
205+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
206+
207+
SELECT $this ?da
208+
WHERE {
209+
?da rdf:type schema:DownloadAction .
210+
FILTER NOT EXISTS {
211+
$this schema:mentions ?da .
212+
}
213+
}
214+
""" ;
215+
sh:message "RootDataEntity SHOULD mention DownloadAction if this exists." ;
216+
] .
217+
218+
219+
five-safes-crate:DownloadActionShouldHaveEndTimeIfEnded
220+
a sh:NodeShape ;
221+
sh:name "DownloadAction" ;
222+
sh:description "" ;
223+
sh:target [
224+
a sh:SPARQLTarget ;
225+
sh:select """
226+
PREFIX schema: <http://schema.org/>
227+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
228+
229+
SELECT ?this
230+
WHERE {
231+
?this rdf:type schema:DownloadAction ;
232+
schema:actionStatus ?status .
233+
FILTER(?status IN (
234+
"http://schema.org/CompletedActionStatus",
235+
"http://schema.org/FailedActionStatus"
236+
))
237+
}
238+
""" ;
239+
] ;
240+
241+
sh:property [
242+
a sh:PropertyShape ;
243+
sh:name "EndTime" ;
244+
sh:path schema:endTime ;
245+
sh:minCount 1 ;
246+
sh:maxCount 1 ;
247+
sh:severity sh:Warning ;
248+
sh:message "`DownloadAction` SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ;
249+
] .
250+
251+
252+
five-safes-crate:DownloadActionShouldHaveActionStatus
253+
a sh:NodeShape ;
254+
sh:name "DownloadAction" ;
255+
sh:targetClass schema:DownloadAction ;
256+
sh:description "" ;
257+
258+
sh:property [
259+
a sh:PropertyShape ;
260+
sh:name "ActionStatus" ;
261+
sh:path schema:actionStatus ;
262+
sh:minCount 1 ;
263+
sh:severity sh:Warning ;
264+
sh:message "`DownloadAction` SHOULD have `actionStatus` property." ;
265+
] .
266+
267+
268+
#=== MAY shapes ===#
269+
270+
five-safes-crate:DownloadedWorkflowSHOULDExistAndBeReferencedByDownloadActionResult
271+
a sh:NodeShape ;
272+
sh:name "DownloadAction" ;
273+
sh:description "Validates that DownloadAction result references an existing entity" ;
274+
sh:targetClass schema:DownloadAction ;
275+
276+
sh:property [
277+
a sh:PropertyShape ;
278+
sh:name "Result" ;
279+
sh:description "The result property must reference an existing entity in the RO-Crate" ;
280+
sh:path schema:result ;
281+
sh:minCount 1 ;
282+
sh:nodeKind sh:IRI ;
283+
sh:sparql [
284+
a sh:SPARQLConstraint ;
285+
sh:select """
286+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
287+
PREFIX schema: <http://schema.org/>
288+
289+
SELECT $this $value
290+
WHERE {
291+
$this schema:result $value .
292+
293+
# Entity must have BOTH type AND name (proper definition)
294+
FILTER NOT EXISTS {
295+
$value rdf:type schema:Dataset .
296+
}
297+
}
298+
""" ;
299+
] ;
300+
sh:severity sh:Info ;
301+
sh:message "The entity representing the downloaded workflow is not defined, OR is not referenced by `DownloadAction` --> `result`, OR is not of type `Dataset`." ;
302+
] .
303+
304+
305+
five-safes-crate:DownloadActionMayHaveStartTimeIfBegun
306+
a sh:NodeShape ;
307+
sh:name "DownloadAction" ;
308+
sh:description (
309+
"`DownloadAction` MAY have the `startTime` property if `actionStatus` "
310+
"is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus."
311+
);
312+
313+
sh:target [
314+
a sh:SPARQLTarget ;
315+
sh:select """
316+
PREFIX schema: <http://schema.org/>
317+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
318+
319+
SELECT ?this
320+
WHERE {
321+
?this rdf:type schema:DownloadAction ;
322+
schema:actionStatus ?status .
323+
FILTER(?status IN (
324+
"http://schema.org/CompletedActionStatus",
325+
"http://schema.org/FailedActionStatus",
326+
"http://schema.org/ActiveActionStatus"
327+
))
328+
}
329+
""" ;
330+
] ;
331+
332+
sh:property [
333+
a sh:PropertyShape ;
334+
sh:name "StartTime" ;
335+
sh:path schema:startTime ;
336+
sh:minCount 1 ;
337+
sh:maxCount 1 ;
338+
sh:description (
339+
"`DownloadAction` MAY have the `startTime` property if `actionStatus` "
340+
"is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus."
341+
);
342+
sh:severity sh:Info ;
343+
sh:message "`DownloadAction` MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ;
344+
] .

0 commit comments

Comments
 (0)