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/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/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/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." ; - ] . -