Skip to content

Commit 166bd0f

Browse files
committed
(i) Removed minimum length requirement for name of DownloadAction. (ii) Existence of entity representing the downloaded workflow is now a MAY (before it was a SHOULD).
1 parent 69584f0 commit 166bd0f

4 files changed

Lines changed: 70 additions & 100 deletions

File tree

rocrate_validator/profiles/five-safes-crate/may/14_workflow_retrieval_phase.ttl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,42 @@
2323
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
2424

2525

26+
five-safes-crate:DownloadedWorkflowSHOULDExistAndBeReferencedByDownloadActionResult
27+
a sh:NodeShape ;
28+
sh:name "DownloadAction" ;
29+
sh:description "Validates that DownloadAction result references an existing entity" ;
30+
sh:targetClass schema:DownloadAction ;
31+
32+
sh:property [
33+
a sh:PropertyShape ;
34+
sh:name "Result" ;
35+
sh:description "The result property must reference an existing entity in the RO-Crate" ;
36+
sh:path schema:result ;
37+
sh:minCount 1 ;
38+
sh:nodeKind sh:IRI ;
39+
40+
sh:sparql [
41+
a sh:SPARQLConstraint ;
42+
sh:select """
43+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
44+
PREFIX schema: <http://schema.org/>
45+
46+
SELECT $this $value
47+
WHERE {
48+
$this schema:result $value .
49+
50+
# Entity must have BOTH type AND name (proper definition)
51+
FILTER NOT EXISTS {
52+
$value rdf:type schema:Dataset .
53+
}
54+
}
55+
""" ;
56+
sh:severity sh:Info ;
57+
sh:message "The entity represented the downloaded workflow is not properly defined in the RO-Crate and/or it is not referenced by `DownloadAction` --> `result`." ;
58+
] ;
59+
] .
60+
61+
2662
five-safes-crate:DownloadActionMayHaveStartTimeIfBegun
2763
a sh:NodeShape ;
2864
sh:name "DownloadAction" ;

rocrate_validator/profiles/five-safes-crate/must/14_workflow_retrieval_phase.ttl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,13 @@ five-safes-crate:DownloadActionObjectMUSTHavesDescriptiveName
3232
sh:property [
3333
a sh:PropertyShape ;
3434
sh:name "name" ;
35-
sh:description "DownloadAction MUST have a human readable name string of at least 10 characters." ;
35+
sh:description "DownloadAction MUST have a human readable name string." ;
3636
sh:path schema:name ;
3737
sh:minCount 1 ;
3838
sh:maxCount 1 ;
3939
sh:datatype xsd:string ;
40-
sh:minLength 10 ;
4140
sh:severity sh:Violation ;
42-
sh:message "DownloadAction MUST have a human readable name string of at least 10 characters." ;
41+
sh:message "DownloadAction MUST have a human readable name string." ;
4342
] .
4443

4544
five-safes-crate:DownloadActionStartTimeMUSTFollowISOStandard

rocrate_validator/profiles/five-safes-crate/should/14_workflow_retrieval_phase.ttl

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -108,42 +108,6 @@ five-safes-crate:DownloadActionShouldHaveEndTimeIfEnded
108108
] .
109109

110110

111-
five-safes-crate:DownloadedWorkflowSHOULDExistAndBeReferencedByDownloadActionResult
112-
a sh:NodeShape ;
113-
sh:name "DownloadAction" ;
114-
sh:description "Validates that DownloadAction result references an existing entity" ;
115-
sh:targetClass schema:DownloadAction ;
116-
117-
sh:property [
118-
a sh:PropertyShape ;
119-
sh:name "Result" ;
120-
sh:description "The result property must reference an existing entity in the RO-Crate" ;
121-
sh:path schema:result ;
122-
sh:minCount 1 ;
123-
sh:nodeKind sh:IRI ;
124-
125-
sh:sparql [
126-
a sh:SPARQLConstraint ;
127-
sh:select """
128-
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
129-
PREFIX schema: <http://schema.org/>
130-
131-
SELECT $this $value
132-
WHERE {
133-
$this schema:result $value .
134-
135-
# Entity must have BOTH type AND name (proper definition)
136-
FILTER NOT EXISTS {
137-
$value rdf:type schema:Dataset .
138-
}
139-
}
140-
""" ;
141-
sh:severity sh:Warning ;
142-
sh:message "The entity represented the downloaded workflow is not properly defined in the RO-Crate and/or it is not referenced by `DownloadAction` --> `result`." ;
143-
] ;
144-
] .
145-
146-
147111
five-safes-crate:DownloadActionShouldHaveActionStatus
148112
a sh:NodeShape ;
149113
sh:name "DownloadAction" ;

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

Lines changed: 32 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_5src_download_action_does_not_have_name():
4545
expected_validation_result=False,
4646
expected_triggered_requirements=["DownloadAction"],
4747
expected_triggered_issues=[
48-
"DownloadAction MUST have a human readable name string of at least 10 characters."
48+
"DownloadAction MUST have a human readable name string."
4949
],
5050
profile_identifier="five-safes-crate",
5151
rocrate_entity_mod_sparql=sparql,
@@ -74,36 +74,7 @@ def test_5src_download_action_name_not_a_string():
7474
expected_validation_result=False,
7575
expected_triggered_requirements=["DownloadAction"],
7676
expected_triggered_issues=[
77-
"DownloadAction MUST have a human readable name string of at least 10 characters."
78-
],
79-
profile_identifier="five-safes-crate",
80-
rocrate_entity_mod_sparql=sparql,
81-
)
82-
83-
84-
def test_5src_download_action_name_not_long_enough():
85-
sparql = (
86-
SPARQL_PREFIXES
87-
+ """
88-
DELETE {
89-
?this schema:name ?name .
90-
}
91-
INSERT {
92-
?this schema:name "Short" .
93-
}
94-
WHERE {
95-
?this rdf:type schema:DownloadAction .
96-
}
97-
"""
98-
)
99-
100-
do_entity_test(
101-
rocrate_path=ValidROC().five_safes_crate_result,
102-
requirement_severity=Severity.REQUIRED,
103-
expected_validation_result=False,
104-
expected_triggered_requirements=["DownloadAction"],
105-
expected_triggered_issues=[
106-
"DownloadAction MUST have a human readable name string of at least 10 characters."
77+
"DownloadAction MUST have a human readable name string."
10778
],
10879
profile_identifier="five-safes-crate",
10980
rocrate_entity_mod_sparql=sparql,
@@ -361,16 +332,18 @@ def test_5src_download_action_does_not_have_end_time():
361332
)
362333

363334

364-
def test_5src_downloaded_workflow_is_not_represented_by_its_own_entity():
335+
def test_5src_downloaded_workflow_is_not_referenced_by_download_action_result():
365336
sparql = (
366337
SPARQL_PREFIXES
367338
+ """
368339
DELETE {
369-
?wf ?p ?o .
340+
?s schema:result ?o .
341+
}
342+
INSERT {
343+
?s schema:result "This is not the downloaded workflow entity" .
370344
}
371345
WHERE {
372-
?wf ?p ?o .
373-
?da schema:result ?wf ;
346+
?s schema:result ?o ;
374347
rdf:type schema:DownloadAction .
375348
}
376349
"""
@@ -392,19 +365,20 @@ def test_5src_downloaded_workflow_is_not_represented_by_its_own_entity():
392365
)
393366

394367

395-
def test_5src_downloaded_workflow_is_not_referenced_by_download_action_result():
368+
def test_5src_downloaded_workflow_entity_is_not_of_type_dataset():
396369
sparql = (
397370
SPARQL_PREFIXES
398371
+ """
399372
DELETE {
400-
?s schema:result ?o .
373+
?wf rdf:type schema:Dataset .
401374
}
402375
INSERT {
403-
?s schema:result "This is not the downloaded workflow entity" .
376+
?wf rdf:type schema:Person .
404377
}
405378
WHERE {
406-
?s schema:result ?o ;
407-
rdf:type schema:DownloadAction .
379+
?wf rdf:type schema:Dataset .
380+
?da schema:result ?wf ;
381+
rdf:type schema:DownloadAction .
408382
}
409383
"""
410384
)
@@ -425,20 +399,16 @@ def test_5src_downloaded_workflow_is_not_referenced_by_download_action_result():
425399
)
426400

427401

428-
def test_5src_downloaded_workflow_entity_is_not_of_type_dataset():
402+
def test_5src_download_action_does_not_have_action_status_property():
429403
sparql = (
430404
SPARQL_PREFIXES
431405
+ """
432406
DELETE {
433-
?wf rdf:type schema:Dataset .
434-
}
435-
INSERT {
436-
?wf rdf:type schema:Person .
407+
?s schema:actionStatus ?o .
437408
}
438409
WHERE {
439-
?wf rdf:type schema:Dataset .
440-
?da schema:result ?wf ;
441-
rdf:type schema:DownloadAction .
410+
?s rdf:type schema:DownloadAction ;
411+
schema:actionStatus ?o .
442412
}
443413
"""
444414
)
@@ -449,46 +419,47 @@ def test_5src_downloaded_workflow_entity_is_not_of_type_dataset():
449419
expected_validation_result=False,
450420
expected_triggered_requirements=["DownloadAction"],
451421
expected_triggered_issues=[
452-
(
453-
"The entity represented the downloaded workflow is not properly defined in the "
454-
"RO-Crate and/or it is not referenced by `DownloadAction` --> `result`."
455-
)
422+
"`DownloadAction` SHOULD have `actionStatus` property."
456423
],
457424
profile_identifier="five-safes-crate",
458425
rocrate_entity_mod_sparql=sparql,
459426
)
460427

461428

462-
def test_5src_download_action_does_not_have_action_status_property():
429+
# ----- MAY fails tests
430+
431+
432+
def test_5src_downloaded_workflow_is_not_represented_by_its_own_entity():
463433
sparql = (
464434
SPARQL_PREFIXES
465435
+ """
466436
DELETE {
467-
?s schema:actionStatus ?o .
437+
?wf ?p ?o .
468438
}
469439
WHERE {
470-
?s rdf:type schema:DownloadAction ;
471-
schema:actionStatus ?o .
440+
?wf ?p ?o .
441+
?da schema:result ?wf ;
442+
rdf:type schema:DownloadAction .
472443
}
473444
"""
474445
)
475446

476447
do_entity_test(
477448
rocrate_path=ValidROC().five_safes_crate_result,
478-
requirement_severity=Severity.RECOMMENDED,
449+
requirement_severity=Severity.OPTIONAL,
479450
expected_validation_result=False,
480451
expected_triggered_requirements=["DownloadAction"],
481452
expected_triggered_issues=[
482-
"`DownloadAction` SHOULD have `actionStatus` property."
453+
(
454+
"The entity represented the downloaded workflow is not properly defined in the "
455+
"RO-Crate and/or it is not referenced by `DownloadAction` --> `result`."
456+
)
483457
],
484458
profile_identifier="five-safes-crate",
485459
rocrate_entity_mod_sparql=sparql,
486460
)
487461

488462

489-
# ----- MAY fails tests
490-
491-
492463
def test_5src_download_action_does_not_have_start_time():
493464
sparql = (
494465
SPARQL_PREFIXES

0 commit comments

Comments
 (0)