diff --git a/rocrate_validator/profiles/five-safes-crate/should/10_outputs.ttl b/rocrate_validator/profiles/five-safes-crate/10_outputs.ttl similarity index 95% rename from rocrate_validator/profiles/five-safes-crate/should/10_outputs.ttl rename to rocrate_validator/profiles/five-safes-crate/10_outputs.ttl index 0fae6861c..66b10b6a1 100644 --- a/rocrate_validator/profiles/five-safes-crate/should/10_outputs.ttl +++ b/rocrate_validator/profiles/five-safes-crate/10_outputs.ttl @@ -22,7 +22,13 @@ @prefix xsd: . -five-safes-crate:WorkflowRunActionHasResultIfActionCompleted +#=== MUST shapes ===# +# (none) + + +#=== SHOULD shapes ===# + +five-safes-crate:CreateActionHasResultIfActionCompleted a sh:NodeShape ; sh:name "WorkflowRunAction" ; sh:description "The `CreateAction` corresponding to the workflow run, with CompletedActionStatus, SHOULD have the `schema:result` property." ; @@ -85,3 +91,7 @@ five-safes-crate:WorkflowRunActionResultOutputsHaveAllowedTypes sh:class schema:PropertyValue; ] ) . + + +#=== MAY shapes ===# +# (none) diff --git a/rocrate_validator/profiles/five-safes-crate/11_workflow_execution_phase.ttl b/rocrate_validator/profiles/five-safes-crate/11_workflow_execution_phase.ttl new file mode 100644 index 000000000..6eab5680b --- /dev/null +++ b/rocrate_validator/profiles/five-safes-crate/11_workflow_execution_phase.ttl @@ -0,0 +1,145 @@ +# 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: . + + +#=== MUST shapes ===# + +five-safes-crate:WorkflowMustHaveDescriptiveName + a sh:NodeShape ; + sh:name "WorkflowExecution" ; + sh:targetClass ro-crate:WorkflowRunAction ; + + sh:property [ + a sh:PropertyShape ; + sh:name "name" ; + sh:minCount 1 ; + sh:description "The `CreateAction` corresponding to the workflow run MUST have a name string of at least 10 characters." ; + sh:path schema:name ; + sh:datatype xsd:string ; + sh:minLength 10 ; + sh:severity sh:Violation ; + sh:message "The `CreateAction` corresponding to the workflow run MUST have a name string of at least 10 characters." ; + ] . + + +five-safes-crate:WorkflowMustHaveActionStatusWithAllowedValues + a sh:NodeShape ; + sh:name "WorkflowExecution" ; + sh:targetClass ro-crate:WorkflowRunAction ; + sh:property [ + a sh:PropertyShape ; + sh:minCount 1 ; + sh:name "actionStatus" ; + sh:description "`CreateAction` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; + sh:path schema:actionStatus ; + sh:in ( + "http://schema.org/PotentialActionStatus" + "http://schema.org/ActiveActionStatus" + "http://schema.org/CompletedActionStatus" + "http://schema.org/FailedActionStatus" + ) ; + sh:severity sh:Violation ; + sh:message "`CreateAction` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; + ] . + + +#=== SHOULD shapes ===# + +five-safes-crate:WorkflowexecutionObjectHasEndTimeIfEnded + a sh:NodeShape ; + sh:name "WorkflowExecution" ; + sh:description "The workflow run object SHOULD have an endTime property if it has ended." ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX rocrate: + + SELECT ?this + WHERE { + ?this a rocrate:WorkflowRunAction ; + schema:actionStatus ?status . + FILTER(?status IN ( + "http://schema.org/CompletedActionStatus", + "http://schema.org/FailedActionStatus" + )) + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "EndTime" ; + sh:path schema:endTime ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:severity sh:Warning ; + sh:description "The workflow execution object SHOULD have an endTime property if it has ended." ; + sh:message "The workflow execution object SHOULD have an endTime property if it has ended." ; + ] . + + +#=== MAY shapes ===# + +five-safes-crate:WorkflowexecutionObjectHasStartTimeIfBegun + a sh:NodeShape ; + sh:name "WorkflowExecution" ; + sh:description ( + "The workflow execution object MAY have a startTime if actionStatus is " + "either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." + ) ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX rocrate: + + SELECT ?this + WHERE { + ?this a rocrate:WorkflowRunAction ; + schema:actionStatus ?status . + FILTER(?status IN ( + "http://schema.org/CompletedActionStatus", + "http://schema.org/FailedActionStatus", + "http://schema.org/ActiveActionStatus" + )) + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "StartTime" ; + sh:path schema:startTime ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:severity sh:Info ; + sh:description ( + "The workflow execution object MAY have a startTime if actionStatus is " + "either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." + ) ; + sh:message "The workflow execution object MAY have a startTime if actionStatus is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; + ] . diff --git a/rocrate_validator/profiles/five-safes-crate/should/12_check_phase.ttl b/rocrate_validator/profiles/five-safes-crate/12_check_phase.ttl similarity index 65% rename from rocrate_validator/profiles/five-safes-crate/should/12_check_phase.ttl rename to rocrate_validator/profiles/five-safes-crate/12_check_phase.ttl index faf744594..ca7ec44f1 100644 --- a/rocrate_validator/profiles/five-safes-crate/should/12_check_phase.ttl +++ b/rocrate_validator/profiles/five-safes-crate/12_check_phase.ttl @@ -23,11 +23,86 @@ @prefix xsd: . +#=== MUST shapes ===# + +five-safes-crate:CheckValueObjectHasDescriptiveNameAndIsAssessAction + a sh:NodeShape ; + sh:name "CheckValue" ; + sh:description "" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + + SELECT ?this + WHERE { + ?this schema:additionalType shp:CheckValue . + } + """ ; + ] ; + + sh:property [ + sh:path rdf:type ; + sh:minCount 1 ; + sh:hasValue schema:AssessAction; + sh:severity sh:Violation ; + sh:message "CheckValue MUST be a `AssessAction`." ; + ] ; + + sh:property [ + sh:a sh:PropertyShape ; + sh:name "name" ; + sh:description "CheckValue MUST have a human readable name string." ; + sh:path schema:name ; + sh:datatype xsd:string ; + sh:severity sh:Violation ; + sh:message "CheckValue MUST have a human readable name string." ; + ] . + +five-safes-crate:CheckValueActionStatusMustHaveAllowedValues + a sh:NodeShape ; + sh:name "CheckValue" ; + sh:description "" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + + SELECT ?this + WHERE { + ?this schema:additionalType shp:CheckValue ; + schema:actionStatus ?status . + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "ActionStatus" ; + sh:path schema:actionStatus ; + sh:in ( + "http://schema.org/PotentialActionStatus" + "http://schema.org/ActiveActionStatus" + "http://schema.org/CompletedActionStatus" + "http://schema.org/FailedActionStatus" + ) ; + sh:severity sh:Violation ; + sh:message "`CheckValue` --> `actionStatus` MUST have one of the allowed values." ; + ] . + + +#=== SHOULD shapes ===# + five-safes-crate:RootDataEntityShouldMentionCheckValueObject a sh:NodeShape ; sh:name "RootDataEntity" ; sh:targetClass ro-crate:RootDataEntity ; sh:description "" ; + sh:severity sh:Warning ; sh:sparql [ a sh:SPARQLConstraint ; @@ -44,7 +119,6 @@ five-safes-crate:RootDataEntityShouldMentionCheckValueObject } } """ ; - sh:severity sh:Warning ; sh:message "RootDataEntity SHOULD mention a check value object." ; ] . @@ -188,3 +262,38 @@ five-safes-crate:CheckValueShouldHaveActionStatus sh:severity sh:Warning ; sh:message "CheckValue SHOULD have actionStatus property." ; ] . + + +#=== MAY shapes ===# + +five-safes-crate:CheckValueMayHaveStartTime + a sh:NodeShape ; + sh:name "CheckValue" ; + sh:description "" ; + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + SELECT ?this + WHERE { + ?this schema:additionalType shp:CheckValue ; + schema:actionStatus ?status . + FILTER(?status IN ( + "http://schema.org/CompletedActionStatus", + "http://schema.org/FailedActionStatus", + "http://schema.org/ActiveActionStatus" + )) + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "StartTime" ; + sh:path schema:startTime ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:severity sh:Info ; + sh:message "`CheckValue` MAY have the `startTime` property." ; + ] . diff --git a/rocrate_validator/profiles/five-safes-crate/should/13_validation_phase.ttl b/rocrate_validator/profiles/five-safes-crate/13_validation_phase.ttl similarity index 53% rename from rocrate_validator/profiles/five-safes-crate/should/13_validation_phase.ttl rename to rocrate_validator/profiles/five-safes-crate/13_validation_phase.ttl index cb2b18137..f93ed2452 100644 --- a/rocrate_validator/profiles/five-safes-crate/should/13_validation_phase.ttl +++ b/rocrate_validator/profiles/five-safes-crate/13_validation_phase.ttl @@ -23,11 +23,119 @@ @prefix xsd: . +#=== MUST shapes ===# + +five-safes-crate:ValidationCheckObjectHasDescriptiveNameAndIsAssessAction + a sh:NodeShape ; + sh:name "ValidationCheck" ; + sh:description "" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + + SELECT ?this + WHERE { + ?this schema:additionalType shp:ValidationCheck . + } + """ ; + ] ; + + sh:property [ + sh:path rdf:type ; + sh:minCount 1 ; + sh:hasValue schema:AssessAction; + sh:severity sh:Violation ; + sh:message "ValidationCheck MUST be a `AssessAction`." ; + ] ; + + sh:property [ + sh:a sh:PropertyShape ; + sh:name "name" ; + sh:description "ValidationCheck MUST have a human readable name string." ; + sh:path schema:name ; + sh:datatype xsd:string ; + sh:severity sh:Violation ; + sh:message "ValidationCheck MUST have a human readable name string." ; + ] . + + +five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue + a sh:NodeShape ; + sh:name "ValidationCheck" ; + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + + SELECT ?this + WHERE { + ?this schema:additionalType shp:ValidationCheck ; + schema:actionStatus ?status . + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "actionStatus" ; + sh:description "The `actionStatus` of ValidationCheck MUST have an allowed value (see https://schema.org/ActionStatusType)." ; + sh:path schema:actionStatus ; + sh:in ( + "http://schema.org/PotentialActionStatus" + "http://schema.org/ActiveActionStatus" + "http://schema.org/CompletedActionStatus" + "http://schema.org/FailedActionStatus" + ) ; + sh:severity sh:Violation ; + sh:message "The `actionStatus` of ValidationCheck MUST have an allowed value (see https://schema.org/ActionStatusType)." ; + ] . + + +five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue + a sh:NodeShape ; + sh:name "ValidationCheck" ; + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + + SELECT ?this + WHERE { + ?this schema:additionalType shp:ValidationCheck . + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:minCount 1 ; + sh:name "actionStatus" ; + sh:description "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ; + sh:path schema:actionStatus ; + sh:in ( + "http://schema.org/PotentialActionStatus" + "http://schema.org/ActiveActionStatus" + "http://schema.org/CompletedActionStatus" + "http://schema.org/FailedActionStatus" + ) ; + sh:severity sh:Violation ; + sh:message "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ; + ] . + + +#=== SHOULD shapes ===# + five-safes-crate:RootDataEntityShouldMentionValidationCheckObject a sh:NodeShape ; sh:name "RootDataEntity" ; sh:targetClass ro-crate:RootDataEntity ; sh:description "" ; + sh:severity sh:Warning ; sh:sparql [ a sh:SPARQLConstraint ; @@ -44,7 +152,6 @@ five-safes-crate:RootDataEntityShouldMentionValidationCheckObject } } """ ; - sh:severity sh:Warning ; sh:message "RootDataEntity SHOULD mention a ValidationCheck object." ; ] . @@ -163,3 +270,39 @@ five-safes-crate:DownloadActionShouldHaveEndTimeIfBegun sh:description "ValidationCheck SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ; sh:message "ValidationCheck SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ; ] . + + + #=== MAY shapes ===# + + five-safes-crate:DownloadActionMayHaveStartTimeIfBegun + a sh:NodeShape ; + sh:name "ValidationCheck" ; + sh:description "" ; + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + SELECT ?this + WHERE { + ?this schema:additionalType shp:ValidationCheck ; + schema:actionStatus ?status . + FILTER(?status IN ( + "http://schema.org/CompletedActionStatus", + "http://schema.org/FailedActionStatus", + "http://schema.org/ActiveActionStatus" + )) + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "StartTime" ; + sh:path schema:startTime ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:severity sh:Info ; + sh:description "ValidationCheck MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; + sh:message "ValidationCheck MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; + ] . diff --git a/rocrate_validator/profiles/five-safes-crate/14_workflow_retrieval_phase.ttl b/rocrate_validator/profiles/five-safes-crate/14_workflow_retrieval_phase.ttl new file mode 100644 index 000000000..97e7970ef --- /dev/null +++ b/rocrate_validator/profiles/five-safes-crate/14_workflow_retrieval_phase.ttl @@ -0,0 +1,344 @@ +# 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: . + + +#=== MUST shapes ===# + +five-safes-crate:DownloadActionObjectMUSTHavesDescriptiveName + a sh:NodeShape ; + sh:name "DownloadAction" ; + sh:targetClass schema:DownloadAction ; + sh:description "" ; + + sh:property [ + a sh:PropertyShape ; + sh:name "name" ; + sh:description "DownloadAction MUST have a human readable name string." ; + sh:path schema:name ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:datatype xsd:string ; + sh:severity sh:Violation ; + sh:message "DownloadAction MUST have a human readable name string." ; + ] . + + + +five-safes-crate:WorkflowSameAsAndRootDataEntityMainEntityMUSTBeTheSame + a sh:NodeShape ; + sh:name "Downloaded Workflow" ; + sh:description "" ; + sh:severity sh:Violation ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT ?this + WHERE { + ?this rdf:type schema:Dataset . + ?s rdf:type schema:DownloadAction ; + schema:result ?this . + } + """ ; + ]; + + sh:sparql [ + a sh:SPARQLConstraint ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT $this + WHERE { + FILTER NOT EXISTS { + $this schema:sameAs ?o . + ?s schema:mainEntity ?o . + # ?o rdf:type schema:Dataset . + } + } + """ ; + + sh:description "The property `sameAs` of the entity representing the downloaded workflow MUST point to the same entity as `RootDataEntity` --> `mainEntity`." ; + sh:message "The property `sameAs` of the entity representing the downloaded workflow MUST point to the same entity as `RootDataEntity` --> `mainEntity`." ; + ] . + + +five-safes-crate:DownloadedWorkflowDistributionAndDownloadActionObjectMUSTBeTheSame + a sh:NodeShape ; + sh:name "Downloaded Workflow" ; + sh:description "" ; + sh:severity sh:Violation ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT ?this + WHERE { + ?this rdf:type schema:Dataset . + ?s rdf:type schema:DownloadAction ; + schema:result ?this . + } + """ ; + ]; + + sh:sparql [ + a sh:SPARQLConstraint ; + sh:name "" ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT $this + WHERE { + ?action rdf:type schema:DownloadAction . + FILTER NOT EXISTS { + $this schema:distribution ?url . + ?action schema:object ?url . + } + } + """ ; + sh:message "DownloadedWorkflow --> `distribution` MUST reference the same entity as `DownloadAction` --> `object`." ; + ] . + + +five-safes-crate:DownloadActionActionStatusMUSTHaveAllowedValues + a sh:NodeShape ; + sh:name "DownloadAction" ; + sh:description "" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT ?this + WHERE { + ?this rdf:type schema:DownloadAction ; + schema:actionStatus ?status . + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "ActionStatus" ; + sh:path schema:actionStatus ; + sh:in ( + "http://schema.org/PotentialActionStatus" + "http://schema.org/ActiveActionStatus" + "http://schema.org/CompletedActionStatus" + "http://schema.org/FailedActionStatus" + ) ; + sh:severity sh:Violation ; + sh:message "The value of actionStatus MUST be one of the allowed values: PotentialActionStatus; ActiveActionStatus; CompletedActionStatus; FailedActionStatus." ; + ] . + + +#=== SHOULD shapes ===# + +five-safes-crate:DownloadActionEntitySHOULDExist + a sh:NodeShape ; + sh:name "RootDataEntity" ; + sh:description "" ; + sh:targetClass ro-crate:RootDataEntity ; + sh:severity sh:Warning ; + + sh:sparql [ + a sh:SPARQLConstraint ; + sh:name "" ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT $this + WHERE { + FILTER NOT EXISTS { + ?s rdf:type schema:DownloadAction . + } + } + """ ; + sh:message "An entity typed DownloadAction SHOULD exist." ; + ] . + + + +five-safes-crate:RootDataEntitySHOULDMentionDownloadActionIfPresent + a sh:NodeShape ; + sh:name "RootDataEntity" ; + sh:description "" ; + sh:targetClass ro-crate:RootDataEntity ; + sh:severity sh:Warning ; + + sh:sparql [ + a sh:SPARQLConstraint ; + sh:name "" ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT $this ?da + WHERE { + ?da rdf:type schema:DownloadAction . + FILTER NOT EXISTS { + $this schema:mentions ?da . + } + } + """ ; + sh:message "RootDataEntity SHOULD mention DownloadAction if this exists." ; + ] . + + +five-safes-crate:DownloadActionShouldHaveEndTimeIfEnded + a sh:NodeShape ; + sh:name "DownloadAction" ; + sh:description "" ; + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT ?this + WHERE { + ?this rdf:type schema:DownloadAction ; + schema:actionStatus ?status . + FILTER(?status IN ( + "http://schema.org/CompletedActionStatus", + "http://schema.org/FailedActionStatus" + )) + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "EndTime" ; + sh:path schema:endTime ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:severity sh:Warning ; + sh:message "`DownloadAction` SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ; + ] . + + +five-safes-crate:DownloadActionShouldHaveActionStatus + a sh:NodeShape ; + sh:name "DownloadAction" ; + sh:targetClass schema:DownloadAction ; + sh:description "" ; + + sh:property [ + a sh:PropertyShape ; + sh:name "ActionStatus" ; + sh:path schema:actionStatus ; + sh:minCount 1 ; + sh:severity sh:Warning ; + sh:message "`DownloadAction` SHOULD have `actionStatus` property." ; + ] . + + +#=== MAY shapes ===# + +five-safes-crate:DownloadedWorkflowSHOULDExistAndBeReferencedByDownloadActionResult + a sh:NodeShape ; + sh:name "DownloadAction" ; + sh:description "Validates that DownloadAction result references an existing entity" ; + sh:targetClass schema:DownloadAction ; + + sh:property [ + a sh:PropertyShape ; + sh:name "Result" ; + sh:description "The result property must reference an existing entity in the RO-Crate" ; + sh:path schema:result ; + sh:minCount 1 ; + sh:nodeKind sh:IRI ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:select """ + PREFIX rdf: + PREFIX schema: + + SELECT $this $value + WHERE { + $this schema:result $value . + + # Entity must have BOTH type AND name (proper definition) + FILTER NOT EXISTS { + $value rdf:type schema:Dataset . + } + } + """ ; + ] ; + sh:severity sh:Info ; + sh:message "The entity representing the downloaded workflow is not defined, OR is not referenced by `DownloadAction` --> `result`, OR is not of type `Dataset`." ; + ] . + + +five-safes-crate:DownloadActionMayHaveStartTimeIfBegun + a sh:NodeShape ; + sh:name "DownloadAction" ; + sh:description ( + "`DownloadAction` MAY have the `startTime` property if `actionStatus` " + "is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." + ); + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX rdf: + + SELECT ?this + WHERE { + ?this rdf:type schema:DownloadAction ; + schema:actionStatus ?status . + FILTER(?status IN ( + "http://schema.org/CompletedActionStatus", + "http://schema.org/FailedActionStatus", + "http://schema.org/ActiveActionStatus" + )) + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "StartTime" ; + sh:path schema:startTime ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:description ( + "`DownloadAction` MAY have the `startTime` property if `actionStatus` " + "is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." + ); + sh:severity sh:Info ; + sh:message "`DownloadAction` MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; + ] . diff --git a/rocrate_validator/profiles/five-safes-crate/must/15_metadata_file.py b/rocrate_validator/profiles/five-safes-crate/15_metadata_file.py similarity index 100% rename from rocrate_validator/profiles/five-safes-crate/must/15_metadata_file.py rename to rocrate_validator/profiles/five-safes-crate/15_metadata_file.py diff --git a/rocrate_validator/profiles/five-safes-crate/must/15_metadata_file.ttl b/rocrate_validator/profiles/five-safes-crate/15_metadata_file.ttl similarity index 96% rename from rocrate_validator/profiles/five-safes-crate/must/15_metadata_file.ttl rename to rocrate_validator/profiles/five-safes-crate/15_metadata_file.ttl index 14d939f06..9de856f0e 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/15_metadata_file.ttl +++ b/rocrate_validator/profiles/five-safes-crate/15_metadata_file.ttl @@ -22,6 +22,10 @@ @prefix xsd: . @prefix dct: . + + +#=== MUST shapes ===# + five-safes-crate:MetadataFileDescriptorProperties a sh:NodeShape ; sh:name "RO-Crate conforms to 1.2 or later minor version" ; sh:description """The RO-Crate metadata file descriptor MUST have a `conformsTo` property with RO-Crate specification version 1.2 or later minor version"""; @@ -39,3 +43,11 @@ five-safes-crate:MetadataFileDescriptorProperties a sh:NodeShape ; ] . ro-crate:conformsToROCrateSpec sh:deactivated true . + + +#=== SHOULD shapes ===# +# (none) + + +#=== MAY shapes ===# +# (none) \ 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/16_publishing_phase.ttl similarity index 95% rename from rocrate_validator/profiles/five-safes-crate/must/16_publishing_phase.ttl rename to rocrate_validator/profiles/five-safes-crate/16_publishing_phase.ttl index 5a591a4e9..02b5b501f 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/16_publishing_phase.ttl +++ b/rocrate_validator/profiles/five-safes-crate/16_publishing_phase.ttl @@ -23,6 +23,8 @@ @prefix xsd: . +#=== MUST shapes ===# + five-safes-crate:AllAssessActionsMentioned a sh:NodeShape ; sh:name "All AssessActions are mentioned from Root Data Entity" ; @@ -39,3 +41,11 @@ five-safes-crate:AllAssessActionsMentioned sh:severity sh:Violation ; sh:message "All AssessAction entities in the crate MUST be referenced from the Root Dataset via `mentions`." ; ] . + + +#=== SHOULD shapes ===# +# (none) + + +#=== MAY shapes ===# +# (none) \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/must/1_requesting_agent.ttl b/rocrate_validator/profiles/five-safes-crate/1_requesting_agent.ttl similarity index 80% rename from rocrate_validator/profiles/five-safes-crate/must/1_requesting_agent.ttl rename to rocrate_validator/profiles/five-safes-crate/1_requesting_agent.ttl index b3b5a1382..0e70407f5 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/1_requesting_agent.ttl +++ b/rocrate_validator/profiles/five-safes-crate/1_requesting_agent.ttl @@ -22,6 +22,8 @@ @prefix xsd: . +#=== MUST shapes ===# + five-safes-crate:AgentIsMemberOf a sh:NodeShape ; sh:name "Requesting Agent" ; @@ -79,4 +81,34 @@ five-safes-crate:AgentProjectIntersection """ ; ] ; sh:severity sh:Violation ; - sh:message """At least one Project referenced by Agent -> memberOf MUST be included in the set of Projects referenced by RootDataEntity -> sourceOrganization.""" . \ No newline at end of file + sh:message """At least one Project referenced by Agent -> memberOf MUST be included in the set of Projects referenced by RootDataEntity -> sourceOrganization.""" . + + +#=== SHOULD shapes ===# + +five-safes-crate:AgentIsMemberOf + a sh:NodeShape ; + sh:name "Requesting Agent" ; + sh:target [ + a sh:SPARQLTarget ; + sh:prefixes ro-crate:sparqlPrefixes ; + sh:select """ + SELECT DISTINCT ?this WHERE { + ?action a rocrate:WorkflowRunAction ; + schema:agent ?this . + } + """ + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "memberOf" ; + sh:path schema:memberOf; + sh:minCount 1 ; + sh:severity sh:Warning ; + sh:message """The Requesting Agent SHOULD have a `memberOf` property.""" ; + ] . + + + #=== MAY shapes ===# + # (none) \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/should/1_responsible_project.ttl b/rocrate_validator/profiles/five-safes-crate/1_responsible_project.ttl similarity index 70% rename from rocrate_validator/profiles/five-safes-crate/should/1_responsible_project.ttl rename to rocrate_validator/profiles/five-safes-crate/1_responsible_project.ttl index 359f616ae..55328a1c6 100644 --- a/rocrate_validator/profiles/five-safes-crate/should/1_responsible_project.ttl +++ b/rocrate_validator/profiles/five-safes-crate/1_responsible_project.ttl @@ -22,6 +22,47 @@ @prefix xsd: . +#=== MUST shapes ===# + +five-safes-crate:ResponsibleProject + a sh:NodeShape ; + sh:name "Responsible Project" ; + sh:target [ + a sh:SPARQLTarget ; + sh:prefixes ro-crate:sparqlPrefixes ; + sh:select """ + SELECT DISTINCT ?this WHERE { + ?action a schema:CreateAction ; + schema:agent ?agent . + ?agent schema:memberOf ?this . + } + """ + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "funding" ; + sh:path schema:funding; + sh:class schema:Grant ; + sh:severity sh:Violation ; + sh:message """The property 'funding' of the Responsible Project MUST be of type Grant.""" ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "member" ; + sh:path schema:member; + sh:or ( + [ sh:class schema:Organization ] + [ sh:class schema:Person ] + ) ; + sh:severity sh:Violation ; + sh:message """The property 'member' of the Responsible Project MUST be of type schema:Organization or Person.""" ; + ] . + + +#=== SHOULD shapes ===# + five-safes-crate:ResponsibleProjectMemberAndSourceOrganizationIntersection a sh:NodeShape ; sh:name "Organizations (members of Responsible Project)" ; diff --git a/rocrate_validator/profiles/five-safes-crate/must/1_root_data_entity.ttl b/rocrate_validator/profiles/five-safes-crate/1_root_data_entity.ttl similarity index 95% rename from rocrate_validator/profiles/five-safes-crate/must/1_root_data_entity.ttl rename to rocrate_validator/profiles/five-safes-crate/1_root_data_entity.ttl index bb9a51471..fe0516b4f 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/1_root_data_entity.ttl +++ b/rocrate_validator/profiles/five-safes-crate/1_root_data_entity.ttl @@ -22,6 +22,8 @@ @prefix xsd: . +#=== MUST shapes ===# + five-safes-crate:RootDataEntityRequiredProperties a sh:NodeShape ; sh:name "RootDataEntity" ; @@ -44,3 +46,11 @@ five-safes-crate:RootDataEntityRequiredProperties sh:severity sh:Violation ; sh:message """The `sourceOrganization` property of the RootDataEntity MUST point to a Project entity.""" ; ] . + + +#=== SHOULD shapes ===# +# (none) + + +#=== MAY shapes ===# +# (none) diff --git a/rocrate_validator/profiles/five-safes-crate/must/2_requesting_agent.ttl b/rocrate_validator/profiles/five-safes-crate/2_requesting_agent.ttl similarity index 69% rename from rocrate_validator/profiles/five-safes-crate/must/2_requesting_agent.ttl rename to rocrate_validator/profiles/five-safes-crate/2_requesting_agent.ttl index 4f3a4d898..865c6da2b 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/2_requesting_agent.ttl +++ b/rocrate_validator/profiles/five-safes-crate/2_requesting_agent.ttl @@ -22,6 +22,7 @@ @prefix xsd: . +#=== MUST shapes ===# five-safes-crate:CreateActionHasAgent a sh:NodeShape ; @@ -60,4 +61,37 @@ five-safes-crate:CreateActionHasAgent sh:nodeKind sh:IRI ; sh:severity sh:Violation ; sh:message "The affiliation of a CreateAction's agent MUST be a contextual entity with type Organization." ; - ] . \ No newline at end of file + ] . + + +#=== SHOULD shapes ===# + +# Person who is the agent of a WorkflowRunAction SHOULD have an affiliation +five-safes-crate:PersonAgentHasAffiliation + a sh:NodeShape ; + sh:name "Agent of WorkflowRunAction" ; + sh:description "The agent of a WorkflowRunAction entity" ; + sh:target [ + a sh:SPARQLTarget ; + sh:prefixes ro-crate:sparqlPrefixes ; + sh:select """ + SELECT DISTINCT ?this WHERE { + ?action a ro-crate:WorkflowRunAction ; + schema:agent ?this . + } + """ + ] ; + + # The agent of the `CreateAction` corresponding to the workflowrunAction SHOULD have an affiliation + sh:property [ + a sh:PropertyShape ; + sh:name "Presence of affiliations" ; + sh:path schema:affiliation ; + sh:minCount 1 ; + sh:severity sh:Warning ; + sh:message "The agent of the `CreateAction` corresponding to the workflow run SHOULD have an affiliation" ; + ] . + + +# === MAY shapes ===# +# (none) \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/must/3_timestamp_format.ttl b/rocrate_validator/profiles/five-safes-crate/3_timestamp_format.ttl similarity index 96% rename from rocrate_validator/profiles/five-safes-crate/must/3_timestamp_format.ttl rename to rocrate_validator/profiles/five-safes-crate/3_timestamp_format.ttl index f9b8f065f..9f6122220 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/3_timestamp_format.ttl +++ b/rocrate_validator/profiles/five-safes-crate/3_timestamp_format.ttl @@ -23,6 +23,8 @@ @prefix xsd: . +#=== MUST shapes ===# + # to ensure the entity id will be included in any error message, # target all entities which have startTime and/or endTime properties using sh:targetSubjectsOf, # then we use sh:property to validate the values of those properties. @@ -52,3 +54,11 @@ five-safes-crate:TimeStampFormat sh:severity sh:Violation ; sh:message "All `startTime` and `endTime` values MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ; ] . + + +#=== SHOULD shapes ===# +# (none) + + +#=== MAY shapes ===# +# (none) \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/should/4_sign_off.ttl b/rocrate_validator/profiles/five-safes-crate/4_sign_off.ttl similarity index 65% rename from rocrate_validator/profiles/five-safes-crate/should/4_sign_off.ttl rename to rocrate_validator/profiles/five-safes-crate/4_sign_off.ttl index 3da4dfa7b..52abfa619 100644 --- a/rocrate_validator/profiles/five-safes-crate/should/4_sign_off.ttl +++ b/rocrate_validator/profiles/five-safes-crate/4_sign_off.ttl @@ -17,12 +17,83 @@ @prefix five-safes-crate: . @prefix rdf: . @prefix schema: . +@prefix purl: . @prefix sh: . @prefix validator: . @prefix xsd: . -@prefix shp: . +#=== MUST shapes ===# + +five-safes-crate:SignOffObjectActionAndName + a sh:NodeShape ; + sh:name "SignOff" ; + sh:description "Sign Off phase" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + SELECT ?this + WHERE { + ?this schema:additionalType shp:SignOff . + } + """ ; + ] ; + + sh:property [ + sh:path schema:name ; + sh:datatype xsd:string ; + sh:minCount 1 ; + sh:severity sh:Violation ; + sh:message "Sign Off phase MUST have a human-readable name string." ; + ] ; + + sh:property [ + sh:path rdf:type ; + sh:minCount 1 ; + sh:hasValue schema:AssessAction; + sh:severity sh:Violation ; + sh:message "Sign Off phase MUST be a `AssessAction`." ; + ] . + +five-safes-crate:SignOffObjectHasActionStatus + a sh:NodeShape ; + sh:name "SignOffStatus" ; + sh:description "Sign Off Phase Action Status" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + SELECT ?this + WHERE { + ?this schema:additionalType shp:SignOff ; + schema:actionStatus ?status . + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "actionStatus" ; + sh:description "The value of actionStatus MUST be one of the allowed values." ; + sh:path schema:actionStatus ; + sh:in ( + "http://schema.org/PotentialActionStatus" + "http://schema.org/ActiveActionStatus" + "http://schema.org/CompletedActionStatus" + "http://schema.org/FailedActionStatus" + ) ; + sh:severity sh:Violation ; + sh:message "The value of actionStatus MUST be one of the allowed values: PotentialActionStatus; ActiveActionStatus; CompletedActionStatus; FailedActionStatus." ; + ] . + + +#=== SHOULD shapes ===# + # There SHOULD be a Sign-Off Phase five-safes-crate:SignOffPhase a sh:NodeShape ; @@ -185,3 +256,40 @@ five-safes-crate:SignOffPhaseEndTime sh:description "Sign Off object SHOULD have endTime property if action completed or failed." ; sh:message "Sign Off object SHOULD have endTime property if action completed or failed." ; ] . + + +#=== MAY shapes ===# + +five-safes-crate:SignOffPhaseStartTime + a sh:NodeShape ; + sh:name "SignOffPhaseStartTime" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + SELECT ?this + WHERE { + ?this schema:additionalType shp:SignOff ; + schema:actionStatus ?status . + FILTER(?status IN ( + "http://schema.org/ActiveActionStatus", + "http://schema.org/CompletedActionStatus", + "http://schema.org/FailedActionStatus" + )) + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "StartTime" ; + sh:path schema:startTime ; + sh:minCount 1 ; + sh:maxCount 1 ; + 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})$" ; + sh:severity sh:Info ; + sh:description "Sign Off object MAY have a startTime property if action is active, completed or failed." ; + sh:message "Sign Off object MAY have a startTime property if action is active, completed or failed." ; + ] . diff --git a/rocrate_validator/profiles/five-safes-crate/should/5_profile_conformance.ttl b/rocrate_validator/profiles/five-safes-crate/5_profile_conformance.ttl similarity index 97% rename from rocrate_validator/profiles/five-safes-crate/should/5_profile_conformance.ttl rename to rocrate_validator/profiles/five-safes-crate/5_profile_conformance.ttl index 8c76c3cea..e9428e60c 100644 --- a/rocrate_validator/profiles/five-safes-crate/should/5_profile_conformance.ttl +++ b/rocrate_validator/profiles/five-safes-crate/5_profile_conformance.ttl @@ -24,6 +24,12 @@ @prefix shp: . +#=== MUST shapes ===# +# (none) + + +#=== SHOULD shapes ===# + # Root Dataset SHOULD declare conformsTo Five Safes profile five-safes-crate:RootDatasetConformsToFiveSafes a sh:NodeShape ; @@ -77,3 +83,7 @@ five-safes-crate:RootDatasetLicenseWhenPublished sh:minCount 1 ; ]] ) . + + +#=== MAY shapes ===# +# (none) \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/must/6_workflow_reference.ttl b/rocrate_validator/profiles/five-safes-crate/6_workflow_reference.ttl similarity index 72% rename from rocrate_validator/profiles/five-safes-crate/must/6_workflow_reference.ttl rename to rocrate_validator/profiles/five-safes-crate/6_workflow_reference.ttl index 68d842653..250b67da8 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/6_workflow_reference.ttl +++ b/rocrate_validator/profiles/five-safes-crate/6_workflow_reference.ttl @@ -23,6 +23,7 @@ @prefix xsd: . +#=== MUST shapes ===# five-safes-crate:ReferenceToWorkflowCrate a sh:NodeShape ; @@ -74,3 +75,35 @@ five-safes-crate:mainEntityHasProperConformsTo sh:severity sh:Violation ; sh:message "conformsTo IRI must start with https://w3id.org/workflowhub/workflow-ro-crate" ; ] . + + +#=== SHOULD shapes ===# + +five-safes-crate:DatasetMustHaveDistributionIfURI + a sh:NodeShape ; + sh:name "mainEntity" ; + sh:targetObjectsOf schema:mainEntity ; + sh:description "If mainEntity has an HTTP(S) @id, it SHOULD have a distribution that is an HTTP(S) URL." ; + sh:severity sh:Warning ; + + sh:sparql [ + a sh:SPARQLConstraint ; + sh:name "distribution" ; + sh:description "If mainEntity has an HTTP(S) @id, it SHOULD have a distribution that is an HTTP(S) URL." ; + sh:prefixes ro-crate:sparqlPrefixes ; + sh:select """ + SELECT $this + WHERE { + FILTER (STRSTARTS(STR($this), "http://") || STRSTARTS(STR($this), "https://")) . + FILTER NOT EXISTS { + $this schema:distribution ?dist . + FILTER (STRSTARTS(STR(?dist), "http://") || STRSTARTS(STR(?dist), "https://")) . + } + } + """ ; + sh:message "If mainEntity has an HTTP(S) @id SHOULD have at least one distribution with an HTTP(S) URL." ; + ] . + + +#=== MAY shapes ===# +# (none) \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/must/7_requested_workflow_run.ttl b/rocrate_validator/profiles/five-safes-crate/7_requested_workflow_run.ttl similarity index 83% rename from rocrate_validator/profiles/five-safes-crate/must/7_requested_workflow_run.ttl rename to rocrate_validator/profiles/five-safes-crate/7_requested_workflow_run.ttl index 7a8b9ad35..d74acf430 100644 --- a/rocrate_validator/profiles/five-safes-crate/must/7_requested_workflow_run.ttl +++ b/rocrate_validator/profiles/five-safes-crate/7_requested_workflow_run.ttl @@ -22,6 +22,8 @@ @prefix xsd: . +#=== MUST shapes ===# + five-safes-crate:RootDataEntityMentionsWorkflowRunAction a sh:NodeShape ; sh:name "RootDataEntity" ; @@ -46,6 +48,7 @@ five-safes-crate:WorkflowRunActionExistence sh:name "RootDataEntity" ; sh:targetClass ro-crate:RootDataEntity ; sh:description "" ; + sh:severity sh:Violation ; sh:sparql [ a sh:SPARQLConstraint ; @@ -83,3 +86,23 @@ five-safes-crate:WorkflowRunObject """ ; sh:message "In the `CreateAction` entity corresponding to the workflow run, each `object` MUST reference an existing entity." ; ] . + + +#=== SHOULD shapes ===# + +# WorkflowRunAction SHOULD have object property with minimum cardinality 1 +five-safes-crate:WorkflowRunActionShouldHaveObjectProperty + a sh:NodeShape ; + sh:targetClass ro-crate:WorkflowRunAction ; + sh:name "WorkflowRunAction" ; + sh:property [ + sh:path schema:object ; + sh:minCount 1 ; + sh:nodeKind sh:IRI ; + sh:severity sh:Warning ; + sh:message "`CreateAction` (corresponding to the workflow run) SHOULD have the property `object` with IRI values." ; + ] . + + +#=== MAY shapes ===# +# (none) diff --git a/rocrate_validator/profiles/five-safes-crate/should/8_disclosure_phase.ttl b/rocrate_validator/profiles/five-safes-crate/8_disclosure_phase.ttl similarity index 50% rename from rocrate_validator/profiles/five-safes-crate/should/8_disclosure_phase.ttl rename to rocrate_validator/profiles/five-safes-crate/8_disclosure_phase.ttl index 1d4662512..30de9c265 100644 --- a/rocrate_validator/profiles/five-safes-crate/should/8_disclosure_phase.ttl +++ b/rocrate_validator/profiles/five-safes-crate/8_disclosure_phase.ttl @@ -23,11 +23,93 @@ @prefix xsd: . +#=== MUST shapes ===# + +five-safes-crate:DisclosureObjectHasDescriptiveNameAndIsAssessAction + a sh:NodeShape ; + sh:name "DisclosureCheck" ; + sh:description "DisclosureCheck" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + + SELECT ?this + WHERE { + ?this schema:additionalType shp:DisclosureCheck . + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "AssessAction" ; + sh:description "`DisclosureCheck` MUST be a `AssessAction`." ; + sh:path rdf:type ; + sh:minCount 1 ; + sh:hasValue schema:AssessAction; + sh:severity sh:Violation ; + sh:message "`DisclosureCheck` MUST be a `AssessAction`." ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "name" ; + sh:description "`DisclosureCheck` MUST have a name string of at least 10 characters." ; + sh:minCount 1 ; + sh:path schema:name ; + sh:datatype xsd:string ; + sh:minLength 10 ; + sh:severity sh:Violation ; + sh:message "`DisclosureCheck` MUST have a name string of at least 10 characters." ; + ] . + + +five-safes-crate:DisclosureObjectHasActionStatusWithAcceptedValue + a sh:NodeShape ; + sh:name "DisclosureCheck" ; + sh:description "`DisclosureCheck` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + + SELECT ?this + WHERE { + ?this schema:additionalType shp:DisclosureCheck ; + schema:actionStatus ?status . + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "actionStatus" ; + sh:description "`DisclosureCheck` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; + sh:path schema:actionStatus ; + sh:in ( + "http://schema.org/PotentialActionStatus" + "http://schema.org/ActiveActionStatus" + "http://schema.org/CompletedActionStatus" + "http://schema.org/FailedActionStatus" + ) ; + sh:severity sh:Violation ; + sh:message "`DisclosureCheck` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; + ] . + + +#=== SHOULD shapes ===# + five-safes-crate:RootDataEntityShouldMentionDisclosureObject a sh:NodeShape ; sh:name "RootDataEntity" ; sh:targetClass ro-crate:RootDataEntity ; sh:description "RootDataEntity SHOULD mention a disclosure object." ; + sh:severity sh:Warning ; sh:sparql [ a sh:SPARQLConstraint ; @@ -45,7 +127,6 @@ five-safes-crate:RootDataEntityShouldMentionDisclosureObject } } """ ; - sh:severity sh:Warning ; sh:message "`RootDataEntity` SHOULD mention a disclosure object." ; ] . @@ -111,4 +192,42 @@ five-safes-crate:DisclosureObjectHasEndTimeIfcompletedOrFailed sh:severity sh:Warning ; sh:description "`DisclosureCheck` SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ; sh:message "`DisclosureCheck` SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ; + ] . + + +#=== MAY shapes ===# + +five-safes-crate:DisclosureObjectHasStartTimeIfBegun + a sh:NodeShape ; + sh:name "DisclosureCheck" ; + sh:description "DisclosureCheck" ; + + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + PREFIX schema: + PREFIX shp: + + SELECT ?this + WHERE { + ?this schema:additionalType shp:DisclosureCheck ; + schema:actionStatus ?status . + FILTER(?status IN ( + "http://schema.org/CompletedActionStatus", + "http://schema.org/FailedActionStatus", + "http://schema.org/ActiveActionStatus" + )) + } + """ ; + ] ; + + sh:property [ + a sh:PropertyShape ; + sh:name "StartTime" ; + sh:path schema:startTime ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:severity sh:Info ; + sh:description "`DisclosureCheck` MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; + sh:message "`DisclosureCheck` MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; ] . \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/should/9_inputs.ttl b/rocrate_validator/profiles/five-safes-crate/9_inputs.ttl similarity index 94% rename from rocrate_validator/profiles/five-safes-crate/should/9_inputs.ttl rename to rocrate_validator/profiles/five-safes-crate/9_inputs.ttl index 20cb1b0bd..0a476d4a2 100644 --- a/rocrate_validator/profiles/five-safes-crate/should/9_inputs.ttl +++ b/rocrate_validator/profiles/five-safes-crate/9_inputs.ttl @@ -24,10 +24,17 @@ @prefix xsd: . +#=== MUST shapes ===# +# (none) + + +#=== SHOULD shapes ===# + five-safes-crate:InputEntityReferencesFormalParameterViaExampleOfWork a sh:NodeShape ; sh:name "Input" ; sh:description "" ; + sh:severity sh:Warning ; sh:target [ a sh:SPARQLTarget ; sh:prefixes ro-crate:sparqlPrefixes ; @@ -52,6 +59,9 @@ five-safes-crate:InputEntityReferencesFormalParameterViaExampleOfWork } } """ ; - sh:severity sh:Warning ; sh:message "Input SHOULD reference a FormalParameter using exampleOfWork" ; ] . + + +#=== MAY shapes ===# +# (none) diff --git a/rocrate_validator/profiles/five-safes-crate/may/11_workflow_execution_phase.ttl b/rocrate_validator/profiles/five-safes-crate/may/11_workflow_execution_phase.ttl deleted file mode 100644 index 1b777c835..000000000 --- a/rocrate_validator/profiles/five-safes-crate/may/11_workflow_execution_phase.ttl +++ /dev/null @@ -1,64 +0,0 @@ -# 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 sh: . -@prefix validator: . -@prefix xsd: . - - -five-safes-crate:WorkflowexecutionObjectHasStartTimeIfBegun - a sh:NodeShape ; - sh:name "WorkflowExecution" ; - sh:description ( - "The workflow execution object MAY have a startTime if actionStatus is " - "either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." - ) ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX rocrate: - - SELECT ?this - WHERE { - ?this a rocrate:WorkflowRunAction ; - schema:actionStatus ?status . - FILTER(?status IN ( - "http://schema.org/CompletedActionStatus", - "http://schema.org/FailedActionStatus", - "http://schema.org/ActiveActionStatus" - )) - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "StartTime" ; - sh:path schema:startTime ; - sh:minCount 1 ; - sh:maxCount 1 ; - sh:severity sh:Info ; - sh:description ( - "The workflow execution object MAY have a startTime if actionStatus is " - "either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." - ) ; - sh:message "The workflow execution object MAY have a startTime if actionStatus is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/may/12_check_phase.ttl b/rocrate_validator/profiles/five-safes-crate/may/12_check_phase.ttl deleted file mode 100644 index 0e741f6ca..000000000 --- a/rocrate_validator/profiles/five-safes-crate/may/12_check_phase.ttl +++ /dev/null @@ -1,56 +0,0 @@ -# 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:CheckValueMayHaveStartTime - a sh:NodeShape ; - sh:name "CheckValue" ; - sh:description "" ; - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - SELECT ?this - WHERE { - ?this schema:additionalType shp:CheckValue ; - schema:actionStatus ?status . - FILTER(?status IN ( - "http://schema.org/CompletedActionStatus", - "http://schema.org/FailedActionStatus", - "http://schema.org/ActiveActionStatus" - )) - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "StartTime" ; - sh:path schema:startTime ; - sh:minCount 1 ; - sh:maxCount 1 ; - sh:severity sh:Info ; - sh:message "`CheckValue` MAY have the `startTime` property." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/may/13_validation_phase.ttl b/rocrate_validator/profiles/five-safes-crate/may/13_validation_phase.ttl deleted file mode 100644 index b7adcb3bc..000000000 --- a/rocrate_validator/profiles/five-safes-crate/may/13_validation_phase.ttl +++ /dev/null @@ -1,57 +0,0 @@ -# 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:DownloadActionMayHaveStartTimeIfBegun - a sh:NodeShape ; - sh:name "ValidationCheck" ; - sh:description "" ; - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - SELECT ?this - WHERE { - ?this schema:additionalType shp:ValidationCheck ; - schema:actionStatus ?status . - FILTER(?status IN ( - "http://schema.org/CompletedActionStatus", - "http://schema.org/FailedActionStatus", - "http://schema.org/ActiveActionStatus" - )) - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "StartTime" ; - sh:path schema:startTime ; - sh:minCount 1 ; - sh:maxCount 1 ; - sh:severity sh:Info ; - sh:description "ValidationCheck MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; - sh:message "ValidationCheck MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/may/14_workflow_retrieval_phase.ttl b/rocrate_validator/profiles/five-safes-crate/may/14_workflow_retrieval_phase.ttl deleted file mode 100644 index 2a3c44d1c..000000000 --- a/rocrate_validator/profiles/five-safes-crate/may/14_workflow_retrieval_phase.ttl +++ /dev/null @@ -1,101 +0,0 @@ -# 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:DownloadedWorkflowSHOULDExistAndBeReferencedByDownloadActionResult - a sh:NodeShape ; - sh:name "DownloadAction" ; - sh:description "Validates that DownloadAction result references an existing entity" ; - sh:targetClass schema:DownloadAction ; - - sh:property [ - a sh:PropertyShape ; - sh:name "Result" ; - sh:description "The result property must reference an existing entity in the RO-Crate" ; - sh:path schema:result ; - sh:minCount 1 ; - sh:nodeKind sh:IRI ; - sh:sparql [ - a sh:SPARQLConstraint ; - sh:select """ - PREFIX rdf: - PREFIX schema: - - SELECT $this $value - WHERE { - $this schema:result $value . - - # Entity must have BOTH type AND name (proper definition) - FILTER NOT EXISTS { - $value rdf:type schema:Dataset . - } - } - """ ; - ] ; - sh:severity sh:Info ; - sh:message "The entity representing the downloaded workflow is not defined, OR is not referenced by `DownloadAction` --> `result`, OR is not of type `Dataset`." ; - ] . - - -five-safes-crate:DownloadActionMayHaveStartTimeIfBegun - a sh:NodeShape ; - sh:name "DownloadAction" ; - sh:description ( - "`DownloadAction` MAY have the `startTime` property if `actionStatus` " - "is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." - ); - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT ?this - WHERE { - ?this rdf:type schema:DownloadAction ; - schema:actionStatus ?status . - FILTER(?status IN ( - "http://schema.org/CompletedActionStatus", - "http://schema.org/FailedActionStatus", - "http://schema.org/ActiveActionStatus" - )) - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "StartTime" ; - sh:path schema:startTime ; - sh:minCount 1 ; - sh:maxCount 1 ; - sh:description ( - "`DownloadAction` MAY have the `startTime` property if `actionStatus` " - "is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." - ); - sh:severity sh:Info ; - sh:message "`DownloadAction` MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/may/4_sign_off.ttl b/rocrate_validator/profiles/five-safes-crate/may/4_sign_off.ttl deleted file mode 100644 index 3890e2b31..000000000 --- a/rocrate_validator/profiles/five-safes-crate/may/4_sign_off.ttl +++ /dev/null @@ -1,58 +0,0 @@ -# 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 sh: . -@prefix validator: . -@prefix xsd: . -@prefix shp: . - - -five-safes-crate:SignOffPhaseStartTime - a sh:NodeShape ; - sh:name "SignOffPhaseStartTime" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - SELECT ?this - WHERE { - ?this schema:additionalType shp:SignOff ; - schema:actionStatus ?status . - FILTER(?status IN ( - "http://schema.org/ActiveActionStatus", - "http://schema.org/CompletedActionStatus", - "http://schema.org/FailedActionStatus" - )) - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "StartTime" ; - sh:path schema:startTime ; - sh:minCount 1 ; - sh:maxCount 1 ; - 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})$" ; - sh:severity sh:Info ; - sh:description "Sign Off object MAY have a startTime property if action is active, completed or failed." ; - sh:message "Sign Off object MAY have a startTime property if action is active, completed or failed." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/may/8_disclosure_phase.ttl b/rocrate_validator/profiles/five-safes-crate/may/8_disclosure_phase.ttl deleted file mode 100644 index 46943191d..000000000 --- a/rocrate_validator/profiles/five-safes-crate/may/8_disclosure_phase.ttl +++ /dev/null @@ -1,58 +0,0 @@ -# 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 sh: . -@prefix validator: . -@prefix xsd: . - - -five-safes-crate:DisclosureObjectHasStartTimeIfBegun - a sh:NodeShape ; - sh:name "DisclosureCheck" ; - sh:description "DisclosureCheck" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - - SELECT ?this - WHERE { - ?this schema:additionalType shp:DisclosureCheck ; - schema:actionStatus ?status . - FILTER(?status IN ( - "http://schema.org/CompletedActionStatus", - "http://schema.org/FailedActionStatus", - "http://schema.org/ActiveActionStatus" - )) - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "StartTime" ; - sh:path schema:startTime ; - sh:minCount 1 ; - sh:maxCount 1 ; - sh:severity sh:Info ; - sh:description "`DisclosureCheck` MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; - sh:message "`DisclosureCheck` MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; - ] . \ No newline at end of file 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 deleted file mode 100644 index f1c33bdff..000000000 --- a/rocrate_validator/profiles/five-safes-crate/must/11_workflow_execution_phase.ttl +++ /dev/null @@ -1,62 +0,0 @@ -# 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:WorkflowMustHaveDescriptiveName - a sh:NodeShape ; - sh:name "WorkflowExecution" ; - sh:targetClass ro-crate:WorkflowRunAction ; - - sh:property [ - a sh:PropertyShape ; - sh:name "name" ; - sh:minCount 1 ; - sh:description "The `CreateAction` corresponding to the workflow run MUST have a name string of at least 10 characters." ; - sh:path schema:name ; - sh:datatype xsd:string ; - sh:minLength 10 ; - sh:severity sh:Violation ; - sh:message "The `CreateAction` corresponding to the workflow run MUST have a name string of at least 10 characters." ; - ] . - - -five-safes-crate:WorkflowMustHaveActionStatusWithAllowedValues - a sh:NodeShape ; - sh:name "WorkflowExecution" ; - sh:targetClass ro-crate:WorkflowRunAction ; - sh:property [ - a sh:PropertyShape ; - sh:minCount 1 ; - sh:name "actionStatus" ; - sh:description "`CreateAction` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; - sh:path schema:actionStatus ; - sh:in ( - "http://schema.org/PotentialActionStatus" - "http://schema.org/ActiveActionStatus" - "http://schema.org/CompletedActionStatus" - "http://schema.org/FailedActionStatus" - ) ; - sh:severity sh:Violation ; - sh:message "`CreateAction` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/must/12_check_phase.ttl b/rocrate_validator/profiles/five-safes-crate/must/12_check_phase.ttl deleted file mode 100644 index caecb1651..000000000 --- a/rocrate_validator/profiles/five-safes-crate/must/12_check_phase.ttl +++ /dev/null @@ -1,93 +0,0 @@ -# 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:CheckValueObjectHasDescriptiveNameAndIsAssessAction - a sh:NodeShape ; - sh:name "CheckValue" ; - sh:description "" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - - SELECT ?this - WHERE { - ?this schema:additionalType shp:CheckValue . - } - """ ; - ] ; - - sh:property [ - sh:path rdf:type ; - sh:minCount 1 ; - sh:hasValue schema:AssessAction; - sh:severity sh:Violation ; - sh:message "CheckValue MUST be a `AssessAction`." ; - ] ; - - sh:property [ - sh:a sh:PropertyShape ; - sh:name "name" ; - sh:description "CheckValue MUST have a human readable name string." ; - sh:path schema:name ; - sh:datatype xsd:string ; - sh:severity sh:Violation ; - sh:message "CheckValue MUST have a human readable name string." ; - ] . - -five-safes-crate:CheckValueActionStatusMustHaveAllowedValues - a sh:NodeShape ; - sh:name "CheckValue" ; - sh:description "" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - - SELECT ?this - WHERE { - ?this schema:additionalType shp:CheckValue ; - schema:actionStatus ?status . - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "ActionStatus" ; - sh:path schema:actionStatus ; - sh:in ( - "http://schema.org/PotentialActionStatus" - "http://schema.org/ActiveActionStatus" - "http://schema.org/CompletedActionStatus" - "http://schema.org/FailedActionStatus" - ) ; - sh:severity sh:Violation ; - sh:message "`CheckValue` --> `actionStatus` MUST have one of the allowed values." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/must/13_validation_phase.ttl b/rocrate_validator/profiles/five-safes-crate/must/13_validation_phase.ttl deleted file mode 100644 index 735ba27b8..000000000 --- a/rocrate_validator/profiles/five-safes-crate/must/13_validation_phase.ttl +++ /dev/null @@ -1,126 +0,0 @@ -# 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:ValidationCheckObjectHasDescriptiveNameAndIsAssessAction - a sh:NodeShape ; - sh:name "ValidationCheck" ; - sh:description "" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - - SELECT ?this - WHERE { - ?this schema:additionalType shp:ValidationCheck . - } - """ ; - ] ; - - sh:property [ - sh:path rdf:type ; - sh:minCount 1 ; - sh:hasValue schema:AssessAction; - sh:severity sh:Violation ; - sh:message "ValidationCheck MUST be a `AssessAction`." ; - ] ; - - sh:property [ - sh:a sh:PropertyShape ; - sh:name "name" ; - sh:description "ValidationCheck MUST have a human readable name string." ; - sh:path schema:name ; - sh:datatype xsd:string ; - sh:severity sh:Violation ; - sh:message "ValidationCheck MUST have a human readable name string." ; - ] . - - -five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue - a sh:NodeShape ; - sh:name "ValidationCheck" ; - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - - SELECT ?this - WHERE { - ?this schema:additionalType shp:ValidationCheck ; - schema:actionStatus ?status . - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "actionStatus" ; - sh:description "The `actionStatus` of ValidationCheck MUST have an allowed value (see https://schema.org/ActionStatusType)." ; - sh:path schema:actionStatus ; - sh:in ( - "http://schema.org/PotentialActionStatus" - "http://schema.org/ActiveActionStatus" - "http://schema.org/CompletedActionStatus" - "http://schema.org/FailedActionStatus" - ) ; - sh:severity sh:Violation ; - sh:message "The `actionStatus` of ValidationCheck MUST have an allowed value (see https://schema.org/ActionStatusType)." ; - ] . - - -five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue - a sh:NodeShape ; - sh:name "ValidationCheck" ; - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - - SELECT ?this - WHERE { - ?this schema:additionalType shp:ValidationCheck . - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:minCount 1 ; - sh:name "actionStatus" ; - sh:description "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ; - sh:path schema:actionStatus ; - sh:in ( - "http://schema.org/PotentialActionStatus" - "http://schema.org/ActiveActionStatus" - "http://schema.org/CompletedActionStatus" - "http://schema.org/FailedActionStatus" - ) ; - sh:severity sh:Violation ; - sh:message "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/must/14_workflow_retrieval_phase.ttl b/rocrate_validator/profiles/five-safes-crate/must/14_workflow_retrieval_phase.ttl deleted file mode 100644 index 6fe8c2a39..000000000 --- a/rocrate_validator/profiles/five-safes-crate/must/14_workflow_retrieval_phase.ttl +++ /dev/null @@ -1,160 +0,0 @@ -# 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:DownloadActionObjectMUSTHavesDescriptiveName - a sh:NodeShape ; - sh:name "DownloadAction" ; - sh:targetClass schema:DownloadAction ; - sh:description "" ; - - sh:property [ - a sh:PropertyShape ; - sh:name "name" ; - sh:description "DownloadAction MUST have a human readable name string." ; - sh:path schema:name ; - sh:minCount 1 ; - sh:maxCount 1 ; - sh:datatype xsd:string ; - sh:severity sh:Violation ; - sh:message "DownloadAction MUST have a human readable name string." ; - ] . - - - -five-safes-crate:WorkflowSameAsAndRootDataEntityMainEntityMUSTBeTheSame - a sh:NodeShape ; - sh:name "Downloaded Workflow" ; - sh:description "" ; - sh:severity sh:Violation ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT ?this - WHERE { - ?this rdf:type schema:Dataset . - ?s rdf:type schema:DownloadAction ; - schema:result ?this . - } - """ ; - ]; - - sh:sparql [ - a sh:SPARQLConstraint ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT $this - WHERE { - FILTER NOT EXISTS { - $this schema:sameAs ?o . - ?s schema:mainEntity ?o . - # ?o rdf:type schema:Dataset . - } - } - """ ; - - sh:description "The property `sameAs` of the entity representing the downloaded workflow MUST point to the same entity as `RootDataEntity` --> `mainEntity`." ; - sh:message "The property `sameAs` of the entity representing the downloaded workflow MUST point to the same entity as `RootDataEntity` --> `mainEntity`." ; - ] . - - -five-safes-crate:DownloadedWorkflowDistributionAndDownloadActionObjectMUSTBeTheSame - a sh:NodeShape ; - sh:name "Downloaded Workflow" ; - sh:description "" ; - sh:severity sh:Violation ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT ?this - WHERE { - ?this rdf:type schema:Dataset . - ?s rdf:type schema:DownloadAction ; - schema:result ?this . - } - """ ; - ]; - - sh:sparql [ - a sh:SPARQLConstraint ; - sh:name "" ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT $this - WHERE { - ?action rdf:type schema:DownloadAction . - FILTER NOT EXISTS { - $this schema:distribution ?url . - ?action schema:object ?url . - } - } - """ ; - sh:message "DownloadedWorkflow --> `distribution` MUST reference the same entity as `DownloadAction` --> `object`." ; - ] . - - -five-safes-crate:DownloadActionActionStatusMUSTHaveAllowedValues - a sh:NodeShape ; - sh:name "DownloadAction" ; - sh:description "" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT ?this - WHERE { - ?this rdf:type schema:DownloadAction ; - schema:actionStatus ?status . - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "ActionStatus" ; - sh:path schema:actionStatus ; - sh:in ( - "http://schema.org/PotentialActionStatus" - "http://schema.org/ActiveActionStatus" - "http://schema.org/CompletedActionStatus" - "http://schema.org/FailedActionStatus" - ) ; - sh:severity sh:Violation ; - sh:message "The value of actionStatus MUST be one of the allowed values: PotentialActionStatus; ActiveActionStatus; CompletedActionStatus; FailedActionStatus." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/must/1_responsible_project.ttl b/rocrate_validator/profiles/five-safes-crate/must/1_responsible_project.ttl deleted file mode 100644 index 4748655ea..000000000 --- a/rocrate_validator/profiles/five-safes-crate/must/1_responsible_project.ttl +++ /dev/null @@ -1,59 +0,0 @@ -# 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 sh: . -@prefix validator: . -@prefix xsd: . - - -five-safes-crate:ResponsibleProject - a sh:NodeShape ; - sh:name "Responsible Project" ; - sh:target [ - a sh:SPARQLTarget ; - sh:prefixes ro-crate:sparqlPrefixes ; - sh:select """ - SELECT DISTINCT ?this WHERE { - ?action a schema:CreateAction ; - schema:agent ?agent . - ?agent schema:memberOf ?this . - } - """ - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "funding" ; - sh:path schema:funding; - sh:class schema:Grant ; - sh:severity sh:Violation ; - sh:message """The property 'funding' of the Responsible Project MUST be of type Grant.""" ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "member" ; - sh:path schema:member; - sh:or ( - [ sh:class schema:Organization ] - [ sh:class schema:Person ] - ) ; - sh:severity sh:Violation ; - sh:message """The property 'member' of the Responsible Project MUST be of type schema:Organization or Person.""" ; - ] . \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/must/4_sign_off.ttl b/rocrate_validator/profiles/five-safes-crate/must/4_sign_off.ttl deleted file mode 100644 index dfbd85d0c..000000000 --- a/rocrate_validator/profiles/five-safes-crate/must/4_sign_off.ttl +++ /dev/null @@ -1,89 +0,0 @@ -# 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:SignOffObjectActionAndName - a sh:NodeShape ; - sh:name "SignOff" ; - sh:description "Sign Off phase" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - SELECT ?this - WHERE { - ?this schema:additionalType shp:SignOff . - } - """ ; - ] ; - - sh:property [ - sh:path schema:name ; - sh:datatype xsd:string ; - sh:minCount 1 ; - sh:severity sh:Violation ; - sh:message "Sign Off phase MUST have a human-readable name string." ; - ] ; - - sh:property [ - sh:path rdf:type ; - sh:minCount 1 ; - sh:hasValue schema:AssessAction; - sh:severity sh:Violation ; - sh:message "Sign Off phase MUST be a `AssessAction`." ; - ] . - -five-safes-crate:SignOffObjectHasActionStatus - a sh:NodeShape ; - sh:name "SignOffStatus" ; - sh:description "Sign Off Phase Action Status" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - SELECT ?this - WHERE { - ?this schema:additionalType shp:SignOff ; - schema:actionStatus ?status . - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "actionStatus" ; - sh:description "The value of actionStatus MUST be one of the allowed values." ; - sh:path schema:actionStatus ; - sh:in ( - "http://schema.org/PotentialActionStatus" - "http://schema.org/ActiveActionStatus" - "http://schema.org/CompletedActionStatus" - "http://schema.org/FailedActionStatus" - ) ; - sh:severity sh:Violation ; - sh:message "The value of actionStatus MUST be one of the allowed values: PotentialActionStatus; ActiveActionStatus; CompletedActionStatus; FailedActionStatus." ; - ] . 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 deleted file mode 100644 index 3e6a2de08..000000000 --- a/rocrate_validator/profiles/five-safes-crate/must/8_disclosure_phase.ttl +++ /dev/null @@ -1,100 +0,0 @@ -# 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:DisclosureObjectHasDescriptiveNameAndIsAssessAction - a sh:NodeShape ; - sh:name "DisclosureCheck" ; - sh:description "DisclosureCheck" ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - - SELECT ?this - WHERE { - ?this schema:additionalType shp:DisclosureCheck . - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "AssessAction" ; - sh:description "`DisclosureCheck` MUST be a `AssessAction`." ; - sh:path rdf:type ; - sh:minCount 1 ; - sh:hasValue schema:AssessAction; - sh:severity sh:Violation ; - sh:message "`DisclosureCheck` MUST be a `AssessAction`." ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "name" ; - sh:description "`DisclosureCheck` MUST have a name string of at least 10 characters." ; - sh:minCount 1 ; - sh:path schema:name ; - sh:datatype xsd:string ; - sh:minLength 10 ; - sh:severity sh:Violation ; - sh:message "`DisclosureCheck` MUST have a name string of at least 10 characters." ; - ] . - - -five-safes-crate:DisclosureObjectHasActionStatusWithAcceptedValue - a sh:NodeShape ; - sh:name "DisclosureCheck" ; - sh:description "`DisclosureCheck` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX shp: - - SELECT ?this - WHERE { - ?this schema:additionalType shp:DisclosureCheck ; - schema:actionStatus ?status . - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "actionStatus" ; - sh:description "`DisclosureCheck` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; - sh:path schema:actionStatus ; - sh:in ( - "http://schema.org/PotentialActionStatus" - "http://schema.org/ActiveActionStatus" - "http://schema.org/CompletedActionStatus" - "http://schema.org/FailedActionStatus" - ) ; - sh:severity sh:Violation ; - sh:message "`DisclosureCheck` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/should/11_workflow_execution_phase.ttl b/rocrate_validator/profiles/five-safes-crate/should/11_workflow_execution_phase.ttl deleted file mode 100644 index f2061b5b9..000000000 --- a/rocrate_validator/profiles/five-safes-crate/should/11_workflow_execution_phase.ttl +++ /dev/null @@ -1,58 +0,0 @@ -# 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:WorkflowexecutionObjectHasEndTimeIfEnded - a sh:NodeShape ; - sh:name "WorkflowExecution" ; - sh:description "The workflow run object SHOULD have an endTime property if it has ended." ; - - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX rocrate: - - SELECT ?this - WHERE { - ?this a rocrate:WorkflowRunAction ; - schema:actionStatus ?status . - FILTER(?status IN ( - "http://schema.org/CompletedActionStatus", - "http://schema.org/FailedActionStatus" - )) - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "EndTime" ; - sh:path schema:endTime ; - sh:minCount 1 ; - sh:maxCount 1 ; - sh:severity sh:Warning ; - sh:description "The workflow execution object SHOULD have an endTime property if it has ended." ; - sh:message "The workflow execution object SHOULD have an endTime property if it has ended." ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/should/14_workflow_retrieval_phase.ttl b/rocrate_validator/profiles/five-safes-crate/should/14_workflow_retrieval_phase.ttl deleted file mode 100644 index f2bd9dd85..000000000 --- a/rocrate_validator/profiles/five-safes-crate/should/14_workflow_retrieval_phase.ttl +++ /dev/null @@ -1,125 +0,0 @@ -# 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:DownloadActionEntitySHOULDExist - a sh:NodeShape ; - sh:name "RootDataEntity" ; - sh:description "" ; - sh:targetClass ro-crate:RootDataEntity ; - - sh:sparql [ - a sh:SPARQLConstraint ; - sh:name "" ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT $this - WHERE { - FILTER NOT EXISTS { - ?s rdf:type schema:DownloadAction . - } - } - """ ; - sh:severity sh:Warning ; - sh:message "An entity typed DownloadAction SHOULD exist." ; - ] . - - - -five-safes-crate:RootDataEntitySHOULDMentionDownloadActionIfPresent - a sh:NodeShape ; - sh:name "RootDataEntity" ; - sh:description "" ; - sh:targetClass ro-crate:RootDataEntity ; - - sh:sparql [ - a sh:SPARQLConstraint ; - sh:name "" ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT $this ?da - WHERE { - ?da rdf:type schema:DownloadAction . - FILTER NOT EXISTS { - $this schema:mentions ?da . - } - } - """ ; - sh:severity sh:Warning ; - sh:message "RootDataEntity SHOULD mention DownloadAction if this exists." ; - ] . - - -five-safes-crate:DownloadActionShouldHaveEndTimeIfEnded - a sh:NodeShape ; - sh:name "DownloadAction" ; - sh:description "" ; - sh:target [ - a sh:SPARQLTarget ; - sh:select """ - PREFIX schema: - PREFIX rdf: - - SELECT ?this - WHERE { - ?this rdf:type schema:DownloadAction ; - schema:actionStatus ?status . - FILTER(?status IN ( - "http://schema.org/CompletedActionStatus", - "http://schema.org/FailedActionStatus" - )) - } - """ ; - ] ; - - sh:property [ - a sh:PropertyShape ; - sh:name "EndTime" ; - sh:path schema:endTime ; - sh:minCount 1 ; - sh:maxCount 1 ; - sh:severity sh:Warning ; - sh:message "`DownloadAction` SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ; - ] . - - -five-safes-crate:DownloadActionShouldHaveActionStatus - a sh:NodeShape ; - sh:name "DownloadAction" ; - sh:targetClass schema:DownloadAction ; - sh:description "" ; - - sh:property [ - a sh:PropertyShape ; - sh:name "ActionStatus" ; - sh:path schema:actionStatus ; - sh:minCount 1 ; - sh:severity sh:Warning ; - sh:message "`DownloadAction` SHOULD have `actionStatus` property." ; - ] . - diff --git a/rocrate_validator/profiles/five-safes-crate/should/2_requesting_agent.ttl b/rocrate_validator/profiles/five-safes-crate/should/2_requesting_agent.ttl deleted file mode 100644 index 647cbe5fb..000000000 --- a/rocrate_validator/profiles/five-safes-crate/should/2_requesting_agent.ttl +++ /dev/null @@ -1,49 +0,0 @@ -# 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 sh: . -@prefix validator: . -@prefix xsd: . - - -# Person who is the agent of a WorkflowRunAction SHOULD have an affiliation -five-safes-crate:PersonAgentHasAffiliation - a sh:NodeShape ; - sh:name "Agent of WorkflowRunAction" ; - sh:description "The agent of a WorkflowRunAction entity" ; - sh:target [ - a sh:SPARQLTarget ; - sh:prefixes ro-crate:sparqlPrefixes ; - sh:select """ - SELECT DISTINCT ?this WHERE { - ?action a ro-crate:WorkflowRunAction ; - schema:agent ?this . - } - """ - ] ; - - # The agent of the `CreateAction` corresponding to the workflowrunAction SHOULD have an affiliation - sh:property [ - a sh:PropertyShape ; - sh:name "Presence of affiliations" ; - sh:path schema:affiliation ; - sh:minCount 1 ; - sh:severity sh:Warning ; - sh:message "The agent of the `CreateAction` corresponding to the workflow run SHOULD have an affiliation" ; - ] . diff --git a/rocrate_validator/profiles/five-safes-crate/should/6_workflow_reference.ttl b/rocrate_validator/profiles/five-safes-crate/should/6_workflow_reference.ttl deleted file mode 100644 index 98c285652..000000000 --- a/rocrate_validator/profiles/five-safes-crate/should/6_workflow_reference.ttl +++ /dev/null @@ -1,49 +0,0 @@ -# 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:DatasetMustHaveDistributionIfURI - a sh:NodeShape ; - sh:name "mainEntity" ; - sh:targetObjectsOf schema:mainEntity ; - sh:description "If mainEntity has an HTTP(S) @id, it SHOULD have a distribution that is an HTTP(S) URL." ; - - sh:sparql [ - a sh:SPARQLConstraint ; - sh:name "distribution" ; - sh:description "If mainEntity has an HTTP(S) @id, it SHOULD have a distribution that is an HTTP(S) URL." ; - sh:prefixes ro-crate:sparqlPrefixes ; - sh:select """ - SELECT $this - WHERE { - FILTER (STRSTARTS(STR($this), "http://") || STRSTARTS(STR($this), "https://")) . - FILTER NOT EXISTS { - $this schema:distribution ?dist . - FILTER (STRSTARTS(STR(?dist), "http://") || STRSTARTS(STR(?dist), "https://")) . - } - } - """ ; - sh:severity sh:Warning ; - sh:message "If mainEntity has an HTTP(S) @id SHOULD have at least one distribution with an HTTP(S) URL." ; - ] . \ No newline at end of file diff --git a/rocrate_validator/profiles/five-safes-crate/should/7_requested_workflow_run.ttl b/rocrate_validator/profiles/five-safes-crate/should/7_requested_workflow_run.ttl deleted file mode 100644 index d2abd424b..000000000 --- a/rocrate_validator/profiles/five-safes-crate/should/7_requested_workflow_run.ttl +++ /dev/null @@ -1,36 +0,0 @@ -# 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 sh: . -@prefix validator: . -@prefix xsd: . - - -# WorkflowRunAction SHOULD have object property with minimum cardinality 1 -five-safes-crate:WorkflowRunActionShouldHaveObjectProperty - a sh:NodeShape ; - sh:targetClass ro-crate:WorkflowRunAction ; - sh:name "WorkflowRunAction" ; - sh:property [ - sh:path schema:object ; - sh:minCount 1 ; - sh:nodeKind sh:IRI ; - sh:severity sh:Warning ; - sh:message "`CreateAction` (corresponding to the workflow run) SHOULD have the property `object` with IRI values." ; - ] . diff --git a/tests/shared.py b/tests/shared.py index ee49733c7..538038e50 100644 --- a/tests/shared.py +++ b/tests/shared.py @@ -97,6 +97,16 @@ def replace_uri_in_graph(graph, old_uri_str, new_uri_str): return g +def _uses_https_schema(graph: rdflib.Graph) -> bool: + for s, p, o in graph.triples((None, None, None)): + for term in (s, p, o): + if isinstance(term, rdflib.URIRef) and str(term).startswith( + "https://schema.org/" + ): + return True + return False + + def do_entity_test( rocrate_path: Union[Path, str], requirement_severity: models.Severity, @@ -152,10 +162,17 @@ def do_entity_test( if rocrate_entity_mod_sparql is not None: rocrate_graph = load_graph_and_preserve_relative_ids(rocrate) + if _uses_https_schema(rocrate_graph): + rocrate_entity_mod_sparql = rocrate_entity_mod_sparql.replace( + "http://schema.org/", + "https://schema.org/", + ) + rocrate_graph.update(rocrate_entity_mod_sparql) # save the updated RO-Crate metadata - context = "https://w3id.org/ro/crate/1.1/context" + # preserve the original context to avoid forcing a downgrade + context = rocrate.get("@context", "https://w3id.org/ro/crate/1.2/context") rocrate_graph.serialize( Path(temp_rocrate_path, "ro-crate-metadata.json"), format="json-ld",