Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ five-safes-crate:WorkflowexecutionObjectHasStartTimeIfBegun
a sh:SPARQLTarget ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rocrate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/>

SELECT ?this
WHERE {
?this rdf:type schema:CreateAction ;
?this a rocrate:WorkflowRunAction ;
schema:actionStatus ?status .
FILTER(?status IN (
"http://schema.org/CompletedActionStatus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ five-safes-crate:ResponsibleProject
sh:prefixes ro-crate:sparqlPrefixes ;
sh:select """
SELECT DISTINCT ?this WHERE {
?action a schema:CreateAction ;
?action a ro-crate:WorkflowRunAction ;
schema:agent ?agent .
?agent schema:memberOf ?this .
}
Expand All @@ -53,4 +53,4 @@ five-safes-crate:ResponsibleProject
sh:minCount 1 ;
sh:severity sh:Info ;
sh:message """The Responsible Project does not have the property `member`.""" ;
] .
] .
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <http://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix validator: <https://github.com/crs4/rocrate-validator/> .


ro-crate:FindWorkflowRunAction a sh:NodeShape, validator:HiddenShape;
sh:order 1 ;
sh:name "Identify the CreateAction Entity that corresponds to the Workflow run" ;
sh:description """The Workflow Run is the CreateAction entity that refers to Workflow run.
This is identified by checking that the CreateAction entity has an `instrument` property
that references the same entity as the `mainEntity` property of the Root Data Entity.""" ;
sh:target [
a sh:SPARQLTarget ;
sh:prefixes ro-crate:sparqlPrefixes ;
sh:select """
SELECT ?this
WHERE {
?this a schema:CreateAction ;
schema:instrument ?instrument .
?root a ro-crate:RootDataEntity ;
schema:mainEntity ?instrument .
}
"""
] ;

sh:rule [
a sh:TripleRule ;
sh:subject sh:this ;
sh:predicate rdf:type ;
sh:object ro-crate:WorkflowRunAction ;
] .
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@
five-safes-crate:WorkflowMustHaveDescriptiveName
a sh:NodeShape ;
sh:name "WorkflowExecution" ;
sh:targetClass schema:CreateAction ;
sh:targetClass ro-crate:WorkflowRunAction ;

sh:property [
a sh:PropertyShape ;
sh:name "name" ;
sh:minCount 1 ;
sh:description "Workflow (CreateAction) MUST have a name string of at least 10 characters." ;
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 "Workflow (CreateAction) MUST have a name string of at least 10 characters." ;
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 schema:CreateAction ;
sh:targetClass ro-crate:WorkflowRunAction ;
sh:property [
a sh:PropertyShape ;
sh:minCount 1 ;
sh:name "actionStatus" ;
sh:description "WorkflowExecution MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ;
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"
Expand All @@ -58,5 +58,5 @@ five-safes-crate:WorkflowMustHaveActionStatusWithAllowedValues
"http://schema.org/FailedActionStatus"
) ;
sh:severity sh:Violation ;
sh:message "WorkflowExecution MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ;
sh:message "`CreateAction` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ;
] .
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .


five-safes-crate:RootDataEntityMentionsCreateAction
five-safes-crate:RootDataEntityMentionsWorkflowRunAction
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test (five-safes-crate:RootDataEntityMentionsWorkflowRunAction) replicated by the test five-safes-crate:RootDataEntityShouldMentionWorkflow in the file should/11_workflow_execution_phase.ttl?

Can you check, and see if they are the same test, and if so then decide if we should keep the MUST or the SHOULD version?

a sh:NodeShape ;
sh:name "RootDataEntity" ;
sh:targetClass ro-crate:RootDataEntity ;
Expand All @@ -33,42 +33,43 @@ five-safes-crate:RootDataEntityMentionsCreateAction
sh:name "mentions" ;
sh:path schema:mentions;
sh:qualifiedValueShape [
sh:class schema:CreateAction ;
sh:class ro-crate:WorkflowRunAction ;
] ;
sh:qualifiedMinCount 1 ;
sh:severity sh:Violation ;
sh:message "`RootDataEntity` MUST reference at least one `CreateAction` through `mentions`" ;
sh:message "`RootDataEntity` MUST reference at least one `CreateAction` (corresponding to the workflow run) through `mentions`" ;
] .


five-safes-crate:CreateActionInstrumentAndStatus
five-safes-crate:WorkflowRunActionExistence
a sh:NodeShape ;
sh:name "CreateAction" ;
sh:targetClass schema:CreateAction ;
sh:description "" ;
sh:severity sh:Violation ; # Apply to all property shapes / constraints below
sh:name "RootDataEntity" ;
sh:targetClass ro-crate:RootDataEntity ;
sh:description "" ;

sh:property [
a sh:PropertyShape ;
sh:name "instrument" ;
sh:path schema:instrument;
sh:minCount 1 ;
sh:message "`CreateAction` MUST have the `instrument` property" ;
] ;
sh:sparql [
a sh:SPARQLConstraint ;
sh:name "instrument" ;
sh:name "WorkflowRunAction" ;
sh:prefixes ro-crate:sparqlPrefixes ;
sh:select """
SELECT $this ?main ?instrument
WHERE {
?root schema:mainEntity ?main .
$this schema:instrument ?instrument .
FILTER (?instrument != ?main)
}
SELECT $this
WHERE {
FILTER NOT EXISTS {
?workflowRunAction a ro-crate:WorkflowRunAction .
}
}
""" ;
sh:message "`CreateAction` --> `instrument` MUST reference the same entity as `Root Data Entity` --> `mainEntity`" ;
] ;
sh:message "The `CreateAction` entity corresponding to the workflow run MUST reference through its property `instrument` the same entity as `RootData Entity` --> `mainEntity`" ;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we word this more clearly?

Perhaps 'The CreateAction entity corresponding to the workflow MUST reference, as an instrument, the entity that is referenced as mainEntity by the RO-Crate'.

] .


five-safes-crate:WorkflowRunObject
a sh:NodeShape ;
sh:name "WorkflowRunAction" ;
sh:targetClass ro-crate:WorkflowRunAction ;
sh:description "" ;
sh:severity sh:Violation ; # Apply to all property shapes / constraints below

sh:sparql [
a sh:SPARQLConstraint ;
sh:prefixes ro-crate:sparqlPrefixes ;
Expand All @@ -80,5 +81,5 @@ five-safes-crate:CreateActionInstrumentAndStatus
FILTER NOT EXISTS { ?object a ?type . }
}
""" ;
sh:message "Each `object` in `CreateAction` MUST reference an existing entity." ;
] .
sh:message "In the `CreateAction` entity corresponding to the workflow run, each `object` MUST reference an existing entity." ;
] .
37 changes: 37 additions & 0 deletions rocrate_validator/profiles/five-safes-crate/ontology.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2024-2026 CRS4
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

@prefix ro: <./> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix rocrate: <https://w3id.org/ro/crate/1.1/> .
@prefix bioschemas: <https://bioschemas.org/> .
@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
@prefix isa-ro-crate: <https://github.com/crs4/rocrate-validator/profiles/isa-ro-crate/> .

<urn:absolute:.> rdf:type owl:Ontology ;
owl:versionIRI <urn:absolute:1.0> .

# # #################################################################
# # # Classes
# # #################################################################

# Declare a WorkflowRunAction class
ro-crate:WorkflowRunAction rdf:type owl:Class ;
rdfs:subClassOf schema:CreateAction ;
rdfs:label "WorkflowRunAction"@en .
24 changes: 11 additions & 13 deletions rocrate_validator/profiles/five-safes-crate/should/10_outputs.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .



five-safes-crate:CreateActionHasResultIfActionCompleted
five-safes-crate:WorkflowRunActionHasResultIfActionCompleted
a sh:NodeShape ;
sh:name "CreateAction" ;
sh:description "`CreateAction` with CompletedActionStatus SHOULD have the `schema:result` property." ;
sh:name "WorkflowRunAction" ;
sh:description "The `CreateAction` corresponding to the workflow run, with CompletedActionStatus, SHOULD have the `schema:result` property." ;

sh:target [
a sh:SPARQLTarget ;
sh:name "Result" ;
sh:description "`CreateAction` with CompletedActionStatus SHOULD have the `schema:result` property." ;
sh:name "WorkflowRunAction" ;
sh:description "The `CreateAction` corresponding to the workflow run, with CompletedActionStatus, SHOULD have the `result` property." ;
sh:prefixes ro-crate:sparqlPrefixes ;
sh:select """
SELECT ?this WHERE {
?this a schema:CreateAction ;
?this a ro-crate:WorkflowRunAction ;
schema:actionStatus "http://schema.org/CompletedActionStatus" .
}
"""
Expand All @@ -48,22 +47,22 @@ five-safes-crate:CreateActionHasResultIfActionCompleted
sh:path schema:result ;
sh:minCount 1 ;
sh:severity sh:Warning ;
sh:message "`CreateAction` with CompletedActionStatus SHOULD have the `result` property." ;
sh:message "The `CreateAction` corresponding to the workflow run, with CompletedActionStatus, SHOULD have the `result` property." ;
] .


five-safes-crate:CreateActionResultOutputsHaveAllowedTypes
five-safes-crate:WorkflowRunActionResultOutputsHaveAllowedTypes
a sh:NodeShape ;
sh:name "Output" ;
sh:description "Result SHOULD have a `@type` among an allowed set of values." ;
sh:target [
a sh:SPARQLTarget ;
sh:prefixes ro-crate:sparqlPrefixes ;
sh:select """
PREFIX schema: <http://schema.org/>
SELECT ?this
WHERE {
?createAction a schema:CreateAction .
?createAction schema:result ?this .
?workflowRunAction a ro-crate:WorkflowRunAction .
?workflowRunAction schema:result ?this .
}
""" ;
] ;
Expand All @@ -86,4 +85,3 @@ five-safes-crate:CreateActionResultOutputsHaveAllowedTypes
sh:class schema:PropertyValue;
]
) .

Original file line number Diff line number Diff line change
Expand Up @@ -23,47 +23,46 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .



five-safes-crate:RootDataEntityShouldMentionWorkflow
a sh:NodeShape ;
sh:name "RootDataEntity" ;
sh:description "RootDataEntity SHOULD mention workflow execution object (typed CreateAction)." ;
sh:description "RootDataEntity SHOULD reference a workflow run entity (typed CreateAction) through `mentions`." ;
sh:targetClass ro-crate:RootDataEntity ;
sh:sparql [
a sh:SPARQLConstraint ;
sh:name "mentions" ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rocrate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/>
SELECT $this
WHERE {

FILTER NOT EXISTS {
$this schema:mentions ?workflowExecution .
?workflowExecution rdf:type schema:CreateAction .
?workflowExecution a rocrate:WorkflowRunAction .
}
}
""" ;
sh:severity sh:Warning ;
sh:message "RootDataEntity SHOULD mention workflow execution object (typed CreateAction)." ;
sh:message "RootDataEntity SHOULD reference a workflow run entity (typed CreateAction) through `mentions`." ;
] .



five-safes-crate:WorkflowexecutionObjectHasEndTimeIfEnded
a sh:NodeShape ;
sh:name "WorkflowExecution" ;
sh:description "The workflow execution object SHOULD have an endTime property if it has ended." ;
sh:description "The workflow run object SHOULD have an endTime property if it has ended." ;

sh:target [
a sh:SPARQLTarget ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rocrate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/>

SELECT ?this
WHERE {
?this rdf:type schema:CreateAction ;
?this a rocrate:WorkflowRunAction ;
schema:actionStatus ?status .
FILTER(?status IN (
"http://schema.org/CompletedActionStatus",
Expand All @@ -82,4 +81,4 @@ five-safes-crate:WorkflowexecutionObjectHasEndTimeIfEnded
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." ;
] .
] .
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ five-safes-crate:AgentIsMemberOf
sh:prefixes ro-crate:sparqlPrefixes ;
sh:select """
SELECT DISTINCT ?this WHERE {
?action a schema:CreateAction ;
?action a rocrate:WorkflowRunAction ;
schema:agent ?this .
}
"""
Expand All @@ -43,4 +43,4 @@ five-safes-crate:AgentIsMemberOf
sh:minCount 1 ;
sh:severity sh:Warning ;
sh:message """The Requesting Agent SHOULD have a `memberOf` property.""" ;
] .
] .
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ five-safes-crate:ResponsibleProjectMemberAndSourceOrganizationIntersection
sh:prefixes ro-crate:sparqlPrefixes ;
sh:select """
SELECT DISTINCT ?this WHERE {
?action a schema:CreateAction ;
?action a ro-crate:WorkflowRunAction ;
schema:agent ?this .
?this a schema:Person ;
schema:memberOf ?project ;
Expand All @@ -59,4 +59,4 @@ five-safes-crate:ResponsibleProjectMemberAndSourceOrganizationIntersection
}
""" ;
sh:message """At least one of the organisations that are members of the responsible project SHOULD be included in the Requesting Agent's affiliations, if such properties exist.""" ;
] .
] .
Loading
Loading