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 @@ -22,6 +22,35 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .


ro-crate:FindWorkflowRunAction a sh:NodeShape, validator:HiddenShape;
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 schema:mainEntity ?instrument ;
a schema:Dataset .
?metadatafile schema:about ?root .
FILTER(contains(str(?metadatafile), "ro-crate-metadata.json"))
}
"""
] ;

sh:rule [
a sh:TripleRule ;
sh:subject sh:this ;
sh:predicate rdf:type ;
sh:object ro-crate:WorkflowRun ;
] .


five-safes-crate:WorkflowexecutionObjectHasStartTimeIfBegun
a sh:NodeShape ;
sh:name "WorkflowExecution" ;
Expand All @@ -34,11 +63,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:WorkflowRun ;
schema:actionStatus ?status .
FILTER(?status IN (
"http://schema.org/CompletedActionStatus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,35 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .


ro-crate:FindWorkflowRunAction a sh:NodeShape, validator:HiddenShape;
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 schema:mainEntity ?instrument ;
a schema:Dataset .
?metadatafile schema:about ?root .
FILTER(contains(str(?metadatafile), "ro-crate-metadata.json"))
}
"""
] ;

sh:rule [
a sh:TripleRule ;
sh:subject sh:this ;
sh:predicate rdf:type ;
sh:object ro-crate:WorkflowRun ;
] .


five-safes-crate:ResponsibleProject
a sh:NodeShape ;
sh:name "Responsible Project" ;
Expand All @@ -30,7 +59,7 @@ five-safes-crate:ResponsibleProject
sh:prefixes ro-crate:sparqlPrefixes ;
sh:select """
SELECT DISTINCT ?this WHERE {
?action a schema:CreateAction ;
?action a ro-crate:WorkflowRun ;
schema:agent ?agent .
?agent schema:memberOf ?this .
}
Expand All @@ -53,4 +82,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
Expand Up @@ -23,33 +23,62 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .


ro-crate:FindWorkflowRunAction a sh:NodeShape, validator:HiddenShape;
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 schema:mainEntity ?instrument ;
a schema:Dataset .
?metadatafile schema:about ?root .
FILTER(contains(str(?metadatafile), "ro-crate-metadata.json"))
}
"""
] ;

sh:rule [
a sh:TripleRule ;
sh:subject sh:this ;
sh:predicate rdf:type ;
sh:object ro-crate:WorkflowRun ;
] .


five-safes-crate:WorkflowMustHaveDescriptiveName
a sh:NodeShape ;
sh:name "WorkflowExecution" ;
sh:targetClass schema:CreateAction ;
sh:targetClass ro-crate:WorkflowRun ;

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 "WorkflowRun 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 "WorkflowRun 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:WorkflowRun ;
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 "WorkflowRun 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 +87,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 "WorkflowRun 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,37 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .


five-safes-crate:RootDataEntityMentionsCreateAction
ro-crate:FindWorkflowRunAction a sh:NodeShape, validator:HiddenShape;
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 schema:mainEntity ?instrument ;
a schema:Dataset .
?metadatafile schema:about ?root .
FILTER(contains(str(?metadatafile), "ro-crate-metadata.json"))
}
"""
] ;

# Expand data graph with triples from the file data entity
sh:rule [
a sh:TripleRule ;
sh:subject sh:this ;
sh:predicate rdf:type ;
sh:object ro-crate:WorkflowRun ;
] .


five-safes-crate:RootDataEntityMentionsWorkflowRun
a sh:NodeShape ;
sh:name "RootDataEntity" ;
sh:targetClass ro-crate:RootDataEntity ;
Expand All @@ -33,42 +63,43 @@ five-safes-crate:RootDataEntityMentionsCreateAction
sh:name "mentions" ;
sh:path schema:mentions;
sh:qualifiedValueShape [
sh:class schema:CreateAction ;
sh:class ro-crate:WorkflowRun ;
] ;
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 `WorkflowRun` through `mentions`" ;
] .


five-safes-crate:CreateActionInstrumentAndStatus
five-safes-crate:WorkflowRunExistence
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 "WorkflowRun" ;
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 {
?workflowRun a ro-crate:WorkflowRun .
}
}
""" ;
sh:message "`CreateAction` --> `instrument` MUST reference the same entity as `Root Data Entity` --> `mainEntity`" ;
] ;
sh:message "The crate MUST contain at least one `WorkflowRun` entity" ;
] .


five-safes-crate:WorkflowRunObject
a sh:NodeShape ;
sh:name "WorkflowRun" ;
sh:targetClass ro-crate:WorkflowRun ;
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 +111,5 @@ five-safes-crate:CreateActionInstrumentAndStatus
FILTER NOT EXISTS { ?object a ?type . }
}
""" ;
sh:message "Each `object` in `CreateAction` MUST reference an existing entity." ;
] .
sh:message "Each `object` in `WorkflowRun` 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 WorkflowRun class
ro-crate:WorkflowRun rdf:type owl:Class ;
rdfs:subClassOf schema:CreateAction ;
rdfs:label "WorkflowRun"@en .
Loading
Loading