Skip to content

Commit 6b1859d

Browse files
authored
Merge pull request #47 from eScienceLab/44-implement-review-process-ruleset
Implement Validation Phase Ruleset
2 parents a7c7165 + 0100871 commit 6b1859d

File tree

5 files changed

+767
-1
lines changed

5 files changed

+767
-1
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
five-safes-crate:DownloadActionMayHaveStartTimeIfBegun
27+
a sh:NodeShape ;
28+
sh:name "ValidationCheck" ;
29+
sh:description "" ;
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:ValidationCheck ;
38+
schema:actionStatus ?status .
39+
FILTER(?status IN (
40+
"http://schema.org/CompletedActionStatus",
41+
"http://schema.org/FailedActionStatus",
42+
"http://schema.org/ActiveActionStatus"
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:severity sh:Info ;
55+
sh:description "ValidationCheck MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ;
56+
sh:message "ValidationCheck MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ;
57+
] .
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
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+
five-safes-crate:ValidationCheckObjectHasDescriptiveNameAndIsAssessAction
27+
a sh:NodeShape ;
28+
sh:name "ValidationCheck" ;
29+
sh:description "" ;
30+
31+
sh:target [
32+
a sh:SPARQLTarget ;
33+
sh:select """
34+
PREFIX schema: <http://schema.org/>
35+
PREFIX shp: <https://w3id.org/shp#>
36+
37+
SELECT ?this
38+
WHERE {
39+
?this schema:additionalType shp:ValidationCheck .
40+
}
41+
""" ;
42+
] ;
43+
44+
sh:property [
45+
sh:path rdf:type ;
46+
sh:minCount 1 ;
47+
sh:hasValue schema:AssessAction;
48+
sh:severity sh:Violation ;
49+
sh:message "ValidationCheck MUST be a `schema:AssessAction`." ;
50+
] ;
51+
52+
sh:property [
53+
sh:a sh:PropertyShape ;
54+
sh:name "name" ;
55+
sh:description "ValidationCheck MUST have a human readable name string." ;
56+
sh:path schema:name ;
57+
sh:datatype xsd:string ;
58+
sh:severity sh:Violation ;
59+
sh:message "ValidationCheck MUST have a human readable name string." ;
60+
] .
61+
62+
63+
five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue
64+
a sh:NodeShape ;
65+
sh:name "ValidationCheck" ;
66+
sh:target [
67+
a sh:SPARQLTarget ;
68+
sh:select """
69+
PREFIX schema: <http://schema.org/>
70+
PREFIX shp: <https://w3id.org/shp#>
71+
72+
SELECT ?this
73+
WHERE {
74+
?this schema:additionalType shp:ValidationCheck ;
75+
schema:actionStatus ?status .
76+
}
77+
""" ;
78+
] ;
79+
80+
sh:property [
81+
a sh:PropertyShape ;
82+
sh:name "actionStatus" ;
83+
sh:description "The `actionStatus` of ValidationCheck MUST have an allowed value (see https://schema.org/ActionStatusType)." ;
84+
sh:path schema:actionStatus ;
85+
sh:in (
86+
"http://schema.org/PotentialActionStatus"
87+
"http://schema.org/ActiveActionStatus"
88+
"http://schema.org/CompletedActionStatus"
89+
"http://schema.org/FailedActionStatus"
90+
) ;
91+
sh:severity sh:Violation ;
92+
sh:message "The `actionStatus` of ValidationCheck MUST have an allowed value (see https://schema.org/ActionStatusType)." ;
93+
] .
94+
95+
96+
five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue
97+
a sh:NodeShape ;
98+
sh:name "ValidationCheck" ;
99+
sh:target [
100+
a sh:SPARQLTarget ;
101+
sh:select """
102+
PREFIX schema: <http://schema.org/>
103+
PREFIX shp: <https://w3id.org/shp#>
104+
105+
SELECT ?this
106+
WHERE {
107+
?this schema:additionalType shp:ValidationCheck .
108+
}
109+
""" ;
110+
] ;
111+
112+
sh:property [
113+
a sh:PropertyShape ;
114+
sh:minCount 1 ;
115+
sh:name "actionStatus" ;
116+
sh:description "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ;
117+
sh:path schema:actionStatus ;
118+
sh:in (
119+
"http://schema.org/PotentialActionStatus"
120+
"http://schema.org/ActiveActionStatus"
121+
"http://schema.org/CompletedActionStatus"
122+
"http://schema.org/FailedActionStatus"
123+
) ;
124+
sh:severity sh:Violation ;
125+
sh:message "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ;
126+
] .
127+
128+
129+
five-safes-crate:ValidationCheckStartTimeMUSTFollowISOStandard
130+
a sh:NodeShape ;
131+
sh:name "ValidationCheck" ;
132+
sh:description "" ;
133+
sh:target [
134+
a sh:SPARQLTarget ;
135+
sh:select """
136+
PREFIX schema: <http://schema.org/>
137+
PREFIX shp: <https://w3id.org/shp#>
138+
139+
SELECT ?this
140+
WHERE {
141+
?this schema:additionalType shp:ValidationCheck .
142+
}
143+
""" ;
144+
] ;
145+
146+
sh:property [
147+
a sh:PropertyShape ;
148+
sh:name "StartTime" ;
149+
sh:minCount 0;
150+
sh:path schema:startTime ;
151+
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})$" ;
152+
sh:severity sh:Violation ;
153+
sh:message "ValidationCheck --> `startTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
154+
] .
155+
156+
157+
five-safes-crate:ValidationCheckEndTimeMUSTFollowISOStandard
158+
a sh:NodeShape ;
159+
sh:name "ValidationCheck" ;
160+
sh:description "" ;
161+
sh:target [
162+
a sh:SPARQLTarget ;
163+
sh:select """
164+
PREFIX schema: <http://schema.org/>
165+
PREFIX shp: <https://w3id.org/shp#>
166+
167+
SELECT ?this
168+
WHERE {
169+
?this schema:additionalType shp:ValidationCheck .
170+
}
171+
""" ;
172+
] ;
173+
174+
sh:property [
175+
a sh:PropertyShape ;
176+
sh:name "EndTime" ;
177+
sh:minCount 0;
178+
sh:path schema:endTime ;
179+
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})$" ;
180+
sh:severity sh:Violation ;
181+
sh:message "ValidationCheck --> `endTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
182+
] .

0 commit comments

Comments
 (0)