diff --git a/rocrate_validator/profiles/five-safes-crate/must/11_workflow_execution_phase.ttl b/rocrate_validator/profiles/five-safes-crate/must/11_workflow_execution_phase.ttl index a132fbe1..4551da6c 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/11_workflow_execution_phase.ttl +++ b/rocrate_validator/profiles/five-safes-crate/must/11_workflow_execution_phase.ttl @@ -29,7 +29,7 @@ five-safes-crate:WorkflowMustHaveDescriptiveName sh:targetClass schema:CreateAction ; sh:property [ - sh:a sh:PropertyShape ; + a sh:PropertyShape ; sh:name "name" ; sh:minCount 1 ; sh:description "Workflow (CreateAction) MUST have a name string of at least 10 characters." ; @@ -93,4 +93,4 @@ five-safes-crate:WorkflowMustHaveActionStatusWithAllowedValues ) ; sh:severity sh:Violation ; sh:message "WorkflowExecution MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; - ] . \ No newline at end of file + ] . diff --git a/rocrate_validator/profiles/five-safes-crate/must/16_publishing_phase.ttl b/rocrate_validator/profiles/five-safes-crate/must/16_publishing_phase.ttl new file mode 100644 index 00000000..5a591a4e --- /dev/null +++ b/rocrate_validator/profiles/five-safes-crate/must/16_publishing_phase.ttl @@ -0,0 +1,41 @@ +# Copyright (c) 2025 eScience Lab, The University of Manchester +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +@prefix ro: <./> . +@prefix ro-crate: . +@prefix five-safes-crate: . +@prefix rdf: . +@prefix schema: . +@prefix purl: . +@prefix sh: . +@prefix validator: . +@prefix xsd: . + + +five-safes-crate:AllAssessActionsMentioned + a sh:NodeShape ; + sh:name "All AssessActions are mentioned from Root Data Entity" ; + sh:description "All AssessAction entities in the crate MUST be referenced from the Root Dataset via `mentions`." ; + sh:targetClass schema:AssessAction; + + sh:property [ + a sh:PropertyShape ; + sh:name "AssessAction mentions from RDE" ; + sh:description "All AssessAction entities in the crate MUST be referenced from the Root Dataset via `mentions`." ; + sh:path [ sh:inversePath schema:mentions ] ; + sh:node ro-crate:RootDataEntity ; + sh:minCount 1 ; + sh:severity sh:Violation ; + sh:message "All AssessAction entities in the crate MUST be referenced from the Root Dataset via `mentions`." ; + ] . diff --git a/rocrate_validator/profiles/five-safes-crate/must/8_disclosure_phase.ttl b/rocrate_validator/profiles/five-safes-crate/must/8_disclosure_phase.ttl index 4e8ab6fe..e371203d 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/8_disclosure_phase.ttl +++ b/rocrate_validator/profiles/five-safes-crate/must/8_disclosure_phase.ttl @@ -42,7 +42,7 @@ five-safes-crate:DisclosureObjectHasDescriptiveNameAndIsAssessAction ] ; sh:property [ - sh:a sh:PropertyShape ; + a sh:PropertyShape ; sh:name "AssessAction" ; sh:description "DisclosureCheck MUST be a `schema:AssessAction`." ; sh:path rdf:type ; @@ -53,7 +53,7 @@ five-safes-crate:DisclosureObjectHasDescriptiveNameAndIsAssessAction ] ; sh:property [ - sh:a sh:PropertyShape ; + a sh:PropertyShape ; sh:name "name" ; sh:description "DisclosureCheck MUST have a name string of at least 20 characters." ; sh:path schema:name ; @@ -96,4 +96,4 @@ five-safes-crate:DisclosureObjectHasActionStatus ) ; sh:severity sh:Violation ; sh:message "The value of actionStatus MUST be one of the allowed values." ; - ] . \ No newline at end of file + ] . diff --git a/tests/integration/profiles/five-safes-crate/test_5src_16_publishing_phase.py b/tests/integration/profiles/five-safes-crate/test_5src_16_publishing_phase.py new file mode 100644 index 00000000..6ce5bc5c --- /dev/null +++ b/tests/integration/profiles/five-safes-crate/test_5src_16_publishing_phase.py @@ -0,0 +1,55 @@ +# Copyright (c) 2024-2025 CRS4 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging + +from rocrate_validator.models import Severity +from tests.ro_crates import ValidROC +from tests.shared import do_entity_test, SPARQL_PREFIXES + +# set up logging +logger = logging.getLogger(__name__) + + +# ----- MUST fails tests + + +def test_5src_assess_action_not_referenced_from_rde(): + sparql = ( + SPARQL_PREFIXES + + """ + DELETE { + <./> schema:mentions ?this . + } + WHERE { + ?this a schema:AssessAction . + <./> schema:mentions ?this . + } + """ + ) + + do_entity_test( + rocrate_path=ValidROC().five_safes_crate_result, + requirement_severity=Severity.REQUIRED, + expected_validation_result=False, + expected_triggered_requirements=[ + "All AssessActions are mentioned from Root Data Entity" + ], + expected_triggered_issues=[ + "All AssessAction entities in the crate MUST be referenced from " + "the Root Dataset via `mentions`." + ], + profile_identifier="five-safes-crate", + rocrate_entity_mod_sparql=sparql, + )