Skip to content

Commit e5b29ba

Browse files
committed
Merged 12_check_phase.ttl files.
1 parent 7d71244 commit e5b29ba

File tree

4 files changed

+153
-189
lines changed

4 files changed

+153
-189
lines changed

rocrate_validator/profiles/five-safes-crate/should/12_check_phase.ttl renamed to rocrate_validator/profiles/five-safes-crate/12_check_phase.ttl

Lines changed: 126 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,108 @@
2323
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
2424

2525

26-
five-safes-crate:RootDataEntityShouldMentionCheckValueObject
26+
#=== MUST shapes ===#
27+
28+
five-safes-crate:CheckValueObjectHasDescriptiveNameAndIsAssessAction
2729
a sh:NodeShape ;
28-
sh:name "RootDataEntity" ;
29-
sh:targetClass ro-crate:RootDataEntity ;
30+
sh:name "CheckValue" ;
3031
sh:description "" ;
3132

32-
sh:sparql [
33-
a sh:SPARQLConstraint ;
34-
sh:name "mentions" ;
35-
sh:description "RootDataEntity SHOULD mention a check value object." ;
33+
sh:target [
34+
a sh:SPARQLTarget ;
3635
sh:select """
3736
PREFIX schema: <http://schema.org/>
38-
PREFIX shp: <https://w3id.org/shp#>
39-
SELECT $this
37+
PREFIX shp: <https://w3id.org/shp#>
38+
39+
SELECT ?this
4040
WHERE {
41-
FILTER NOT EXISTS{
42-
$this schema:mentions ?action .
43-
?action schema:additionalType shp:CheckValue .
44-
}
41+
?this schema:additionalType shp:CheckValue .
4542
}
4643
""" ;
47-
sh:severity sh:Warning ;
48-
sh:message "RootDataEntity SHOULD mention a check value object." ;
44+
] ;
45+
46+
sh:property [
47+
sh:path rdf:type ;
48+
sh:minCount 1 ;
49+
sh:hasValue schema:AssessAction;
50+
sh:severity sh:Violation ;
51+
sh:message "CheckValue MUST be a `AssessAction`." ;
52+
] ;
53+
54+
sh:property [
55+
sh:a sh:PropertyShape ;
56+
sh:name "name" ;
57+
sh:description "CheckValue MUST have a human readable name string." ;
58+
sh:path schema:name ;
59+
sh:datatype xsd:string ;
60+
sh:severity sh:Violation ;
61+
sh:message "CheckValue MUST have a human readable name string." ;
62+
] .
63+
64+
five-safes-crate:CheckValueActionStatusMustHaveAllowedValues
65+
a sh:NodeShape ;
66+
sh:name "CheckValue" ;
67+
sh:description "" ;
68+
69+
sh:target [
70+
a sh:SPARQLTarget ;
71+
sh:select """
72+
PREFIX schema: <http://schema.org/>
73+
PREFIX shp: <https://w3id.org/shp#>
74+
75+
SELECT ?this
76+
WHERE {
77+
?this schema:additionalType shp:CheckValue ;
78+
schema:actionStatus ?status .
79+
}
80+
""" ;
81+
] ;
82+
83+
sh:property [
84+
a sh:PropertyShape ;
85+
sh:name "ActionStatus" ;
86+
sh:path schema:actionStatus ;
87+
sh:in (
88+
"http://schema.org/PotentialActionStatus"
89+
"http://schema.org/ActiveActionStatus"
90+
"http://schema.org/CompletedActionStatus"
91+
"http://schema.org/FailedActionStatus"
92+
) ;
93+
sh:severity sh:Violation ;
94+
sh:message "`CheckValue` --> `actionStatus` MUST have one of the allowed values." ;
4995
] .
5096

5197

98+
#=== SHOULD shapes ===#
99+
100+
#--- THIS NEEDS FURTHER CHECKS ---#
101+
102+
# five-safes-crate:RootDataEntityShouldMentionCheckValueObject
103+
# a sh:NodeShape ;
104+
# sh:name "RootDataEntity" ;
105+
# sh:targetClass ro-crate:RootDataEntity ;
106+
# sh:description "" ;
107+
108+
# sh:sparql [
109+
# a sh:SPARQLConstraint ;
110+
# sh:name "mentions" ;
111+
# sh:description "RootDataEntity SHOULD mention a check value object." ;
112+
# sh:select """
113+
# PREFIX schema: <http://schema.org/>
114+
# PREFIX shp: <https://w3id.org/shp#>
115+
# SELECT $this
116+
# WHERE {
117+
# FILTER NOT EXISTS{
118+
# $this schema:mentions ?action .
119+
# ?action schema:additionalType shp:CheckValue .
120+
# }
121+
# }
122+
# """ ;
123+
# sh:severity sh:Warning ;
124+
# sh:message "RootDataEntity SHOULD mention a check value object." ;
125+
# ] .
126+
127+
52128
five-safes-crate:CheckValueObjectShouldPointToRootDataEntity
53129
a sh:NodeShape ;
54130
sh:name "CheckValue" ;
@@ -188,3 +264,38 @@ five-safes-crate:CheckValueShouldHaveActionStatus
188264
sh:severity sh:Warning ;
189265
sh:message "CheckValue SHOULD have actionStatus property." ;
190266
] .
267+
268+
269+
#=== MAY shapes ===#
270+
271+
five-safes-crate:CheckValueMayHaveStartTime
272+
a sh:NodeShape ;
273+
sh:name "CheckValue" ;
274+
sh:description "" ;
275+
sh:target [
276+
a sh:SPARQLTarget ;
277+
sh:select """
278+
PREFIX schema: <http://schema.org/>
279+
PREFIX shp: <https://w3id.org/shp#>
280+
SELECT ?this
281+
WHERE {
282+
?this schema:additionalType shp:CheckValue ;
283+
schema:actionStatus ?status .
284+
FILTER(?status IN (
285+
"http://schema.org/CompletedActionStatus",
286+
"http://schema.org/FailedActionStatus",
287+
"http://schema.org/ActiveActionStatus"
288+
))
289+
}
290+
""" ;
291+
] ;
292+
293+
sh:property [
294+
a sh:PropertyShape ;
295+
sh:name "StartTime" ;
296+
sh:path schema:startTime ;
297+
sh:minCount 1 ;
298+
sh:maxCount 1 ;
299+
sh:severity sh:Info ;
300+
sh:message "`CheckValue` MAY have the `startTime` property." ;
301+
] .

rocrate_validator/profiles/five-safes-crate/may/12_check_phase.ttl

Lines changed: 0 additions & 56 deletions
This file was deleted.

rocrate_validator/profiles/five-safes-crate/must/12_check_phase.ttl

Lines changed: 0 additions & 93 deletions
This file was deleted.

tests/integration/profiles/five-safes-crate/test_5src_12_check_phase.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -188,31 +188,33 @@ def test_5src_check_value_has_action_status_with_not_allowed_value():
188188

189189
# ----- SHOULD fails tests
190190

191-
192-
def test_5src_root_data_entity_does_not_mention_check_value_entity():
193-
sparql = """
194-
PREFIX schema: <http://schema.org/>
195-
PREFIX shp: <https://w3id.org/shp#>
196-
197-
DELETE {
198-
<./> schema:mentions ?o .
199-
}
200-
WHERE {
201-
?o schema:additionalType shp:CheckValue ;
202-
}
203-
"""
204-
205-
do_entity_test(
206-
rocrate_path=ValidROC().five_safes_crate_result,
207-
requirement_severity=Severity.RECOMMENDED,
208-
expected_validation_result=False,
209-
expected_triggered_requirements=["RootDataEntity"],
210-
expected_triggered_issues=[
211-
"RootDataEntity SHOULD mention a check value object."
212-
],
213-
profile_identifier="five-safes-crate",
214-
rocrate_entity_mod_sparql=sparql,
215-
)
191+
# --- THIS NEEDS FURTHER CHECKS ---#
192+
193+
# def test_5src_root_data_entity_does_not_mention_check_value_entity():
194+
# sparql = """
195+
# PREFIX schema: <http://schema.org/>
196+
# PREFIX shp: <https://w3id.org/shp#>
197+
198+
# DELETE {
199+
# <./> schema:mentions ?o .
200+
# }
201+
# WHERE {
202+
# <./> schema:mentions ?o .
203+
# ?o schema:additionalType shp:CheckValue ;
204+
# }
205+
# """
206+
207+
# do_entity_test(
208+
# rocrate_path=ValidROC().five_safes_crate_result,
209+
# requirement_severity=Severity.RECOMMENDED,
210+
# expected_validation_result=False,
211+
# expected_triggered_requirements=["RootDataEntity"],
212+
# expected_triggered_issues=[
213+
# "RootDataEntity SHOULD mention a check value object."
214+
# ],
215+
# profile_identifier="five-safes-crate",
216+
# rocrate_entity_mod_sparql=sparql,
217+
# )
216218

217219

218220
def test_5src_check_value_object_does_not_point_to_root_data_entity():

0 commit comments

Comments
 (0)