cmem-plugin-validation 1.3.1__tar.gz → 1.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/PKG-INFO +1 -1
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/validate_entities/task.py +28 -26
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/validate_graph/task.py +26 -3
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/pyproject.toml +1 -1
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/LICENSE +0 -0
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/README-public.md +0 -0
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/__init__.py +0 -0
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/validate_entities/__init__.py +0 -0
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/validate_entities/icon.svg +0 -0
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/validate_entities/state.py +0 -0
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/validate_graph/__init__.py +0 -0
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/validate_graph/icon.svg +0 -0
- {cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/validate_graph/state.py +0 -0
|
@@ -39,32 +39,26 @@ The used JSON Schema needs to be provided as a JSON Dataset in the project.
|
|
|
39
39
|
|
|
40
40
|
### Input Modes
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- If the JSON dataset is a JSON array, the schema will validate each object inside the array.
|
|
47
|
-
- If the JSON dataset is a JSON object, it will be validated against the schema directly.
|
|
48
|
-
|
|
49
|
-
Validated data objects can be sent to an output port for further processing in the workflow
|
|
50
|
-
or saved in a JSON dataset in the project.
|
|
42
|
+
Entities arrive on the input port by default. Switching the input mode to a JSON dataset
|
|
43
|
+
removes the input port, and the resources to validate are instead read from a JSON dataset in
|
|
44
|
+
the project. A JSON array in that dataset has each of its objects validated individually; a
|
|
45
|
+
JSON object is validated directly.
|
|
51
46
|
|
|
52
47
|
### Output Modes
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
in the project.
|
|
49
|
+
Valid JSON objects are sent to an output port by default, ready for further processing in the
|
|
50
|
+
workflow. Switching the output mode to a JSON dataset removes the output port, and the valid
|
|
51
|
+
JSON objects are instead saved to a JSON dataset in the project, replacing its existing content.
|
|
58
52
|
|
|
59
53
|
### Error Handling
|
|
60
54
|
|
|
61
|
-
The task can either:
|
|
55
|
+
Every entity or object is validated regardless of the outcome. The task can then either:
|
|
62
56
|
|
|
63
|
-
- Fail
|
|
64
|
-
-
|
|
57
|
+
- Fail once validation completes if any entity has violations, halting the workflow.
|
|
58
|
+
- Report violations only as warnings, allowing follow-up tasks to run based on the
|
|
65
59
|
validated data.
|
|
66
60
|
|
|
67
|
-
The error handling behavior is configurable through the
|
|
61
|
+
The error handling behavior is configurable through the **Fail on violations** parameter.
|
|
68
62
|
"""
|
|
69
63
|
|
|
70
64
|
|
|
@@ -88,9 +82,9 @@ TARGET.dataset = "dataset"
|
|
|
88
82
|
TARGET.options = OrderedDict(
|
|
89
83
|
{
|
|
90
84
|
TARGET.dataset: f"{TARGET.dataset}: "
|
|
91
|
-
"Valid JSON objects
|
|
85
|
+
"Valid JSON objects are saved in a JSON dataset (see advanced options).",
|
|
92
86
|
TARGET.entities: f"{TARGET.entities}: "
|
|
93
|
-
"Valid JSON objects
|
|
87
|
+
"Valid JSON objects are sent as entities to the output port.",
|
|
94
88
|
}
|
|
95
89
|
)
|
|
96
90
|
|
|
@@ -105,21 +99,24 @@ TARGET.options = OrderedDict(
|
|
|
105
99
|
PluginParameter(
|
|
106
100
|
name="source_mode",
|
|
107
101
|
label="Source / Input Mode",
|
|
108
|
-
description=""
|
|
102
|
+
description="Selects where entities to validate come from: the input port or"
|
|
103
|
+
" a JSON dataset.",
|
|
109
104
|
param_type=ChoiceParameterType(SOURCE.options),
|
|
110
105
|
default_value=SOURCE.entities,
|
|
111
106
|
),
|
|
112
107
|
PluginParameter(
|
|
113
108
|
name="target_mode",
|
|
114
109
|
label="Target / Output Mode",
|
|
115
|
-
description=""
|
|
110
|
+
description="Selects where valid JSON objects are written to: the output port"
|
|
111
|
+
" or a JSON dataset.",
|
|
116
112
|
param_type=ChoiceParameterType(TARGET.options),
|
|
117
113
|
default_value=TARGET.entities,
|
|
118
114
|
),
|
|
119
115
|
PluginParameter(
|
|
120
116
|
name="source_dataset",
|
|
121
117
|
label="Source JSON Dataset",
|
|
122
|
-
description="This dataset holds the resources you want to validate."
|
|
118
|
+
description="This dataset holds the resources you want to validate. Required when"
|
|
119
|
+
" Source / Input Mode is set to dataset; leave it empty when using entities.",
|
|
123
120
|
param_type=DatasetParameterType(dataset_type="json"),
|
|
124
121
|
advanced=True,
|
|
125
122
|
default_value="",
|
|
@@ -127,8 +124,9 @@ TARGET.options = OrderedDict(
|
|
|
127
124
|
PluginParameter(
|
|
128
125
|
name="target_dataset",
|
|
129
126
|
label="Target JSON Dataset",
|
|
130
|
-
description="This dataset
|
|
131
|
-
"
|
|
127
|
+
description="This dataset stores the valid JSON objects after validation,"
|
|
128
|
+
" replacing any existing content. Required when Target / Output Mode is set to"
|
|
129
|
+
" dataset; leave it empty when using entities.",
|
|
132
130
|
param_type=DatasetParameterType(dataset_type="json"),
|
|
133
131
|
default_value="",
|
|
134
132
|
advanced=True,
|
|
@@ -142,7 +140,9 @@ TARGET.options = OrderedDict(
|
|
|
142
140
|
PluginParameter(
|
|
143
141
|
name="fail_on_violations",
|
|
144
142
|
label="Fail on violations",
|
|
145
|
-
description="If enabled, the
|
|
143
|
+
description="If enabled, the workflow fails once validation completes if any"
|
|
144
|
+
" entity has violations. All entities are validated either way; disabling this"
|
|
145
|
+
" instead reports the violations as warnings.",
|
|
146
146
|
default_value=DEFAULT_FAIL_ON_VIOLATION,
|
|
147
147
|
),
|
|
148
148
|
],
|
|
@@ -286,7 +286,9 @@ class ValidateEntity(WorkflowPlugin):
|
|
|
286
286
|
Client.from_context(context=context).datasets.post_file_resource(
|
|
287
287
|
project_id=context.task.project_id(),
|
|
288
288
|
dataset_id=self.target_dataset,
|
|
289
|
-
file_resource=io.BytesIO(
|
|
289
|
+
file_resource=io.BytesIO(
|
|
290
|
+
json.dumps(valid_json_objects, ensure_ascii=False).encode("utf-8")
|
|
291
|
+
),
|
|
290
292
|
)
|
|
291
293
|
return None
|
|
292
294
|
|
|
@@ -27,8 +27,24 @@ from httpx import HTTPStatusError
|
|
|
27
27
|
from cmem_plugin_validation.validate_graph.state import State
|
|
28
28
|
|
|
29
29
|
DOCUMENTATION = """
|
|
30
|
-
|
|
31
|
-
according to the node shapes in a shape catalog graph.
|
|
30
|
+
Starts a graph validation process which verifies that resources in a specific graph are valid
|
|
31
|
+
according to the node shapes in a shape catalog graph. The task waits for the validation to
|
|
32
|
+
finish before completing.
|
|
33
|
+
|
|
34
|
+
The task has no input port. Violations found during validation are always summarized in the
|
|
35
|
+
workflow report, and can also be materialized into a result graph in the project. Sending each
|
|
36
|
+
violation as an entity to an output port is optional; when that is disabled, the task has no
|
|
37
|
+
output port either.
|
|
38
|
+
|
|
39
|
+
### Error Handling
|
|
40
|
+
|
|
41
|
+
Every resource is validated regardless of the outcome. The task can then either:
|
|
42
|
+
|
|
43
|
+
- Fail once validation completes if any resource has violations, halting the workflow.
|
|
44
|
+
- Report violations only as warnings, allowing follow-up tasks to run based on the results.
|
|
45
|
+
|
|
46
|
+
The error handling behavior is configurable through the **Fail workflow on violations**
|
|
47
|
+
parameter.
|
|
32
48
|
"""
|
|
33
49
|
|
|
34
50
|
CONTEXT_GRAPH_CLASSES = [
|
|
@@ -92,23 +108,30 @@ WHERE { ?resource a ?class . FILTER isIRI(?resource) }
|
|
|
92
108
|
PluginParameter(
|
|
93
109
|
name="clear_result_graph",
|
|
94
110
|
label="Clear result graph before validation",
|
|
111
|
+
description="If enabled, the existing content of the result graph is deleted"
|
|
112
|
+
" before validation starts. Has no effect when Result graph is left empty.",
|
|
95
113
|
default_value=DEFAULT_CLEAR_RESULT_GRAPH,
|
|
96
114
|
),
|
|
97
115
|
PluginParameter(
|
|
98
116
|
name="fail_on_violations",
|
|
99
117
|
label="Fail workflow on violations",
|
|
118
|
+
description="If enabled, the workflow fails once validation completes if any"
|
|
119
|
+
" resource has violations. All resources are validated either way; disabling this"
|
|
120
|
+
" instead reports the violations as warnings.",
|
|
100
121
|
default_value=DEFAULT_FAIL_ON_VIOLATION,
|
|
101
122
|
),
|
|
102
123
|
PluginParameter(
|
|
103
124
|
name="output_results",
|
|
104
125
|
label="Output violations as entities",
|
|
126
|
+
description="If enabled, each violation is sent as an entity to an output port"
|
|
127
|
+
" for further processing in the workflow. Disabling this removes the output port.",
|
|
105
128
|
default_value=DEFAULT_OUTPUT_RESULTS,
|
|
106
129
|
),
|
|
107
130
|
PluginParameter(
|
|
108
131
|
name="sparql_query",
|
|
109
132
|
label="Resource Selection Query",
|
|
110
133
|
description="The query to select the resources to validate. "
|
|
111
|
-
"Use {{context_graph}} as a placeholder for the
|
|
134
|
+
"Use `{{context_graph}}` as a placeholder for the selected Context Graph.",
|
|
112
135
|
default_value=DEFAULT_SPARQL_QUERY,
|
|
113
136
|
advanced=True,
|
|
114
137
|
),
|
|
File without changes
|
|
File without changes
|
{cmem_plugin_validation-1.3.1 → cmem_plugin_validation-1.3.2}/cmem_plugin_validation/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|