Skip to content

Commit b10983f

Browse files
authored
Merge pull request #52 from eScienceLab/16-publishing-phase
Single Publishing Phase check - all AssessActions should be referenced from the RDE
2 parents ad009be + 497fd52 commit b10983f

File tree

4 files changed

+101
-5
lines changed

4 files changed

+101
-5
lines changed

rocrate_validator/profiles/five-safes-crate/must/11_workflow_execution_phase.ttl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ five-safes-crate:WorkflowMustHaveDescriptiveName
2929
sh:targetClass schema:CreateAction ;
3030

3131
sh:property [
32-
sh:a sh:PropertyShape ;
32+
a sh:PropertyShape ;
3333
sh:name "name" ;
3434
sh:minCount 1 ;
3535
sh:description "Workflow (CreateAction) MUST have a name string of at least 10 characters." ;
@@ -93,4 +93,4 @@ five-safes-crate:WorkflowMustHaveActionStatusWithAllowedValues
9393
) ;
9494
sh:severity sh:Violation ;
9595
sh:message "WorkflowExecution MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ;
96-
] .
96+
] .
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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:AllAssessActionsMentioned
27+
a sh:NodeShape ;
28+
sh:name "All AssessActions are mentioned from Root Data Entity" ;
29+
sh:description "All AssessAction entities in the crate MUST be referenced from the Root Dataset via `mentions`." ;
30+
sh:targetClass schema:AssessAction;
31+
32+
sh:property [
33+
a sh:PropertyShape ;
34+
sh:name "AssessAction mentions from RDE" ;
35+
sh:description "All AssessAction entities in the crate MUST be referenced from the Root Dataset via `mentions`." ;
36+
sh:path [ sh:inversePath schema:mentions ] ;
37+
sh:node ro-crate:RootDataEntity ;
38+
sh:minCount 1 ;
39+
sh:severity sh:Violation ;
40+
sh:message "All AssessAction entities in the crate MUST be referenced from the Root Dataset via `mentions`." ;
41+
] .

rocrate_validator/profiles/five-safes-crate/must/8_disclosure_phase.ttl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ five-safes-crate:DisclosureObjectHasDescriptiveNameAndIsAssessAction
4242
] ;
4343

4444
sh:property [
45-
sh:a sh:PropertyShape ;
45+
a sh:PropertyShape ;
4646
sh:name "AssessAction" ;
4747
sh:description "DisclosureCheck MUST be a `schema:AssessAction`." ;
4848
sh:path rdf:type ;
@@ -53,7 +53,7 @@ five-safes-crate:DisclosureObjectHasDescriptiveNameAndIsAssessAction
5353
] ;
5454

5555
sh:property [
56-
sh:a sh:PropertyShape ;
56+
a sh:PropertyShape ;
5757
sh:name "name" ;
5858
sh:description "DisclosureCheck MUST have a name string of at least 20 characters." ;
5959
sh:path schema:name ;
@@ -96,4 +96,4 @@ five-safes-crate:DisclosureObjectHasActionStatus
9696
) ;
9797
sh:severity sh:Violation ;
9898
sh:message "The value of actionStatus MUST be one of the allowed values." ;
99-
] .
99+
] .
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright (c) 2024-2025 CRS4
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+
import logging
16+
17+
from rocrate_validator.models import Severity
18+
from tests.ro_crates import ValidROC
19+
from tests.shared import do_entity_test, SPARQL_PREFIXES
20+
21+
# set up logging
22+
logger = logging.getLogger(__name__)
23+
24+
25+
# ----- MUST fails tests
26+
27+
28+
def test_5src_assess_action_not_referenced_from_rde():
29+
sparql = (
30+
SPARQL_PREFIXES
31+
+ """
32+
DELETE {
33+
<./> schema:mentions ?this .
34+
}
35+
WHERE {
36+
?this a schema:AssessAction .
37+
<./> schema:mentions ?this .
38+
}
39+
"""
40+
)
41+
42+
do_entity_test(
43+
rocrate_path=ValidROC().five_safes_crate_result,
44+
requirement_severity=Severity.REQUIRED,
45+
expected_validation_result=False,
46+
expected_triggered_requirements=[
47+
"All AssessActions are mentioned from Root Data Entity"
48+
],
49+
expected_triggered_issues=[
50+
"All AssessAction entities in the crate MUST be referenced from "
51+
"the Root Dataset via `mentions`."
52+
],
53+
profile_identifier="five-safes-crate",
54+
rocrate_entity_mod_sparql=sparql,
55+
)

0 commit comments

Comments
 (0)