|
19 | 19 | @prefix schema: <http://schema.org/> . |
20 | 20 | @prefix purl: <http://purl.org/dc/terms/> . |
21 | 21 | @prefix sh: <http://www.w3.org/ns/shacl#> . |
| 22 | +@prefix shp: <https://w3id.org/shp#> . |
22 | 23 | @prefix validator: <https://github.com/crs4/rocrate-validator/> . |
23 | 24 | @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
24 | 25 |
|
25 | 26 |
|
26 | | -five-safes-crate:RootDataEntityShouldMentionValidationCheckObject |
| 27 | +#=== MUST shapes ===# |
| 28 | + |
| 29 | +five-safes-crate:ValidationCheckObjectHasDescriptiveNameAndIsAssessAction |
27 | 30 | a sh:NodeShape ; |
28 | | - sh:name "RootDataEntity" ; |
29 | | - sh:targetClass ro-crate:RootDataEntity ; |
| 31 | + sh:name "ValidationCheck" ; |
30 | 32 | sh:description "" ; |
31 | 33 |
|
32 | | - sh:sparql [ |
33 | | - a sh:SPARQLConstraint ; |
34 | | - sh:name "mentions" ; |
35 | | - sh:description "RootDataEntity SHOULD mention a ValidationCheck object." ; |
| 34 | + sh:target [ |
| 35 | + a sh:SPARQLTarget ; |
| 36 | + sh:select """ |
| 37 | + PREFIX schema: <http://schema.org/> |
| 38 | + PREFIX shp: <https://w3id.org/shp#> |
| 39 | +
|
| 40 | + SELECT ?this |
| 41 | + WHERE { |
| 42 | + ?this schema:additionalType shp:ValidationCheck . |
| 43 | + } |
| 44 | + """ ; |
| 45 | + ] ; |
| 46 | + |
| 47 | + sh:property [ |
| 48 | + sh:path rdf:type ; |
| 49 | + sh:minCount 1 ; |
| 50 | + sh:hasValue schema:AssessAction; |
| 51 | + sh:severity sh:Violation ; |
| 52 | + sh:message "ValidationCheck MUST be a `AssessAction`." ; |
| 53 | + ] ; |
| 54 | + |
| 55 | + sh:property [ |
| 56 | + sh:a sh:PropertyShape ; |
| 57 | + sh:name "name" ; |
| 58 | + sh:description "ValidationCheck MUST have a human readable name string." ; |
| 59 | + sh:path schema:name ; |
| 60 | + sh:datatype xsd:string ; |
| 61 | + sh:severity sh:Violation ; |
| 62 | + sh:message "ValidationCheck MUST have a human readable name string." ; |
| 63 | + ] . |
| 64 | + |
| 65 | + |
| 66 | +five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue |
| 67 | + a sh:NodeShape ; |
| 68 | + sh:name "ValidationCheck" ; |
| 69 | + sh:target [ |
| 70 | + a sh:SPARQLTarget ; |
| 71 | + sh:select """ |
| 72 | + PREFIX schema: <http://schema.org/> |
| 73 | + PREFIX shp: <https://w3id.org/shp#> |
| 74 | +
|
| 75 | + SELECT ?this |
| 76 | + WHERE { |
| 77 | + ?this schema:additionalType shp:ValidationCheck ; |
| 78 | + schema:actionStatus ?status . |
| 79 | + } |
| 80 | + """ ; |
| 81 | + ] ; |
| 82 | + |
| 83 | + sh:property [ |
| 84 | + a sh:PropertyShape ; |
| 85 | + sh:name "actionStatus" ; |
| 86 | + sh:description "The `actionStatus` of ValidationCheck MUST have an allowed value (see https://schema.org/ActionStatusType)." ; |
| 87 | + sh:path schema:actionStatus ; |
| 88 | + sh:in ( |
| 89 | + "http://schema.org/PotentialActionStatus" |
| 90 | + "http://schema.org/ActiveActionStatus" |
| 91 | + "http://schema.org/CompletedActionStatus" |
| 92 | + "http://schema.org/FailedActionStatus" |
| 93 | + ) ; |
| 94 | + sh:severity sh:Violation ; |
| 95 | + sh:message "The `actionStatus` of ValidationCheck MUST have an allowed value (see https://schema.org/ActionStatusType)." ; |
| 96 | + ] . |
| 97 | + |
| 98 | + |
| 99 | +five-safes-crate:ValidationCheckActionStatusMustHaveAllowedValue |
| 100 | + a sh:NodeShape ; |
| 101 | + sh:name "ValidationCheck" ; |
| 102 | + sh:target [ |
| 103 | + a sh:SPARQLTarget ; |
36 | 104 | sh:select """ |
37 | 105 | PREFIX schema: <http://schema.org/> |
38 | | - PREFIX shp: <https://w3id.org/shp#> |
39 | | - SELECT $this |
| 106 | + PREFIX shp: <https://w3id.org/shp#> |
| 107 | +
|
| 108 | + SELECT ?this |
40 | 109 | WHERE { |
41 | | - FILTER NOT EXISTS{ |
42 | | - $this schema:mentions ?action . |
43 | | - ?action schema:additionalType shp:ValidationCheck . |
44 | | - } |
| 110 | + ?this schema:additionalType shp:ValidationCheck . |
45 | 111 | } |
46 | 112 | """ ; |
| 113 | + ] ; |
| 114 | + |
| 115 | + sh:property [ |
| 116 | + a sh:PropertyShape ; |
| 117 | + sh:minCount 1 ; |
| 118 | + sh:name "actionStatus" ; |
| 119 | + sh:description "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ; |
| 120 | + sh:path schema:actionStatus ; |
| 121 | + sh:in ( |
| 122 | + "http://schema.org/PotentialActionStatus" |
| 123 | + "http://schema.org/ActiveActionStatus" |
| 124 | + "http://schema.org/CompletedActionStatus" |
| 125 | + "http://schema.org/FailedActionStatus" |
| 126 | + ) ; |
| 127 | + sh:severity sh:Violation ; |
| 128 | + sh:message "actionStatus MUST be either PotentialActionStatus, ActiveActionStatus, CompletedActionStatus, or FailedActionStatus." ; |
| 129 | + ] . |
| 130 | + |
| 131 | + |
| 132 | +#=== SHOULD shapes ===# |
| 133 | + |
| 134 | +five-safes-crate:RootDataEntityShouldMentionValidationCheckObject |
| 135 | + a sh:NodeShape ; |
| 136 | + sh:name "RootDataEntity" ; |
| 137 | + sh:targetClass ro-crate:RootDataEntity ; |
| 138 | + sh:description "" ; |
| 139 | + |
| 140 | + sh:property [ |
| 141 | + sh:path schema:mentions ; |
| 142 | + |
| 143 | + # Require at least one mentioned node that is a ValidationCheck (via additionalType) |
| 144 | + sh:qualifiedValueShape [ |
| 145 | + sh:property [ |
| 146 | + sh:path schema:additionalType ; |
| 147 | + sh:hasValue shp:ValidationCheck ; |
| 148 | + ] ; |
| 149 | + ] ; |
| 150 | + sh:qualifiedMinCount 1 ; |
| 151 | + |
47 | 152 | sh:severity sh:Warning ; |
48 | 153 | sh:message "RootDataEntity SHOULD mention a ValidationCheck object." ; |
49 | 154 | ] . |
@@ -163,3 +268,39 @@ five-safes-crate:DownloadActionShouldHaveEndTimeIfBegun |
163 | 268 | sh:description "ValidationCheck SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ; |
164 | 269 | sh:message "ValidationCheck SHOULD have the `endTime` property if `actionStatus` is either CompletedActionStatus or FailedActionStatus." ; |
165 | 270 | ] . |
| 271 | + |
| 272 | + |
| 273 | +#=== MAY shapes ===# |
| 274 | + |
| 275 | +five-safes-crate:DownloadActionMayHaveStartTimeIfBegun |
| 276 | + a sh:NodeShape ; |
| 277 | + sh:name "ValidationCheck" ; |
| 278 | + sh:description "" ; |
| 279 | + sh:target [ |
| 280 | + a sh:SPARQLTarget ; |
| 281 | + sh:select """ |
| 282 | + PREFIX schema: <http://schema.org/> |
| 283 | + PREFIX shp: <https://w3id.org/shp#> |
| 284 | + SELECT ?this |
| 285 | + WHERE { |
| 286 | + ?this schema:additionalType shp:ValidationCheck ; |
| 287 | + schema:actionStatus ?status . |
| 288 | + FILTER(?status IN ( |
| 289 | + "http://schema.org/CompletedActionStatus", |
| 290 | + "http://schema.org/FailedActionStatus", |
| 291 | + "http://schema.org/ActiveActionStatus" |
| 292 | + )) |
| 293 | + } |
| 294 | + """ ; |
| 295 | + ] ; |
| 296 | + |
| 297 | + sh:property [ |
| 298 | + a sh:PropertyShape ; |
| 299 | + sh:name "StartTime" ; |
| 300 | + sh:path schema:startTime ; |
| 301 | + sh:minCount 1 ; |
| 302 | + sh:maxCount 1 ; |
| 303 | + sh:severity sh:Info ; |
| 304 | + sh:description "ValidationCheck MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; |
| 305 | + sh:message "ValidationCheck MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ; |
| 306 | + ] . |
0 commit comments