Skip to content
Merged
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 @@ -53,6 +53,6 @@ five-safes-crate:SignOffPhaseStartTime
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. This must follow ISO-8601 syntax" ;
sh:message "Sign Off object MAY have a startTime property if action is active, completed or failed. This must follow ISO-8601 syntax" ;
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." ;
] .
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,6 @@ five-safes-crate:WorkflowMustHaveDescriptiveName
] .


five-safes-crate:WorkflowexecutionObjectHasCompliantStartTimeFormat
a sh:NodeShape ;
sh:name "WorkflowExecution" ;
sh:description "The startTime of the workflow execution object MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
sh:targetClass schema:CreateAction ;

sh:property [
a sh:PropertyShape ;
sh:name "StartTime" ;
sh:path schema:startTime ;
sh:minCount 0 ;
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:Violation ;
sh:message "The startTime of the workflow execution object MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .


five-safes-crate:WorkflowexecutionObjectHasCompliantEndTimeFormat
a sh:NodeShape ;
sh:name "WorkflowExecution" ;
sh:description "The endTime of the workflow execution object MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
sh:targetClass schema:CreateAction ;

sh:property [
a sh:PropertyShape ;
sh:name "EndTime" ;
sh:path schema:endTime ;
sh:minCount 0 ;
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:Violation ;
sh:message "The endTime of the workflow execution object MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .


five-safes-crate:WorkflowMustHaveActionStatusWithAllowedValues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,62 +59,6 @@ five-safes-crate:CheckValueObjectHasDescriptiveNameAndIsAssessAction
sh:message "CheckValue MUST have a human readable name string." ;
] .

five-safes-crate:CheckValueStartTimeMustFollowISOStandard
a sh:NodeShape ;
sh:name "CheckValue" ;
sh:description "" ;
sh:target [
a sh:SPARQLTarget ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX shp: <https://w3id.org/shp#>
SELECT ?this
WHERE {
?this schema:additionalType shp:CheckValue ;
schema:startTime ?o

}
""" ;
] ;

sh:property [
a sh:PropertyShape ;
sh:name "StartTime" ;
sh:path schema:startTime ;
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:Violation ;
sh:message "`CheckValue` --> `startTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .


five-safes-crate:CheckValueEndTimeMustFollowISOStandard
a sh:NodeShape ;
sh:name "CheckValue" ;
sh:description "" ;
sh:target [
a sh:SPARQLTarget ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX shp: <https://w3id.org/shp#>
SELECT ?this
WHERE {
?this schema:additionalType shp:CheckValue ;
schema:endTime ?o

}
""" ;
] ;

sh:property [
a sh:PropertyShape ;
sh:name "EndTime" ;
sh:path schema:endTime ;
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:Violation ;
sh:message "`CheckValue` --> `endTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .


five-safes-crate:CheckValueActionStatusMustHaveAllowedValues
a sh:NodeShape ;
sh:name "CheckValue" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,59 +124,3 @@ five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue
sh:severity sh:Violation ;
sh:message "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ;
] .


five-safes-crate:ValidationCheckStartTimeMUSTFollowISOStandard
a sh:NodeShape ;
sh:name "ValidationCheck" ;
sh:description "" ;
sh:target [
a sh:SPARQLTarget ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX shp: <https://w3id.org/shp#>

SELECT ?this
WHERE {
?this schema:additionalType shp:ValidationCheck .
}
""" ;
] ;

sh:property [
a sh:PropertyShape ;
sh:name "StartTime" ;
sh:minCount 0;
sh:path schema:startTime ;
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:Violation ;
sh:message "ValidationCheck --> `startTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .


five-safes-crate:ValidationCheckEndTimeMUSTFollowISOStandard
a sh:NodeShape ;
sh:name "ValidationCheck" ;
sh:description "" ;
sh:target [
a sh:SPARQLTarget ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX shp: <https://w3id.org/shp#>

SELECT ?this
WHERE {
?this schema:additionalType shp:ValidationCheck .
}
""" ;
] ;

sh:property [
a sh:PropertyShape ;
sh:name "EndTime" ;
sh:minCount 0;
sh:path schema:endTime ;
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:Violation ;
sh:message "ValidationCheck --> `endTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,6 @@ five-safes-crate:DownloadActionObjectMUSTHavesDescriptiveName
sh:message "DownloadAction MUST have a human readable name string." ;
] .

five-safes-crate:DownloadActionStartTimeMUSTFollowISOStandard
a sh:NodeShape ;
sh:name "DownloadAction" ;
sh:description "" ;
sh:targetClass schema:DownloadAction ;

sh:property [
a sh:PropertyShape ;
sh:name "StartTime" ;
sh:minCount 0;
sh:path schema:startTime ;
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:Violation ;
sh:message "`DownloadAction` --> `startTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .


five-safes-crate:DownloadActionEndTimeMUSTFollowISOStandard
a sh:NodeShape ;
sh:name "DownloadAction" ;
sh:description "" ;
sh:targetClass schema:DownloadAction ;

sh:property [
a sh:PropertyShape ;
sh:name "EndTime" ;
sh:minCount 0;
sh:path schema:endTime ;
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:Violation ;
sh:message "`DownloadAction` --> `endTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .


five-safes-crate:WorkflowSameAsAndRootDataEntityMainEntityMUSTBeTheSame
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
@prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <http://schema.org/> .
@prefix purl: <http://purl.org/dc/terms/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .


# 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.
# the properties are listed individually so that the property id appears in any error message too
five-safes-crate:TimeStampFormat
a sh:NodeShape ;
sh:name "Timestamp Format" ;
sh:description "Timestamps MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
sh:targetSubjectsOf schema:startTime, schema:endTime;
sh:property [
a sh:PropertyShape ;
sh:name "End TimeStamp" ;
sh:path schema:endTime ;
sh:minCount 0 ;
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: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))." ;
sh:description "End timestamps MUST follow the RFC 3339 standard." ;
] ;
sh:property [
a sh:PropertyShape ;
sh:name "Start TimeStamp" ;
sh:path schema:startTime ;
sh:minCount 0 ;
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: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))." ;
sh:description "Start timestamps MUST follow the RFC 3339 standard." ;
] .
Original file line number Diff line number Diff line change
Expand Up @@ -98,61 +98,3 @@ five-safes-crate:DisclosureObjectHasActionStatusWithAcceptedValue
sh:severity sh:Violation ;
sh:message "`DisclosureCheck` MUST have an actionStatus with an allowed value (see https://schema.org/ActionStatusType)." ;
] .


five-safes-crate:DisclosureObjectHasCompliantStartTimeFormat
a sh:NodeShape ;
sh:name "DisclosureCheck" ;
sh:description "`DisclosureCheck` --> `startTime` MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
sh:target [
a sh:SPARQLTarget ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX shp: <https://w3id.org/shp#>

SELECT ?this
WHERE {
?this schema:additionalType shp:DisclosureCheck ;
schema:startTime ?o
}
""" ;
] ;

sh:property [
a sh:PropertyShape ;
sh:name "StartTime" ;
sh:path schema:startTime ;
sh:minCount 0 ;
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:Violation ;
sh:message "`DisclosureCheck` --> `startTime` MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .


five-safes-crate:DisclosureObjectHasCompliantEndTimeFormat
a sh:NodeShape ;
sh:name "DisclosureCheck" ;
sh:description "`DisclosureCheck` --> `endTime` MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
sh:target [
a sh:SPARQLTarget ;
sh:select """
PREFIX schema: <http://schema.org/>
PREFIX shp: <https://w3id.org/shp#>

SELECT ?this
WHERE {
?this schema:additionalType shp:DisclosureCheck ;
schema:endTime ?o
}
""" ;
] ;

sh:property [
a sh:PropertyShape ;
sh:name "EndTime" ;
sh:path schema:endTime ;
sh:minCount 0 ;
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:Violation ;
sh:message "`DisclosureCheck` --> `endTime` MUST follow the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ;
] .
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,3 @@ five-safes-crate:CheckValueShouldHaveActionStatus
sh:severity sh:Warning ;
sh:message "CheckValue SHOULD have actionStatus property." ;
] .

Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ five-safes-crate:SignOffPhaseEndTime
sh:path schema:endTime ;
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:Warning ;
sh:description "Sign Off object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;
sh:message "Sign Off object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;
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." ;
] .
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def test_5src_workflow_object_has_no_properly_formatted_start_time():
rocrate_path=ValidROC().five_safes_crate_result,
requirement_severity=Severity.REQUIRED,
expected_validation_result=False,
expected_triggered_requirements=["WorkflowExecution"],
expected_triggered_requirements=["Timestamp Format"],
expected_triggered_issues=[
(
"The startTime of the workflow execution object MUST follow the RFC 3339 standard "
"All `startTime` and `endTime` values MUST follow the RFC 3339 standard "
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
)
],
Expand Down Expand Up @@ -169,10 +169,10 @@ def test_5src_workflow_object_has_no_properly_formatted_end_time():
rocrate_path=ValidROC().five_safes_crate_result,
requirement_severity=Severity.REQUIRED,
expected_validation_result=False,
expected_triggered_requirements=["WorkflowExecution"],
expected_triggered_requirements=["Timestamp Format"],
expected_triggered_issues=[
(
"The endTime of the workflow execution object MUST follow the RFC 3339 standard "
"All `startTime` and `endTime` values MUST follow the RFC 3339 standard "
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def test_5src_check_value_start_time_not_iso_standard():
rocrate_path=ValidROC().five_safes_crate_result,
requirement_severity=Severity.REQUIRED,
expected_validation_result=False,
expected_triggered_requirements=["CheckValue"],
expected_triggered_requirements=["Timestamp Format"],
expected_triggered_issues=[
(
"`CheckValue` --> `startTime` MUST follows the RFC 3339 standard "
"All `startTime` and `endTime` values MUST follow the RFC 3339 standard "
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
)
],
Expand Down Expand Up @@ -142,10 +142,10 @@ def test_5src_check_value_end_time_not_iso_standard():
rocrate_path=ValidROC().five_safes_crate_result,
requirement_severity=Severity.REQUIRED,
expected_validation_result=False,
expected_triggered_requirements=["CheckValue"],
expected_triggered_requirements=["Timestamp Format"],
expected_triggered_issues=[
(
"`CheckValue` --> `endTime` MUST follows the RFC 3339 standard "
"All `startTime` and `endTime` values MUST follow the RFC 3339 standard "
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
)
],
Expand Down
Loading