Skip to content

Commit f55c2af

Browse files
committed
Fixed issues due to malformatted strings
1 parent 765296a commit f55c2af

File tree

4 files changed

+115
-54
lines changed

4 files changed

+115
-54
lines changed

rocrate_validator/profiles/five-safes-crate/may/11_workflow_execution_phase.ttl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
five-safes-crate:WorkflowexecutionObjectHasStartTimeIfBegun
2626
a sh:NodeShape ;
2727
sh:name "WorkflowExecution" ;
28-
sh:description "The workflow execution object MAY have a startTime if execution was initiated." ;
28+
sh:description (
29+
"The workflow execution object MAY have a startTime if actionStatus is "
30+
"either ActiveActionStatus, CompletedActionStatus or FailedActionStatus."
31+
) ;
2932

3033
sh:target [
3134
a sh:SPARQLTarget ;
@@ -53,6 +56,12 @@ five-safes-crate:WorkflowexecutionObjectHasStartTimeIfBegun
5356
sh:minCount 1 ;
5457
sh:maxCount 1 ;
5558
sh:severity sh:Info ;
56-
sh:description "The workflow execution object MAY have a startTime if execution was initiated." ;
57-
sh:message "The workflow execution object MAY have a startTime if execution was initiated." ;
59+
sh:description (
60+
"The workflow execution object MAY have a startTime if actionStatus is "
61+
"either ActiveActionStatus, CompletedActionStatus or FailedActionStatus."
62+
) ;
63+
sh:message (
64+
"The workflow execution object MAY have a startTime if actionStatus is "
65+
"either ActiveActionStatus, CompletedActionStatus or FailedActionStatus."
66+
) ;
5867
] .

rocrate_validator/profiles/five-safes-crate/may/14_workflow_retrieval_phase.ttl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,25 @@ five-safes-crate:DownloadedWorkflowSHOULDExistAndBeReferencedByDownloadActionRes
5454
}
5555
""" ;
5656
sh:severity sh:Info ;
57-
sh:message ("The entity representing the downloaded workflow is not defined, "
58-
"OR is not referenced by `DownloadAction` --> `result`, "
59-
"OR is not of type `schema:Dataset`."
60-
) ;
57+
sh:message "The entity representing the downloaded workflow is not defined, OR is not referenced by `DownloadAction` --> `result`, OR is not of type `schema:Dataset`." ;
6158
] ;
6259
] .
6360

6461

6562
five-safes-crate:DownloadActionMayHaveStartTimeIfBegun
6663
a sh:NodeShape ;
6764
sh:name "DownloadAction" ;
68-
sh:description "" ;
65+
sh:description (
66+
"`DownloadAction` MAY have the `startTime` property if `actionStatus` "
67+
"is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus."
68+
);
69+
6970
sh:target [
7071
a sh:SPARQLTarget ;
7172
sh:select """
7273
PREFIX schema: <http://schema.org/>
7374
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
75+
7476
SELECT ?this
7577
WHERE {
7678
?this rdf:type schema:DownloadAction ;
@@ -91,5 +93,9 @@ five-safes-crate:DownloadActionMayHaveStartTimeIfBegun
9193
sh:minCount 1 ;
9294
sh:maxCount 1 ;
9395
sh:severity sh:Info ;
96+
sh:description (
97+
"`DownloadAction` MAY have the `startTime` property if `actionStatus` "
98+
"is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus."
99+
);
94100
sh:message "`DownloadAction` MAY have the `startTime` property if `actionStatus` is either ActiveActionStatus, CompletedActionStatus or FailedActionStatus." ;
95101
] .

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

Lines changed: 87 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727

2828
def test_5src_workflow_object_with_no_name():
29-
3029
sparql = (
31-
SPARQL_PREFIXES + """
30+
SPARQL_PREFIXES
31+
+ """
3232
DELETE {
3333
?this schema:name ?name .
3434
}
@@ -37,21 +37,26 @@ def test_5src_workflow_object_with_no_name():
3737
schema:name ?name .
3838
<./> schema:mentions ?this .
3939
}
40-
""")
40+
"""
41+
)
4142

4243
do_entity_test(
4344
rocrate_path=ValidROC().five_safes_crate_result,
4445
requirement_severity=Severity.REQUIRED,
4546
expected_validation_result=False,
4647
expected_triggered_requirements=["WorkflowExecution"],
47-
expected_triggered_issues=["Workflow (CreateAction) MUST have a name string of at least 10 characters."],
48+
expected_triggered_issues=[
49+
"Workflow (CreateAction) MUST have a name string of at least 10 characters."
50+
],
4851
profile_identifier="five-safes-crate",
4952
rocrate_entity_mod_sparql=sparql,
5053
)
5154

5255

5356
def test_5src_workflow_object_with_name_not_string():
54-
sparql = (SPARQL_PREFIXES + """
57+
sparql = (
58+
SPARQL_PREFIXES
59+
+ """
5560
DELETE {
5661
?this schema:name ?name .
5762
}
@@ -63,21 +68,26 @@ def test_5src_workflow_object_with_name_not_string():
6368
schema:name ?name .
6469
<./> schema:mentions ?this .
6570
}
66-
""")
71+
"""
72+
)
6773

6874
do_entity_test(
6975
rocrate_path=ValidROC().five_safes_crate_result,
7076
requirement_severity=Severity.REQUIRED,
7177
expected_validation_result=False,
7278
expected_triggered_requirements=["WorkflowExecution"],
73-
expected_triggered_issues=["Workflow (CreateAction) MUST have a name string of at least 10 characters."],
79+
expected_triggered_issues=[
80+
"Workflow (CreateAction) MUST have a name string of at least 10 characters."
81+
],
7482
profile_identifier="five-safes-crate",
7583
rocrate_entity_mod_sparql=sparql,
7684
)
7785

7886

7987
def test_5src_workflow_object_with_not_long_enough_name():
80-
sparql = (SPARQL_PREFIXES + """
88+
sparql = (
89+
SPARQL_PREFIXES
90+
+ """
8191
DELETE {
8292
?this schema:name ?name .
8393
}
@@ -89,21 +99,26 @@ def test_5src_workflow_object_with_not_long_enough_name():
8999
schema:name ?name .
90100
<./> schema:mentions ?this .
91101
}
92-
""")
102+
"""
103+
)
93104

94105
do_entity_test(
95106
rocrate_path=ValidROC().five_safes_crate_result,
96107
requirement_severity=Severity.REQUIRED,
97108
expected_validation_result=False,
98109
expected_triggered_requirements=["WorkflowExecution"],
99-
expected_triggered_issues=["Workflow (CreateAction) MUST have a name string of at least 10 characters."],
110+
expected_triggered_issues=[
111+
"Workflow (CreateAction) MUST have a name string of at least 10 characters."
112+
],
100113
profile_identifier="five-safes-crate",
101114
rocrate_entity_mod_sparql=sparql,
102115
)
103116

104117

105118
def test_5src_workflow_object_has_no_properly_formatted_start_time():
106-
sparql = (SPARQL_PREFIXES + """
119+
sparql = (
120+
SPARQL_PREFIXES
121+
+ """
107122
DELETE {
108123
?s schema:startTime ?time .
109124
}
@@ -114,24 +129,29 @@ def test_5src_workflow_object_has_no_properly_formatted_start_time():
114129
?s rdf:type schema:CreateAction ;
115130
schema:startTime ?time .
116131
}
117-
""")
132+
"""
133+
)
118134

119135
do_entity_test(
120136
rocrate_path=ValidROC().five_safes_crate_result,
121137
requirement_severity=Severity.REQUIRED,
122138
expected_validation_result=False,
123139
expected_triggered_requirements=["WorkflowExecution"],
124-
expected_triggered_issues=[(
125-
"The startTime of the workflow execution object MUST follow the RFC 3339 standard "
126-
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
127-
)],
140+
expected_triggered_issues=[
141+
(
142+
"The startTime of the workflow execution object MUST follow the RFC 3339 standard "
143+
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
144+
)
145+
],
128146
profile_identifier="five-safes-crate",
129147
rocrate_entity_mod_sparql=sparql,
130148
)
131149

132150

133151
def test_5src_workflow_object_has_no_properly_formatted_end_time():
134-
sparql = (SPARQL_PREFIXES + """
152+
sparql = (
153+
SPARQL_PREFIXES
154+
+ """
135155
DELETE {
136156
?s schema:endTime ?time .
137157
}
@@ -142,49 +162,59 @@ def test_5src_workflow_object_has_no_properly_formatted_end_time():
142162
?s rdf:type schema:CreateAction ;
143163
schema:endTime ?time .
144164
}
145-
""")
165+
"""
166+
)
146167

147168
do_entity_test(
148169
rocrate_path=ValidROC().five_safes_crate_result,
149170
requirement_severity=Severity.REQUIRED,
150171
expected_validation_result=False,
151172
expected_triggered_requirements=["WorkflowExecution"],
152-
expected_triggered_issues=[(
153-
"The endTime of the workflow execution object MUST follow the RFC 3339 standard "
154-
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
155-
)],
173+
expected_triggered_issues=[
174+
(
175+
"The endTime of the workflow execution object MUST follow the RFC 3339 standard "
176+
"(YYYY-MM-DD'T'hh:mm:ss[.fraction](Z | ±hh:mm))."
177+
)
178+
],
156179
profile_identifier="five-safes-crate",
157180
rocrate_entity_mod_sparql=sparql,
158181
)
159182

160183

161184
def test_5src_workflow_object_with_no_action_status():
162-
sparql = (SPARQL_PREFIXES + """
185+
sparql = (
186+
SPARQL_PREFIXES
187+
+ """
163188
DELETE {
164189
?this schema:actionStatus ?o .
165190
}
166191
WHERE {
167192
?this schema:actionStatus ?o ;
168193
rdf:type schema:CreateAction .
169194
}
170-
""")
195+
"""
196+
)
171197

172198
do_entity_test(
173199
rocrate_path=ValidROC().five_safes_crate_result,
174200
requirement_severity=Severity.REQUIRED,
175201
expected_validation_result=False,
176202
expected_triggered_requirements=["WorkflowExecution"],
177-
expected_triggered_issues=[(
178-
"WorkflowExecution MUST have an actionStatus "
179-
"with an allowed value (see https://schema.org/ActionStatusType)."
180-
)],
203+
expected_triggered_issues=[
204+
(
205+
"WorkflowExecution MUST have an actionStatus "
206+
"with an allowed value (see https://schema.org/ActionStatusType)."
207+
)
208+
],
181209
profile_identifier="five-safes-crate",
182210
rocrate_entity_mod_sparql=sparql,
183211
)
184212

185213

186214
def test_5src_workflow_object_with_no_properly_valued_action_status():
187-
sparql = (SPARQL_PREFIXES + """
215+
sparql = (
216+
SPARQL_PREFIXES
217+
+ """
188218
DELETE {
189219
?this schema:actionStatus ?o .
190220
}
@@ -195,17 +225,20 @@ def test_5src_workflow_object_with_no_properly_valued_action_status():
195225
?this schema:actionStatus ?o ;
196226
rdf:type schema:CreateAction .
197227
}
198-
""")
228+
"""
229+
)
199230

200231
do_entity_test(
201232
rocrate_path=ValidROC().five_safes_crate_result,
202233
requirement_severity=Severity.REQUIRED,
203234
expected_validation_result=False,
204235
expected_triggered_requirements=["WorkflowExecution"],
205-
expected_triggered_issues=[(
206-
"WorkflowExecution MUST have an actionStatus "
207-
"with an allowed value (see https://schema.org/ActionStatusType)."
208-
)],
236+
expected_triggered_issues=[
237+
(
238+
"WorkflowExecution MUST have an actionStatus "
239+
"with an allowed value (see https://schema.org/ActionStatusType)."
240+
)
241+
],
209242
profile_identifier="five-safes-crate",
210243
rocrate_entity_mod_sparql=sparql,
211244
)
@@ -215,14 +248,17 @@ def test_5src_workflow_object_with_no_properly_valued_action_status():
215248

216249

217250
def test_5src_workflow_object_not_mentioned_by_root_data_entity():
218-
sparql = (SPARQL_PREFIXES + """
251+
sparql = (
252+
SPARQL_PREFIXES
253+
+ """
219254
DELETE {
220255
<./> schema:mentions ?o .
221256
}
222257
WHERE {
223258
?o rdf:type schema:CreateAction .
224259
}
225-
""")
260+
"""
261+
)
226262

227263
do_entity_test(
228264
rocrate_path=ValidROC().five_safes_crate_result,
@@ -238,15 +274,18 @@ def test_5src_workflow_object_not_mentioned_by_root_data_entity():
238274

239275

240276
def test_5src_workflow_object_has_no_end_time_if_ended():
241-
sparql = (SPARQL_PREFIXES + """
277+
sparql = (
278+
SPARQL_PREFIXES
279+
+ """
242280
DELETE {
243281
?s schema:endTime ?time .
244282
}
245283
WHERE {
246284
?s rdf:type schema:CreateAction ;
247285
schema:endTime ?time .
248286
}
249-
""")
287+
"""
288+
)
250289

251290
do_entity_test(
252291
rocrate_path=ValidROC().five_safes_crate_result,
@@ -265,23 +304,29 @@ def test_5src_workflow_object_has_no_end_time_if_ended():
265304

266305

267306
def test_5src_workflow_object_has_no_start_time_if_begun():
268-
sparql = (SPARQL_PREFIXES + """
307+
sparql = (
308+
SPARQL_PREFIXES
309+
+ """
269310
DELETE {
270311
?s schema:startTime ?time .
271312
}
272313
WHERE {
273314
?s rdf:type schema:CreateAction;
274-
schema:startTime ?time
315+
schema:startTime ?time .
275316
}
276-
""")
317+
"""
318+
)
277319

278320
do_entity_test(
279321
rocrate_path=ValidROC().five_safes_crate_result,
280322
requirement_severity=Severity.OPTIONAL,
281323
expected_validation_result=False,
282324
expected_triggered_requirements=["WorkflowExecution"],
283325
expected_triggered_issues=[
284-
"The workflow execution object MAY have a startTime if execution was initiated."
326+
(
327+
"The workflow execution object MAY have a startTime if actionStatus is "
328+
"either ActiveActionStatus, CompletedActionStatus or FailedActionStatus."
329+
)
285330
],
286331
profile_identifier="five-safes-crate",
287332
rocrate_entity_mod_sparql=sparql,

0 commit comments

Comments
 (0)