diff --git a/shacl12-core/index.html b/shacl12-core/index.html index d0aa6e18..23723d9f 100644 --- a/shacl12-core/index.html +++ b/shacl12-core/index.html @@ -1815,10 +1815,6 @@

Declaring the Severity of a Shape or Constraint

A constraint violation. -

- Validation engines MAY treat sh:Info and sh:Warning as non-violating based on - options passed to the engine. By default, they are treated as violations. -

In addition to declaring severities per shape, the property sh:severity can also be used on a reifier for a triple where the shape is the subject and one of the parameters @@ -1832,8 +1828,8 @@

Declaring the Severity of a Shape or Constraint

The remainder of this section is informative.

- The specific values of sh:severity have no impact on the validation, - but MAY be used by user interface tools to categorize validation results. + The validation process handles the values of sh:severity according to conformance checking. + Additionally, user interface tools MAY use the values to categorize validation results. The values of sh:severity are used by SHACL processors to populate the sh:resultSeverity field of validation results, see section on severity in validation results. Any IRI can be used as a severity. @@ -2897,9 +2893,15 @@

Handling of Recursive Shapes

Conformance Checking

A focus node conforms to a shape if and only if - the set of result of the validation of the focus node against the shape does not contain any results with a severity level representing a violation and no failure + the set of result of the validation of the focus node against the shape does not contain any validation results with a severity level of the set of disallowed levels and no failure has been reported by it.

+

+ The set of disallowed severity levels is defined as the objects of triples with predicate + sh:conformanceDisallows and the validation report as subject. + If the validation report contains no such triples, sh:Violation, sh:Warning, and + sh:Info are set as defaults. +

Conformance checking produces true if and only if a given focus node conforms to a given shape, and false otherwise. @@ -2934,15 +2936,48 @@

Validation Report

[ a sh:ValidationReport ; sh:conforms true ; + sh:conformanceDisallows sh:Violation ; + sh:result [ + a sh:ValidationResult ; + sh:resultSeverity sh:Warning ; + sh:focusNode ex:Bob ; + sh:resultPath ex:age ; + sh:value "twenty two" ; + sh:resultMessage "ex:age expects a literal of datatype xsd:integer." ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape ex:PersonShape-age ; + ] ] .
{
-	"@id": "_:b1",
 	"@type": "sh:ValidationReport",
+	"sh:conformanceDisallows": {
+		"@id": "sh:Violation"
+	},
 	"sh:conforms": {
 		"@type": "xsd:boolean",
 		"@value": "true"
+	},
+	"sh:result": {
+		"@type": "sh:ValidationResult",
+		"sh:focusNode": {
+			"@id": "ex:Bob"
+		},
+		"sh:resultMessage": "ex:age expects a literal of datatype xsd:integer.",
+		"sh:resultPath": {
+			"@id": "ex:age"
+		},
+		"sh:resultSeverity": {
+			"@id": "sh:Warning"
+		},
+		"sh:sourceConstraintComponent": {
+			"@id": "sh:DatatypeConstraintComponent"
+		},
+		"sh:sourceShape": {
+			"@id": "ex:PersonShape-age"
+		},
+		"sh:value": "twenty two"
 	}
 }
@@ -2957,6 +2992,7 @@

Validation Report

[ a sh:ValidationReport ; sh:conforms false ; + sh:conformanceDisallows sh:Violation ; sh:result [ a sh:ValidationResult ; sh:resultSeverity sh:Violation ; @@ -2972,6 +3008,9 @@

Validation Report

{
 	"@type": "sh:ValidationReport",
+	"sh:conformanceDisallows": {
+		"@id": "sh:Violation"
+	},
 	"sh:conforms": {
 		"@type": "xsd:boolean",
 		"@value": "false"
@@ -3012,7 +3051,28 @@ 
Conforms (sh:conforms)

Each SHACL instance of sh:ValidationReport in the results graph has exactly one value for the property sh:conforms and the value is of datatype xsd:boolean. It represents the outcome of the conformance checking. - The value of sh:conforms is true if and only if the validation did not produce any validation results with a severity level representing a violation, and false otherwise. +

+ +
+
Conformance-Disallow Set (`sh:conformanceDisallows`)
+

+ Each SHACL instance of sh:ValidationReport in the results graph MAY have one or more values + for the property sh:conformanceDisallows. All values of sh:conformanceDisallows MUST be IRIs. +

+

+ All values combined define the set of disallowed + severity levels. Presence of any sh:ValidationResult with a severity level in the set of + disallowed severity levels MUST result in a sh:conforms value + of false on the associated sh:ValidationReport instance. +

+

+ If no values are present in the results graph for the property + sh:conformanceDisallows, then a default set MUST be used, comprised of + sh:Violation, sh:Warning, and sh:Info. +

+

+ The conformance-disallow set is defined by the validation engine. + A validation engine MAY provide mechanisms to customize this set.

@@ -7762,6 +7822,7 @@

Changes between SHACL 1.0 Core and SHACL 1.2 Core

  • Added the new constraint component sh:ReifierShape; see Issue 300
  • Added parameter to look up rdfs:subClassOf triples in the union of the shapes graph and the data graph; see Issue 185
  • Generalized to also allow xsd:integers; see Issue 479
  • +
  • Added new sh:conformanceDisallows property to the validation report; see Issue 453
  • diff --git a/shacl12-test-suite/tests/core/validation-reports/conformance-disallows-001.ttl b/shacl12-test-suite/tests/core/validation-reports/conformance-disallows-001.ttl new file mode 100644 index 00000000..4f1924d0 --- /dev/null +++ b/shacl12-test-suite/tests/core/validation-reports/conformance-disallows-001.ttl @@ -0,0 +1,56 @@ +@prefix ex: . +@prefix mf: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix sht: . +@prefix xsd: . + +ex:PersonShape + rdf:type sh:NodeShape ; + sh:property ex:PersonShape-age ; + sh:targetNode ex:Person ; +. +ex:PersonShape-age + rdf:type sh:PropertyShape ; + sh:path ex:age ; + sh:severity sh:Warning ; + sh:datatype xsd:integer ; +. +ex:Bob + rdf:type ex:Person ; + ex:age "twenty two" ; +. +<> + rdf:type mf:Manifest ; + mf:entries ( + + ) ; +. + + rdf:type sht:Validate ; + rdfs:label "Test of path sh:conformanceDisallows 001" ; + rdfs:comment "conformanceDisallows presence lets sh:conforms be true despite presence of an sh:Warning-severity result. Test contents and behavior otherwise match conformance-disallows-002."@en ; + rdfs:seeAlso ; + mf:action [ + sht:dataGraph <> ; + sht:shapesGraph <> ; + ] ; + mf:result [ + rdf:type sh:ValidationReport ; + sh:conforms "true"^^xsd:boolean ; + sh:conformanceDisallows sh:Violation ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:resultSeverity sh:Warning ; + sh:focusNode ex:Bob ; + sh:resultPath ex:age ; + sh:value "twenty two" ; + sh:resultMessage "ex:age expects a literal of datatype xsd:integer." ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape ex:PersonShape-age ; + ] + ] ; + mf:status sht:approved ; +. diff --git a/shacl12-test-suite/tests/core/validation-reports/conformance-disallows-002.ttl b/shacl12-test-suite/tests/core/validation-reports/conformance-disallows-002.ttl new file mode 100644 index 00000000..2afb8a0f --- /dev/null +++ b/shacl12-test-suite/tests/core/validation-reports/conformance-disallows-002.ttl @@ -0,0 +1,55 @@ +@prefix ex: . +@prefix mf: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix sht: . +@prefix xsd: . + +ex:PersonShape + rdf:type sh:NodeShape ; + sh:property ex:PersonShape-age ; + sh:targetNode ex:Person ; +. +ex:PersonShape-age + rdf:type sh:PropertyShape ; + sh:path ex:age ; + sh:severity sh:Warning ; + sh:datatype xsd:integer ; +. +ex:Bob + rdf:type ex:Person ; + ex:age "twenty two" ; +. +<> + rdf:type mf:Manifest ; + mf:entries ( + + ) ; +. + + rdf:type sht:Validate ; + rdfs:label "Test of path sh:conformanceDisallows 002" ; + rdfs:comment "conformanceDisallows absence causes sh:conforms be false due to presence of an sh:Warning-severity result. Test contents and behavior otherwise match conformance-disallows-001."@en ; + rdfs:seeAlso ; + mf:action [ + sht:dataGraph <> ; + sht:shapesGraph <> ; + ] ; + mf:result [ + rdf:type sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:resultSeverity sh:Warning ; + sh:focusNode ex:Bob ; + sh:resultPath ex:age ; + sh:value "twenty two" ; + sh:resultMessage "ex:age expects a literal of datatype xsd:integer." ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape ex:PersonShape-age ; + ] + ] ; + mf:status sht:approved ; +. diff --git a/shacl12-test-suite/tests/core/validation-reports/manifest.ttl b/shacl12-test-suite/tests/core/validation-reports/manifest.ttl index b200ca17..e1598875 100644 --- a/shacl12-test-suite/tests/core/validation-reports/manifest.ttl +++ b/shacl12-test-suite/tests/core/validation-reports/manifest.ttl @@ -5,5 +5,7 @@ <> a mf:Manifest ; rdfs:label "Tests for validation reports" ; + mf:include ; + mf:include ; mf:include ; . diff --git a/shacl12-vocabularies/shacl.ttl b/shacl12-vocabularies/shacl.ttl index 44bdd2f7..008dc594 100644 --- a/shacl12-vocabularies/shacl.ttl +++ b/shacl12-vocabularies/shacl.ttl @@ -189,6 +189,14 @@ sh:conforms rdfs:range xsd:boolean ; rdfs:isDefinedBy sh: . +sh:conformanceDisallows + a rdf:Property ; + rdfs:label "conformance disallows"@en ; + rdfs:comment "Severity levels that are evaluated in the conformance check."@en ; + rdfs:domain sh:ValidationReport ; + rdfs:range sh:Severity ; + rdfs:isDefinedBy sh: . + sh:result a rdf:Property ; rdfs:label "result"@en ;