Skip to content

Commit ad009be

Browse files
authored
Merge pull request #40 from eScienceLab/32-sign-off-phase-checks-5s-rocrate
32 sign off phase checks 5s rocrate
2 parents 72f9a62 + efa366a commit ad009be

File tree

5 files changed

+905
-0
lines changed

5 files changed

+905
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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 sh: <http://www.w3.org/ns/shacl#> .
21+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
22+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23+
@prefix shp: <https://w3id.org/shp#> .
24+
25+
26+
five-safes-crate:SignOffPhaseStartTime
27+
a sh:NodeShape ;
28+
sh:name "SignOffPhaseStartTime" ;
29+
30+
sh:target [
31+
a sh:SPARQLTarget ;
32+
sh:select """
33+
PREFIX schema: <http://schema.org/>
34+
PREFIX shp: <https://w3id.org/shp#>
35+
SELECT ?this
36+
WHERE {
37+
?this schema:additionalType shp:SignOff ;
38+
schema:actionStatus ?status .
39+
FILTER(?status IN (
40+
"http://schema.org/ActiveActionStatus",
41+
"http://schema.org/CompletedActionStatus",
42+
"http://schema.org/FailedActionStatus"
43+
))
44+
}
45+
""" ;
46+
] ;
47+
48+
sh:property [
49+
a sh:PropertyShape ;
50+
sh:name "StartTime" ;
51+
sh:path schema:startTime ;
52+
sh:minCount 1 ;
53+
sh:maxCount 1 ;
54+
sh:pattern "^[0-9]{4}-[0-9]{2}-[0-9]{2}[Tt][0-9]{2}:[0-9]{2}:[0-9]{2}([.|,][0-9]+)?(Z|z|[+-][0-9]{2}:[0-9]{2})$" ;
55+
sh:severity sh:Info ;
56+
sh:description "Sign Off object MAY have a startTime property if action is active, completed or failed. This must follow ISO-8601 syntax" ;
57+
sh:message "Sign Off object MAY have a startTime property if action is active, completed or failed. This must follow ISO-8601 syntax" ;
58+
] .
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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+
five-safes-crate:SignOffObjectActionAndName
26+
a sh:NodeShape ;
27+
sh:name "SignOff" ;
28+
sh:description "Sign Off phase" ;
29+
30+
sh:target [
31+
a sh:SPARQLTarget ;
32+
sh:select """
33+
PREFIX schema: <http://schema.org/>
34+
PREFIX shp: <https://w3id.org/shp#>
35+
SELECT ?this
36+
WHERE {
37+
?this schema:additionalType shp:SignOff .
38+
}
39+
""" ;
40+
] ;
41+
42+
sh:property [
43+
sh:path schema:name ;
44+
sh:datatype xsd:string ;
45+
sh:minCount 1 ;
46+
sh:severity sh:Violation ;
47+
sh:message "Sign Off phase MUST have a human-readable name string." ;
48+
] ;
49+
50+
sh:property [
51+
sh:path rdf:type ;
52+
sh:minCount 1 ;
53+
sh:hasValue schema:AssessAction;
54+
sh:severity sh:Violation ;
55+
sh:message "Sign Off phase MUST be a `schema:AssessAction`." ;
56+
] .
57+
58+
five-safes-crate:SignOffObjectHasActionStatus
59+
a sh:NodeShape ;
60+
sh:name "SignOffStatus" ;
61+
sh:description "Sign Off Phase Action Status" ;
62+
63+
sh:target [
64+
a sh:SPARQLTarget ;
65+
sh:select """
66+
PREFIX schema: <http://schema.org/>
67+
PREFIX shp: <https://w3id.org/shp#>
68+
SELECT ?this
69+
WHERE {
70+
?this schema:additionalType shp:SignOff ;
71+
schema:actionStatus ?status .
72+
}
73+
""" ;
74+
] ;
75+
76+
sh:property [
77+
a sh:PropertyShape ;
78+
sh:name "actionStatus" ;
79+
sh:description "The value of actionStatus MUST be one of the allowed values." ;
80+
sh:path schema:actionStatus ;
81+
sh:in (
82+
"http://schema.org/PotentialActionStatus"
83+
"http://schema.org/ActiveActionStatus"
84+
"http://schema.org/CompletedActionStatus"
85+
"http://schema.org/FailedActionStatus"
86+
) ;
87+
sh:severity sh:Violation ;
88+
sh:message "The value of actionStatus MUST be one of the allowed values: PotentialActionStatus; ActiveActionStatus; CompletedActionStatus; FailedActionStatus." ;
89+
] .
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
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 sh: <http://www.w3.org/ns/shacl#> .
21+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
22+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23+
@prefix shp: <https://w3id.org/shp#> .
24+
25+
26+
# There SHOULD be a Sign-Off Phase
27+
five-safes-crate:SignOffPhase
28+
a sh:NodeShape ;
29+
sh:targetNode <./> ;
30+
sh:description "Check the Sign-Off Phase" ;
31+
sh:sparql [
32+
sh:select """
33+
PREFIX schema: <http://schema.org/>
34+
PREFIX shp: <https://w3id.org/shp#>
35+
SELECT $this
36+
WHERE {
37+
FILTER NOT EXISTS {
38+
?action schema:additionalType shp:SignOff .
39+
}
40+
}
41+
""" ;
42+
sh:severity sh:Warning ;
43+
sh:message "There SHOULD be a Sign-Off Phase in the Final RO-Crate" ;
44+
] ;
45+
sh:sparql [
46+
sh:select """
47+
PREFIX schema: <http://schema.org/>
48+
PREFIX shp: <https://w3id.org/shp#>
49+
SELECT $this
50+
WHERE {
51+
?action schema:additionalType shp:SignOff .
52+
FILTER NOT EXISTS {
53+
$this schema:mentions ?action .
54+
}
55+
}
56+
""" ;
57+
sh:severity sh:Warning ;
58+
sh:message "The Root Data Entity SHOULD mention a Sign-Off Phase Object" ;
59+
] .
60+
61+
62+
five-safes-crate:SignOffPhaseProperties
63+
a sh:NodeShape ;
64+
sh:description "Check Sign-Off Phase Properties" ;
65+
sh:target [
66+
a sh:SPARQLTarget ;
67+
sh:select """
68+
PREFIX schema: <http://schema.org/>
69+
PREFIX shp: <https://w3id.org/shp#>
70+
SELECT ?this
71+
WHERE {
72+
?this schema:additionalType shp:SignOff .
73+
}
74+
"""
75+
] ;
76+
sh:property [
77+
sh:description "Check if the Sign Off phase has an actionStatus" ;
78+
sh:path schema:actionStatus ;
79+
sh:minCount 1 ;
80+
sh:severity sh:Warning ;
81+
sh:message "The Sign-Off Phase SHOULD have an actionStatus" ;
82+
] ;
83+
sh:property [
84+
sh:description "Check if the Sign Off phase has an agent" ;
85+
sh:path schema:agent ;
86+
sh:minCount 1 ;
87+
sh:severity sh:Warning ;
88+
sh:message "The Sign-Off Phase SHOULD have an agent" ;
89+
] ;
90+
sh:property [
91+
sh:description "Check if the Sign Off phase has an instrument (TRE Policy)" ;
92+
sh:path schema:instrument ;
93+
sh:class schema:CreativeWork ;
94+
sh:nodeKind sh:IRI;
95+
sh:minCount 1 ;
96+
sh:severity sh:Warning ;
97+
sh:message "The Sign-Off Phase SHOULD have an TRE policy (instrument) with type CreativeWork" ;
98+
] ;
99+
sh:property [
100+
sh:description "Check if the Sign Off phase has an instrument (TRE Policy)" ;
101+
sh:path ( schema:instrument schema:name ) ;
102+
sh:datatype xsd:string ;
103+
sh:minCount 1 ;
104+
sh:severity sh:Warning ;
105+
sh:message "The Sign-Off Phase SHOULD have an TRE policy (instrument) with a human-readable name" ;
106+
] ;
107+
sh:sparql [
108+
a sh:SPARQLConstraint ;
109+
sh:description "Check if the Sign Off phase lists the workflow as an object" ;
110+
sh:select """
111+
PREFIX schema: <http://schema.org/>
112+
PREFIX rocrate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/>
113+
SELECT $this
114+
WHERE {
115+
?root a schema:Dataset ;
116+
schema:mainEntity ?mainEntity ;
117+
rdf:type rocrate:RootDataEntity .
118+
FILTER NOT EXISTS {
119+
$this schema:object ?mainEntity .
120+
}
121+
}
122+
""" ;
123+
sh:severity sh:Warning ;
124+
sh:message "The Sign-Off Phase SHOULD list the workflow (mainEntity) as an object" ;
125+
];
126+
sh:sparql [
127+
a sh:SPARQLConstraint ;
128+
sh:description "Check if the Sign Off phase lists the Responsible Project as an object" ;
129+
sh:select """
130+
PREFIX schema: <http://schema.org/>
131+
PREFIX rocrate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/>
132+
SELECT $this
133+
WHERE {
134+
?root a schema:Dataset ;
135+
rdf:type rocrate:RootDataEntity ;
136+
schema:sourceOrganization ?sourceOrg .
137+
FILTER NOT EXISTS {
138+
$this schema:object ?sourceOrg .
139+
}
140+
}
141+
""" ;
142+
sh:severity sh:Warning ;
143+
sh:message "The Sign-Off Phase SHOULD list the Responsible Project (sourceOrganization) as an object" ;
144+
].
145+
146+
147+
five-safes-crate:SignOffPhaseEndTime
148+
a sh:NodeShape ;
149+
sh:description "Sign Off end time check" ;
150+
151+
sh:target [
152+
a sh:SPARQLTarget ;
153+
sh:select """
154+
PREFIX schema: <http://schema.org/>
155+
PREFIX shp: <https://w3id.org/shp#>
156+
SELECT ?this
157+
WHERE {
158+
?this schema:additionalType shp:SignOff ;
159+
schema:actionStatus ?status .
160+
FILTER(?status IN (
161+
"http://schema.org/CompletedActionStatus",
162+
"http://schema.org/FailedActionStatus"
163+
))
164+
}
165+
""" ;
166+
] ;
167+
168+
sh:property [
169+
a sh:PropertyShape ;
170+
sh:name "EndTime" ;
171+
sh:path schema:endTime ;
172+
sh:minCount 1 ;
173+
sh:maxCount 1 ;
174+
sh:pattern "^[0-9]{4}-[0-9]{2}-[0-9]{2}[Tt][0-9]{2}:[0-9]{2}:[0-9]{2}([.|,][0-9]+)?(Z|z|[+-][0-9]{2}:[0-9]{2})$" ;
175+
sh:severity sh:Warning ;
176+
sh:description "Sign Off object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;
177+
sh:message "Sign Off object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;
178+
] .

tests/data/crates/valid/five-safes-crate-result/ro-crate-metadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@
279279
},
280280
"name": "Sign-off of execution according to Agreement policy: approved",
281281
"endTime": "2023-04-19T17:15:12+01:00",
282+
"startTime": "2023-04-19T10:15:12+01:00",
282283
"object": [
283284
{
284285
"@id": "./"

0 commit comments

Comments
 (0)