Skip to content

Commit 73df452

Browse files
committed
update timestamp regex; add iri check for signoff phase instrument
1 parent 3d6e14c commit 73df452

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

rocrate_validator/profiles/five-safes-crate/may/4_sign_off.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ five-safes-crate:SignOffPhaseStartTime
5151
sh:path schema:startTime ;
5252
sh:minCount 1 ;
5353
sh:maxCount 1 ;
54-
sh:pattern "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(Z|[+-][0-9]{2}:[0-9]{2})$" ;
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})$" ;
5555
sh:severity sh:Info ;
5656
sh:description "Sign Off object MAY have a startTime property if action is active, completed or failed. This must follow ISO-8601 syntax" ;
5757
sh:message "Sign Off object MAY have a startTime property if action is active, completed or failed. This must follow ISO-8601 syntax" ;

rocrate_validator/profiles/five-safes-crate/should/4_sign_off.ttl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ five-safes-crate:SignOffPhaseProperties
9191
sh:description "Check if the Sign Off phase has an instrument (TRE Policy)" ;
9292
sh:path schema:instrument ;
9393
sh:class schema:CreativeWork ;
94+
sh:nodeKind sh:IRI;
9495
sh:minCount 1 ;
9596
sh:severity sh:Warning ;
9697
sh:message "The Sign-Off Phase SHOULD have an TRE policy (instrument) with type CreativeWork" ;
@@ -170,7 +171,7 @@ five-safes-crate:SignOffPhaseEndTime
170171
sh:path schema:endTime ;
171172
sh:minCount 1 ;
172173
sh:maxCount 1 ;
173-
sh:pattern "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(Z|[+-][0-9]{2}:[0-9]{2})$" ;
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})$" ;
174175
sh:severity sh:Warning ;
175176
sh:description "Sign Off object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;
176177
sh:message "Sign Off object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,39 @@ def test_5src_signoff_phase_no_instrument():
412412
rocrate_entity_mod_sparql=sparql,
413413
)
414414

415+
def test_5src_signoff_phase_instrument_not_iri():
416+
"""
417+
Test a Five Safes Crate where the Sign-Off phase TRE policy (instrument) is not an IRI.
418+
"""
419+
sparql = (
420+
SPARQL_PREFIXES
421+
+ """
422+
DELETE {
423+
?signoff schema:instrument ?instrument .
424+
}
425+
INSERT {
426+
?signoff schema:instrument "Not a cross-reference" .
427+
}
428+
WHERE {
429+
?signoff a schema:AssessAction ;
430+
schema:additionalType <https://w3id.org/shp#SignOff> ;
431+
schema:instrument ?instrument .
432+
}
433+
"""
434+
)
435+
436+
do_entity_test(
437+
rocrate_path=ValidROC().five_safes_crate_result,
438+
requirement_severity=Severity.RECOMMENDED,
439+
expected_validation_result=False,
440+
expected_triggered_requirements=["SignOffPhaseProperties"],
441+
expected_triggered_issues=[
442+
"The Sign-Off Phase SHOULD have an TRE policy (instrument) with type CreativeWork"
443+
],
444+
profile_identifier="five-safes-crate",
445+
rocrate_entity_mod_sparql=sparql,
446+
)
447+
415448

416449
def test_5src_signoff_phase_instrument_no_type():
417450
"""

0 commit comments

Comments
 (0)