Skip to content

Commit f0f8067

Browse files
committed
This commit addresses the comments to the PR by Douglase Lowe.
1 parent 26cb233 commit f0f8067

3 files changed

Lines changed: 79 additions & 56 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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 sh: <http://www.w3.org/ns/shacl#> .
21+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
22+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23+
24+
25+
five-safes-crate:DisclosureObjectHasStartTimeIfBegun
26+
a sh:NodeShape ;
27+
sh:name "DisclosureCheck" ;
28+
sh:description "DisclosureCheck" ;
29+
30+
sh:target [
31+
a sh:SPARQLTarget ;
32+
sh:select """
33+
PREFIX schema: <http://schema.org/>
34+
PREFIX shp: <https://w3id.org/shp#>
35+
36+
SELECT ?this
37+
WHERE {
38+
?this schema:additionalType shp:DisclosureCheck ;
39+
schema:actionStatus ?status .
40+
FILTER(?status IN (
41+
"http://schema.org/CompletedActionStatus",
42+
"http://schema.org/FailedActionStatus",
43+
"http://schema.org/ActiveActionStatus"
44+
))
45+
}
46+
""" ;
47+
] ;
48+
49+
sh:property [
50+
a sh:PropertyShape ;
51+
sh:name "StartTime" ;
52+
sh:path schema:startTime ;
53+
sh:minCount 1 ;
54+
sh:maxCount 1 ;
55+
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})$" ;
56+
sh:severity sh:Info ;
57+
sh:description "Disclosure object MAY have startTime property with RFC 3339 full datetime string if action began." ;
58+
sh:message "Disclosure object MAY have startTime property with RFC 3339 full datetime string if action began." ;
59+
] .

rocrate_validator/profiles/five-safes-crate/should/8_disclosure_phase.ttl

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -79,45 +79,6 @@ five-safes-crate:DisclosureObjectHasActionStatus
7979
] .
8080

8181

82-
83-
five-safes-crate:DisclosureObjectHasStartTimeIfBegun
84-
a sh:NodeShape ;
85-
sh:name "DisclosureCheck" ;
86-
sh:description "DisclosureCheck" ;
87-
88-
sh:target [
89-
a sh:SPARQLTarget ;
90-
sh:select """
91-
PREFIX schema: <http://schema.org/>
92-
PREFIX shp: <https://w3id.org/shp#>
93-
94-
SELECT ?this
95-
WHERE {
96-
?this schema:additionalType shp:DisclosureCheck ;
97-
schema:actionStatus ?status .
98-
FILTER(?status IN (
99-
"http://schema.org/CompletedActionStatus",
100-
"http://schema.org/FailedActionStatus",
101-
"http://schema.org/ActiveActionStatus"
102-
))
103-
}
104-
""" ;
105-
] ;
106-
107-
sh:property [
108-
a sh:PropertyShape ;
109-
sh:name "StartTime" ;
110-
sh:path schema:startTime ;
111-
sh:minCount 1 ;
112-
sh:maxCount 1 ;
113-
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})$" ;
114-
sh:severity sh:Warning ;
115-
sh:description "Disclosure object SHOULD have startTime property with a valid datetime if action began." ;
116-
sh:message "Disclosure object SHOULD have startTime property with a valid datetime if action began." ;
117-
] .
118-
119-
120-
12182
five-safes-crate:DisclosureObjectHasEndTimeIfcompletedOrFailed
12283
a sh:NodeShape ;
12384
sh:name "DisclosureCheck" ;

tests/integration/profiles/five-safes-crate/test_5src_8_disclosure_phase.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def test_5src_disclosure_object_not_mentioned_by_root_data_entity():
194194
)
195195

196196

197-
def test_5src_disclosure_object_with_no_axction_status():
197+
def test_5src_disclosure_object_with_no_action_status():
198198
sparql = """
199199
PREFIX schema: <http://schema.org/>
200200
PREFIX shp: <https://w3id.org/shp#>
@@ -218,14 +218,17 @@ def test_5src_disclosure_object_with_no_axction_status():
218218
)
219219

220220

221-
def test_5src_disclosure_object_has_no_start_time_if_begun():
221+
def test_5src_disclosure_object_has_no_properly_formatted_start_time_if_begun():
222222
sparql = """
223223
PREFIX schema: <http://schema.org/>
224224
PREFIX shp: <https://w3id.org/shp#>
225225
226226
DELETE {
227227
?s schema:startTime ?o .
228228
}
229+
INSERT {
230+
?s schema:startTime "1st Dec '25 @ 10:00:00" .
231+
}
229232
WHERE {
230233
?s schema:additionalType shp:DisclosureCheck ;
231234
schema:actionStatus ?status .
@@ -248,24 +251,20 @@ def test_5src_disclosure_object_has_no_start_time_if_begun():
248251
)
249252

250253

251-
def test_5src_disclosure_object_has_no_properly_formatted_start_time_if_begun():
254+
def test_5src_disclosure_object_has_no_end_time_if_ended():
252255
sparql = """
253256
PREFIX schema: <http://schema.org/>
254257
PREFIX shp: <https://w3id.org/shp#>
255258
256259
DELETE {
257-
?s schema:startTime ?o .
258-
}
259-
INSERT {
260-
?s schema:startTime "1st Dec '25 @ 10:00:00" .
260+
?s schema:endTime ?o .
261261
}
262262
WHERE {
263263
?s schema:additionalType shp:DisclosureCheck ;
264264
schema:actionStatus ?status .
265265
FILTER(?status IN (
266266
"http://schema.org/CompletedActionStatus",
267-
"http://schema.org/FailedActionStatus",
268-
"http://schema.org/ActiveActionStatus"
267+
"http://schema.org/FailedActionStatus"
269268
))
270269
}
271270
"""
@@ -281,14 +280,17 @@ def test_5src_disclosure_object_has_no_properly_formatted_start_time_if_begun():
281280
)
282281

283282

284-
def test_5src_disclosure_object_has_no_end_time_if_ended():
283+
def test_5src_disclosure_object_has_no_properly_formatted_end_time_if_ended():
285284
sparql = """
286285
PREFIX schema: <http://schema.org/>
287286
PREFIX shp: <https://w3id.org/shp#>
288287
289288
DELETE {
290289
?s schema:endTime ?o .
291290
}
291+
INSERT {
292+
?s schema:endTime "1st Dec '25 @ 10:00:00" .
293+
}
292294
WHERE {
293295
?s schema:additionalType shp:DisclosureCheck ;
294296
schema:actionStatus ?status .
@@ -310,30 +312,31 @@ def test_5src_disclosure_object_has_no_end_time_if_ended():
310312
)
311313

312314

313-
def test_5src_disclosure_object_has_no_properly_formatted_end_time_if_ended():
315+
# ----- MAY fails tests
316+
317+
318+
def test_5src_disclosure_object_has_no_start_time_if_begun():
314319
sparql = """
315320
PREFIX schema: <http://schema.org/>
316321
PREFIX shp: <https://w3id.org/shp#>
317322
318323
DELETE {
319-
?s schema:endTime ?o .
320-
}
321-
INSERT {
322-
?s schema:endTime "1st Dec '25 @ 10:00:00" .
324+
?s schema:startTime ?o .
323325
}
324326
WHERE {
325327
?s schema:additionalType shp:DisclosureCheck ;
326328
schema:actionStatus ?status .
327329
FILTER(?status IN (
328330
"http://schema.org/CompletedActionStatus",
329-
"http://schema.org/FailedActionStatus"
331+
"http://schema.org/FailedActionStatus",
332+
"http://schema.org/ActiveActionStatus"
330333
))
331334
}
332335
"""
333336

334337
do_entity_test(
335338
rocrate_path=ValidROC().five_safes_crate_request,
336-
requirement_severity=Severity.RECOMMENDED,
339+
requirement_severity=Severity.OPTIONAL,
337340
expected_validation_result=False,
338341
expected_triggered_requirements=None,
339342
expected_triggered_issues=None,

0 commit comments

Comments
 (0)