Skip to content

Commit eb5384a

Browse files
committed
Addressed Doug's comments on this PR.
1 parent 6635be9 commit eb5384a

3 files changed

Lines changed: 35 additions & 47 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@ five-safes-crate:CheckValueObjectHasDescriptiveNameAndIsAssessAction
5252
sh:property [
5353
sh:a sh:PropertyShape ;
5454
sh:name "name" ;
55-
sh:description "CheckValue MUST have a human readable name string of at least 20 characters." ;
55+
sh:description "CheckValue MUST have a human readable name string." ;
5656
sh:path schema:name ;
5757
sh:datatype xsd:string ;
58-
sh:minLength 20 ;
5958
sh:severity sh:Violation ;
60-
sh:message "CheckValue MUST have a human readable name string of at least 20 characters." ;
59+
sh:message "CheckValue MUST have a human readable name string." ;
6160
] .
6261

6362
five-safes-crate:CheckValueStartTimeMustFollowISOStandard

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ five-safes-crate:CheckValueObjectShouldPointToRootDataEntity
7070
sh:name "object" ;
7171
sh:path schema:object ;
7272
sh:minCount 1 ;
73-
sh:hasValue <./> ;
73+
sh:hasValue ro-crate:RootDataEntity ;
7474
sh:severity sh:Warning ;
7575
sh:message "`CheckValue` --> `object` SHOULD point to the root of the RO-Crate" ;
7676
] .

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

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
# ----- MUST fails tests
2626

27+
2728
# TO BE CHECKED AGAIN
2829
def test_5src_check_value_not_of_type_assess_action():
2930
sparql = """
@@ -65,7 +66,7 @@ def test_5src_check_value_name_not_a_string():
6566
?this schema:name ?name .
6667
}
6768
INSERT {
68-
?this schema:name 123 .
69+
?this schema:name "123"^^xsd:integer .
6970
}
7071
WHERE {
7172
?this schema:additionalType shp:CheckValue .
@@ -77,35 +78,9 @@ def test_5src_check_value_name_not_a_string():
7778
requirement_severity=Severity.REQUIRED,
7879
expected_validation_result=False,
7980
expected_triggered_requirements=["CheckValue"],
80-
expected_triggered_issues=["CheckValue MUST have a human readable name string of at least 20 characters."],
81-
profile_identifier="five-safes-crate",
82-
rocrate_entity_mod_sparql=sparql,
83-
)
84-
85-
86-
def test_5src_check_value_name_not_long_enough():
87-
sparql = """
88-
PREFIX schema: <http://schema.org/>
89-
PREFIX shp: <https://w3id.org/shp#>
90-
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
91-
92-
DELETE {
93-
?this schema:name ?name .
94-
}
95-
INSERT {
96-
?this schema:name "Short" .
97-
}
98-
WHERE {
99-
?this schema:additionalType shp:CheckValue .
100-
}
101-
"""
102-
103-
do_entity_test(
104-
rocrate_path=ValidROC().five_safes_crate_result,
105-
requirement_severity=Severity.REQUIRED,
106-
expected_validation_result=False,
107-
expected_triggered_requirements=["CheckValue"],
108-
expected_triggered_issues=["CheckValue MUST have a human readable name string of at least 20 characters."],
81+
expected_triggered_issues=[
82+
"CheckValue MUST have a human readable name string."
83+
],
10984
profile_identifier="five-safes-crate",
11085
rocrate_entity_mod_sparql=sparql,
11186
)
@@ -134,10 +109,12 @@ def test_5src_check_value_start_time_not_iso_standard():
134109
requirement_severity=Severity.REQUIRED,
135110
expected_validation_result=False,
136111
expected_triggered_requirements=["CheckValue"],
137-
expected_triggered_issues=[(
138-
"`CheckValue` --> `startTime` MUST follows the RFC 3339 standard "
139-
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
140-
)],
112+
expected_triggered_issues=[
113+
(
114+
"`CheckValue` --> `startTime` MUST follows the RFC 3339 standard "
115+
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
116+
)
117+
],
141118
profile_identifier="five-safes-crate",
142119
rocrate_entity_mod_sparql=sparql,
143120
)
@@ -166,10 +143,12 @@ def test_5src_check_value_end_time_not_iso_standard():
166143
requirement_severity=Severity.REQUIRED,
167144
expected_validation_result=False,
168145
expected_triggered_requirements=["CheckValue"],
169-
expected_triggered_issues=[(
170-
"`CheckValue` --> `endTime` MUST follows the RFC 3339 standard "
171-
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
172-
)],
146+
expected_triggered_issues=[
147+
(
148+
"`CheckValue` --> `endTime` MUST follows the RFC 3339 standard "
149+
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
150+
)
151+
],
173152
profile_identifier="five-safes-crate",
174153
rocrate_entity_mod_sparql=sparql,
175154
)
@@ -198,14 +177,17 @@ def test_5src_check_value_has_action_status_with_not_allowed_value():
198177
requirement_severity=Severity.REQUIRED,
199178
expected_validation_result=False,
200179
expected_triggered_requirements=["CheckValue"],
201-
expected_triggered_issues=["`CheckValue` --> `actionStatus` MUST have one of the allowed values."],
180+
expected_triggered_issues=[
181+
"`CheckValue` --> `actionStatus` MUST have one of the allowed values."
182+
],
202183
profile_identifier="five-safes-crate",
203184
rocrate_entity_mod_sparql=sparql,
204185
)
205186

206187

207188
# ----- SHOULD fails tests
208189

190+
209191
def test_5src_root_data_entity_does_not_mention_check_value_entity():
210192
sparql = """
211193
PREFIX schema: <http://schema.org/>
@@ -224,7 +206,9 @@ def test_5src_root_data_entity_does_not_mention_check_value_entity():
224206
requirement_severity=Severity.RECOMMENDED,
225207
expected_validation_result=False,
226208
expected_triggered_requirements=["RootDataEntity"],
227-
expected_triggered_issues=["RootDataEntity SHOULD mention a check value object."],
209+
expected_triggered_issues=[
210+
"RootDataEntity SHOULD mention a check value object."
211+
],
228212
profile_identifier="five-safes-crate",
229213
rocrate_entity_mod_sparql=sparql,
230214
)
@@ -251,7 +235,9 @@ def test_5src_check_value_object_does_not_point_to_root_data_entity():
251235
requirement_severity=Severity.RECOMMENDED,
252236
expected_validation_result=False,
253237
expected_triggered_requirements=["CheckValue"],
254-
expected_triggered_issues=["`CheckValue` --> `object` SHOULD point to the root of the RO-Crate"],
238+
expected_triggered_issues=[
239+
"`CheckValue` --> `object` SHOULD point to the root of the RO-Crate"
240+
],
255241
profile_identifier="five-safes-crate",
256242
rocrate_entity_mod_sparql=sparql,
257243
)
@@ -283,7 +269,7 @@ def test_5src_check_value_instrument_does_not_point_to_entity_with_type_defined_
283269
expected_triggered_requirements=["CheckValue"],
284270
expected_triggered_issues=[
285271
"`CheckValue` --> `instrument` SHOULD point to an entity typed `schema:DefinedTerm`"
286-
],
272+
],
287273
profile_identifier="five-safes-crate",
288274
rocrate_entity_mod_sparql=sparql,
289275
)
@@ -361,14 +347,17 @@ def test_5src_check_value_does_not_point_to_an_agent():
361347
requirement_severity=Severity.RECOMMENDED,
362348
expected_validation_result=False,
363349
expected_triggered_requirements=["CheckValue"],
364-
expected_triggered_issues=["`CheckValue` --> `agent` SHOULD reference the agent who initiated the check"],
350+
expected_triggered_issues=[
351+
"`CheckValue` --> `agent` SHOULD reference the agent who initiated the check"
352+
],
365353
profile_identifier="five-safes-crate",
366354
rocrate_entity_mod_sparql=sparql,
367355
)
368356

369357

370358
# ----- MAY fails tests
371359

360+
372361
def test_5src_check_value_does_not_have_start_time():
373362
sparql = """
374363
PREFIX schema: <http://schema.org/>

0 commit comments

Comments
 (0)