feat(pipeline-shacl-validator): add conformanceDisallows severity set#564
Merged
Conversation
390b61b to
ac8b2e6
Compare
- Add a conformanceDisallows option implementing the SHACL 1.2 conformance-disallow set: a result fails validation only if its severity IRI is in the set, with custom severities supported - Default to the SHACL 1.2 default set (Violation, Warning, Info), preserving existing behaviour when the option is absent - Compute conforms and violations from result severities instead of report.conforms, which hardcodes the default set in shacl-engine - Stream reports to writers whenever there are results, so below-threshold results such as warnings stay visible to consumers - Amend written reports with sh:conformanceDisallows triples and a recomputed sh:conforms when the option is set, as forward support for SHACL 1.2 ahead of engine support - Export severity constants for the three SHACL Core levels
ac8b2e6 to
50a5723
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional
conformanceDisallowssetting toShaclValidator, implementing the SHACL 1.2 conformance-disallow set: the set of severity IRIs whose presence among validation results makes validation fail.Why
shacl-engine’sreport.conformshardcodes the SHACL 1.2 default set – anysh:Violation,sh:Warningorsh:Inforesult fails validation. Consumers such as the Dataset Knowledge Graph want warnings to be advisory (SHOULD-level findings, including requirements staged viande:futureChange), matching the Dataset Register’s violation-only semantics – see netwerk-digitaal-erfgoed/dataset-knowledge-graph#411. Other users do want warnings to fail validation, so the default is unchanged.SHACL 1.2 models this as a set of disallowed severities rather than a “minimum severity”, since severities (including custom ones) have no normative ordering – an ordered threshold was explicitly rejected in w3c/data-shapes#453. The spec sanctions this option: “The conformance-disallow set is defined by the validation engine. A validation engine MAY provide mechanisms to customize this set.”
What
conformanceDisallows?: readonly string[]onShaclValidatorOptions; defaults to the SHACL 1.2 default set (sh:Violation,sh:Warning,sh:Info), preserving existing behaviour. Custom severity IRIs are supported.conformsandviolationsare computed from result severities against the set, instead of readingreport.conforms(also fixingviolationscounting results the engine did not treat as non-conforming).reportWriterswhenever there are results – below-threshold results (e.g. warnings) stay visible to consumers even when the dataset conforms.sh:conformanceDisallowstriples and ansh:conformsrecomputed against the set, keeping stored reports self-describing.severityconstant with the three SHACL Core level IRIs.