Skip to content

Commit bd5569f

Browse files
committed
incomplete time test code
1 parent d8e747e commit bd5569f

2 files changed

Lines changed: 80 additions & 27 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
20+
@prefix schema: <http://schema.org/> .
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+
@prefix shp: <https://w3id.org/shp#> .
25+
26+
27+
28+
29+
30+
five-safes-crate:TimeStamp
31+
a sh:NodeShape ;
32+
sh:datatype xsd:string ;
33+
sh:pattern "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(Z|[+-][0-9]{2}:[0-9]{2})$" .
34+
35+
36+
37+
five-safes-crate:EndTimeStamp
38+
a sh:NodeShape ;
39+
sh:property [
40+
sh:node five-safes-crate:TimeStamp ;
41+
sh:description "End Time Check" ;
42+
sh:path schema:endTime ;
43+
sh:minCount 1 ;
44+
sh:maxCount 1 ;
45+
sh:name "EndTime" ;
46+
sh:severity sh:Warning ;
47+
sh:message "Object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;
48+
] .
49+
50+
51+
five-safes-crate:EndTimeSearch
52+
a sh:SPARQLTargetType ;
53+
rdfs:subClassOf sh:Target ;
54+
sh:parameter [
55+
sh:path five-safes-crate:addtype ;
56+
sh:description "Additional Type for Class" ;
57+
sh:class sh:additionalType ;
58+
] ;
59+
sh:select """
60+
PREFIX schema: <http://schema.org/>
61+
PREFIX shp: <https://w3id.org/shp#>
62+
SELECT ?this
63+
WHERE {
64+
?this schema:additionalType $addtype ;
65+
schema:actionStatus ?status .
66+
FILTER(?status IN (
67+
"http://schema.org/CompletedActionStatus",
68+
"http://schema.org/FailedActionStatus"
69+
))
70+
}
71+
""" .
72+

rocrate_validator/profiles/five-safes-crate/should/4_sign_off.ttl

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
2323
@prefix shp: <https://w3id.org/shp#> .
2424

25+
<> a sh:ShapesGraph ;
26+
sh:import <../shape_library.ttl> .
27+
2528

2629
# There SHOULD be a Sign-Off Phase
2730
five-safes-crate:SignOffPhase
@@ -146,32 +149,10 @@ five-safes-crate:SignOffPhaseProperties
146149
five-safes-crate:SignOffPhaseEndTime
147150
a sh:NodeShape ;
148151
sh:description "Sign Off end time check" ;
152+
sh:node five-safes-crate:EndTimeStamp ;
153+
sh:target [
154+
a five-safes-crate:EndTimeSearch ;
155+
sh:additionalType shp:SignOff ;
156+
].
149157

150-
sh:target [
151-
a sh:SPARQLTarget ;
152-
sh:select """
153-
PREFIX schema: <http://schema.org/>
154-
PREFIX shp: <https://w3id.org/shp#>
155-
SELECT ?this
156-
WHERE {
157-
?this schema:additionalType shp:SignOff ;
158-
schema:actionStatus ?status .
159-
FILTER(?status IN (
160-
"http://schema.org/CompletedActionStatus",
161-
"http://schema.org/FailedActionStatus"
162-
))
163-
}
164-
""" ;
165-
] ;
166158

167-
sh:property [
168-
a sh:PropertyShape ;
169-
sh:name "EndTime" ;
170-
sh:path schema:endTime ;
171-
sh:minCount 1 ;
172-
sh:maxCount 1 ;
173-
sh:pattern "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(Z|[+-][0-9]{2}:[0-9]{2})$" ;
174-
sh:severity sh:Warning ;
175-
sh:description "Sign Off object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;
176-
sh:message "Sign Off object SHOULD have endTime property if action completed or failed. This must follow ISO-8601 syntax" ;
177-
] .

0 commit comments

Comments
 (0)