cmem_client.models.validation¤
Validation models for SHACL batch validation processes.
A batch validation checks the resources of a context graph against the shapes of a
shape graph and reports where they violate them. client.validations starts such a
process and holds the running and finished ones, keyed by their batch ID. The
aggregation is the summary a repository lists, while the result carries every single
violation; note that client.validations does not fetch on creation, so call
fetch_data() before iterating it.
Classes:
- ValidationAggregation – Summary view of a batch validation process.
- ValidationConstraintTemplate – Constraint message template from a validation violation.
- ValidationResourceResult – Violations found for a single validated resource.
- ValidationResult – Full result of a completed batch validation process.
- ValidationViolation – A single SHACL violation found during validation.
- ValidationViolationMessage – A single message attached to a validation violation.
Attributes:
STATUS_CANCELLED¤
STATUS_ERROR¤
STATUS_FINISHED¤
STATUS_RUNNING¤
STATUS_SCHEDULED¤
ValidationAggregation¤
Bases: Model, ReadRepositoryItem
Summary view of a batch validation process.
Attributes:
- id (
str) – ID of the batch. This is the key of the repository. - state (
str) – What the batch is doing, one ofSCHEDULED,RUNNING,FINISHED,CANCELLEDorERROR. - context_graph_iri (
str) – IRI of the graph whose resources are validated. - shape_graph_iri (
str) – IRI of the graph holding the shapes. - execution_started (
int | None) – When the validation started, as a Unix timestamp in milliseconds, orNonewhile it is still scheduled. - execution_finished (
int | None) – When it finished, orNonewhile it is still running. - resource_count (
int) – How many resources the batch covers. - resource_processed_count (
int) – How many of them are done. Compare withresource_countto follow the progress of a running batch. - resources_with_violations_count (
int) – How many resources violated at least one shape. - violations_count (
int) – How many violations were found in total. - error (
str | None) – Why the batch failed, set only in stateERROR.
Functions:
- get_id – Get the batch validation process ID.
context_graph_iri¤
error¤
execution_finished¤
execution_started¤
get_id¤
Get the batch validation process ID.
id¤
model_config¤
resource_count¤
resource_processed_count¤
resources_with_violations_count¤
shape_graph_iri¤
state¤
violations_count¤
ValidationConstraintTemplate¤
Bases: Model
Constraint message template from a validation violation.
Attributes:
- constraint_name (
str) – Name of the SHACL constraint which was violated, e.g.MinCountConstraintComponent.
constraint_name¤
model_config¤
ValidationResourceResult¤
Bases: Model
Violations found for a single validated resource.
Attributes:
- resource_iri (
str) – IRI of the validated resource. - node_shapes (
list[str]) – IRIs of the node shapes the resource was checked against. - violations (
list[ValidationViolation]) – The violations found on this resource.
model_config¤
node_shapes¤
resource_iri¤
violations¤
ValidationResult¤
Bases: Model
Full result of a completed batch validation process.
Attributes:
- id (
str) – ID of the batch this result belongs to. - context_graph_iri (
str) – IRI of the graph whose resources were validated. - shape_graph_iri (
str) – IRI of the graph holding the shapes they were checked against. - execution_started (
int | None) – When the validation started, as a Unix timestamp in milliseconds, orNonewhile it is still scheduled. - execution_finished (
int | None) – When it finished, as a Unix timestamp in milliseconds, orNonewhile it is still running. The endpoint returns a result for a batch which has not finished yet, and leaves the field out then. - resources (
list[str]) – IRIs of every validated resource, including those without a violation. - results (
list[ValidationResourceResult]) – The per-resource violations. Resources which passed are not listed.
context_graph_iri¤
execution_finished¤
execution_started¤
id¤
model_config¤
resources¤
results¤
shape_graph_iri¤
ValidationViolation¤
Bases: Model
A single SHACL violation found during validation.
Attributes:
- report_entry_constraint_message_template (
ValidationConstraintTemplate) – The violated constraint. - path (
str | None) – IRI of the property the violation was found on, orNonefor a violation which concerns the resource as a whole. - source (
str | None) – IRI of the shape which raised the violation. - messages (
list[ValidationViolationMessage]) – Human readable messages of the violation, one per language. - severity (
str | None) – Severity declared by the shape, e.g.ViolationorWarning.
messages¤
model_config¤
path¤
report_entry_constraint_message_template¤
report_entry_constraint_message_template: ValidationConstraintTemplate = Field(alias='reportEntryConstraintMessageTemplate')
severity¤
source¤
ValidationViolationMessage¤
Bases: Model
A single message attached to a validation violation.
Attributes:
- value (
str) – Text of the message. - lang (
str) – Language tag of the message, empty if it carries none.