|
| 1 | +# Copyright (c) 2025 eScience Lab, The University of Manchester |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +@prefix ro: <./> . |
| 16 | +@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> . |
| 17 | +@prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> . |
| 18 | +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
| 19 | +@prefix schema: <http://schema.org/> . |
| 20 | +@prefix purl: <http://purl.org/dc/terms/> . |
| 21 | +@prefix sh: <http://www.w3.org/ns/shacl#> . |
| 22 | +@prefix validator: <https://github.com/crs4/rocrate-validator/> . |
| 23 | +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
| 24 | + |
| 25 | + |
| 26 | +five-safes-crate:DownloadActionObjectMUSTHavesDescriptiveName |
| 27 | + a sh:NodeShape ; |
| 28 | + sh:name "DownloadAction" ; |
| 29 | + sh:targetClass schema:DownloadAction ; |
| 30 | + sh:description "" ; |
| 31 | + |
| 32 | + sh:property [ |
| 33 | + a sh:PropertyShape ; |
| 34 | + sh:name "name" ; |
| 35 | + sh:description "DownloadAction MUST have a human readable name string." ; |
| 36 | + sh:path schema:name ; |
| 37 | + sh:minCount 1 ; |
| 38 | + sh:maxCount 1 ; |
| 39 | + sh:datatype xsd:string ; |
| 40 | + sh:severity sh:Violation ; |
| 41 | + sh:message "DownloadAction MUST have a human readable name string." ; |
| 42 | + ] . |
| 43 | + |
| 44 | +five-safes-crate:DownloadActionStartTimeMUSTFollowISOStandard |
| 45 | + a sh:NodeShape ; |
| 46 | + sh:name "DownloadAction" ; |
| 47 | + sh:description "" ; |
| 48 | + sh:targetClass schema:DownloadAction ; |
| 49 | + |
| 50 | + sh:property [ |
| 51 | + a sh:PropertyShape ; |
| 52 | + sh:name "StartTime" ; |
| 53 | + sh:minCount 0; |
| 54 | + sh:path schema:startTime ; |
| 55 | + 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})$" ; |
| 56 | + sh:severity sh:Violation ; |
| 57 | + sh:message "`DownloadAction` --> `startTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ; |
| 58 | + ] . |
| 59 | + |
| 60 | + |
| 61 | +five-safes-crate:DownloadActionEndTimeMUSTFollowISOStandard |
| 62 | + a sh:NodeShape ; |
| 63 | + sh:name "DownloadAction" ; |
| 64 | + sh:description "" ; |
| 65 | + sh:targetClass schema:DownloadAction ; |
| 66 | + |
| 67 | + sh:property [ |
| 68 | + a sh:PropertyShape ; |
| 69 | + sh:name "EndTime" ; |
| 70 | + sh:minCount 0; |
| 71 | + sh:path schema:endTime ; |
| 72 | + 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})$" ; |
| 73 | + sh:severity sh:Violation ; |
| 74 | + sh:message "`DownloadAction` --> `endTime` MUST follows the RFC 3339 standard (YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))." ; |
| 75 | + ] . |
| 76 | + |
| 77 | + |
| 78 | +five-safes-crate:WorkflowSameAsAndRootDataEntityMainEntityMUSTBeTheSame |
| 79 | + a sh:NodeShape ; |
| 80 | + sh:name "Downloaded Workflow" ; |
| 81 | + sh:description "" ; |
| 82 | + sh:target [ |
| 83 | + a sh:SPARQLTarget ; |
| 84 | + sh:select """ |
| 85 | + PREFIX schema: <http://schema.org/> |
| 86 | + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
| 87 | +
|
| 88 | + SELECT ?this |
| 89 | + WHERE { |
| 90 | + ?this rdf:type schema:Dataset . |
| 91 | + ?s rdf:type schema:DownloadAction ; |
| 92 | + schema:result ?this . |
| 93 | + } |
| 94 | + """ ; |
| 95 | + ]; |
| 96 | + |
| 97 | + sh:sparql [ |
| 98 | + a sh:SPARQLConstraint ; |
| 99 | + sh:select """ |
| 100 | + PREFIX schema: <http://schema.org/> |
| 101 | + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
| 102 | +
|
| 103 | + SELECT $this |
| 104 | + WHERE { |
| 105 | + FILTER NOT EXISTS { |
| 106 | + $this schema:sameAs ?o . |
| 107 | + ?s schema:mainEntity ?o . |
| 108 | + # ?o rdf:type schema:Dataset . |
| 109 | + } |
| 110 | + } |
| 111 | + """ ; |
| 112 | + sh:severity sh:Violation ; |
| 113 | + sh:description "The property `sameAs` of the entity representing the downloaded workflow MUST point to the same entity as `RootDataEntity` --> `mainEntity`." ; |
| 114 | + sh:message "The property `sameAs` of the entity representing the downloaded workflow MUST point to the same entity as `RootDataEntity` --> `mainEntity`." ; |
| 115 | + ] . |
| 116 | + |
| 117 | + |
| 118 | +five-safes-crate:DownloadedWorkflowDistributionAndDownloadActionObjectMUSTBeTheSame |
| 119 | + a sh:NodeShape ; |
| 120 | + sh:name "Downloaded Workflow" ; |
| 121 | + sh:description "" ; |
| 122 | + sh:target [ |
| 123 | + a sh:SPARQLTarget ; |
| 124 | + sh:select """ |
| 125 | + PREFIX schema: <http://schema.org/> |
| 126 | + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
| 127 | +
|
| 128 | + SELECT ?this |
| 129 | + WHERE { |
| 130 | + ?this rdf:type schema:Dataset . |
| 131 | + ?s rdf:type schema:DownloadAction ; |
| 132 | + schema:result ?this . |
| 133 | + } |
| 134 | + """ ; |
| 135 | + ]; |
| 136 | + |
| 137 | + sh:sparql [ |
| 138 | + a sh:SPARQLConstraint ; |
| 139 | + sh:name "" ; |
| 140 | + sh:select """ |
| 141 | + PREFIX schema: <http://schema.org/> |
| 142 | + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
| 143 | +
|
| 144 | + SELECT $this |
| 145 | + WHERE { |
| 146 | + ?action rdf:type schema:DownloadAction . |
| 147 | + FILTER NOT EXISTS { |
| 148 | + $this schema:distribution ?url . |
| 149 | + ?action schema:object ?url . |
| 150 | + } |
| 151 | + } |
| 152 | + """ ; |
| 153 | + sh:severity sh:Violation ; |
| 154 | + sh:message "DownloadedWorkflow --> `distribution` MUST reference the same entity as `DownloadAction` --> `object`." ; |
| 155 | + ] . |
| 156 | + |
| 157 | + |
| 158 | +five-safes-crate:DownloadActionActionStatusMUSTHaveAllowedValues |
| 159 | + a sh:NodeShape ; |
| 160 | + sh:name "DownloadAction" ; |
| 161 | + sh:description "" ; |
| 162 | + |
| 163 | + sh:target [ |
| 164 | + a sh:SPARQLTarget ; |
| 165 | + sh:select """ |
| 166 | + PREFIX schema: <http://schema.org/> |
| 167 | + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
| 168 | +
|
| 169 | + SELECT ?this |
| 170 | + WHERE { |
| 171 | + ?this rdf:type schema:DownloadAction ; |
| 172 | + schema:actionStatus ?status . |
| 173 | + } |
| 174 | + """ ; |
| 175 | + ] ; |
| 176 | + |
| 177 | + sh:property [ |
| 178 | + a sh:PropertyShape ; |
| 179 | + sh:name "ActionStatus" ; |
| 180 | + sh:path schema:actionStatus ; |
| 181 | + sh:in ( |
| 182 | + "http://schema.org/PotentialActionStatus" |
| 183 | + "http://schema.org/ActiveActionStatus" |
| 184 | + "http://schema.org/CompletedActionStatus" |
| 185 | + "http://schema.org/FailedActionStatus" |
| 186 | + ) ; |
| 187 | + sh:severity sh:Violation ; |
| 188 | + sh:message "The value of actionStatus MUST be one of the allowed values: PotentialActionStatus; ActiveActionStatus; CompletedActionStatus; FailedActionStatus." ; |
| 189 | + ] . |
0 commit comments