Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 66 additions & 9 deletions shacl12-core/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1815,10 +1815,6 @@ <h4>Declaring the Severity of a Shape or Constraint</h4>
<td>A constraint violation.</td>
</tr>
</tbody></table>
<p>
Validation engines MAY treat <code>sh:Info</code> and <code>sh:Warning</code> as non-violating based on
options passed to the engine. By default, they are treated as violations.
</p>
<p>
In addition to declaring severities per shape, the property <code>sh:severity</code> can also be used
on a <a>reifier</a> for a triple where the <a>shape</a> is the <a>subject</a> and one of the <a>parameters</a>
Expand All @@ -1832,8 +1828,8 @@ <h4>Declaring the Severity of a Shape or Constraint</h4>
</span></p>
<p><em>The remainder of this section is informative.</em></p>
<p>
The specific values of <code>sh:severity</code> 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 <code>sh:severity</code> according to <a>conformance checking</a>.
Additionally, user interface tools MAY use the values to categorize validation results.
The values of <code>sh:severity</code> are used by SHACL processors to populate the <code>sh:resultSeverity</code> field of
validation results, see <a href="#results-severity">section on severity in validation results</a>.
Any IRI can be used as a severity.
Expand Down Expand Up @@ -2897,9 +2893,15 @@ <h4>Handling of Recursive Shapes</h4>
<h3>Conformance Checking</h3>
<p>
A <a>focus node</a> <dfn data-lt="conform|conformance">conforms</dfn> to a <a>shape</a> if and only if
the set of result of the <a>validation</a> of the <a>focus node</a> against the <a>shape</a> does not contain any results with a severity level representing a violation and no <a>failure</a>
the set of result of the <a>validation</a> of the <a>focus node</a> against the <a>shape</a> does not contain any <a>validation results</a> with a severity level of the set of disallowed levels and no <a>failure</a>
has been reported by it.
</p>
<p>
The set of disallowed severity levels is defined as the objects of triples with predicate
<code>sh:conformanceDisallows</code> and the <a>validation report</a> as subject.
If the validation report contains no such triples, <code>sh:Violation</code>, <code>sh:Warning</code>, and
<code>sh:Info</code> are set as defaults.
</p>
<p>
<dfn data-lt="conformance check">Conformance checking</dfn> produces <code>true</code> if and only if a given <a>focus node</a>
<a>conforms</a> to a given <a>shape</a>, and <code>false</code> otherwise.
Expand Down Expand Up @@ -2934,15 +2936,48 @@ <h3>Validation Report</h3>
<div class="turtle">
[ 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 ;
]
] .
</div>
<div class="jsonld">
<pre class="jsonld">{
"@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"
}
}</pre>
</div>
Expand All @@ -2957,6 +2992,7 @@ <h3>Validation Report</h3>
<div class="turtle">
[ a sh:ValidationReport ;
sh:conforms false ;
sh:conformanceDisallows sh:Violation ;
sh:result [
a sh:ValidationResult ;
sh:resultSeverity sh:Violation ;
Expand All @@ -2972,6 +3008,9 @@ <h3>Validation Report</h3>
<div class="jsonld">
<pre class="jsonld">{
"@type": "sh:ValidationReport",
"sh:conformanceDisallows": {
"@id": "sh:Violation"
},
"sh:conforms": {
"@type": "xsd:boolean",
"@value": "false"
Expand Down Expand Up @@ -3012,7 +3051,24 @@ <h5>Conforms (sh:conforms)</h5>
<p>
Each SHACL instance of <code>sh:ValidationReport</code> in the results graph has exactly one value for the property <code>sh:conforms</code> and the value is of datatype <code>xsd:boolean</code>.
It represents the outcome of the <a>conformance checking</a>.
The value of <code>sh:conforms</code> is <code>true</code> if and only if the <a>validation</a> did not produce any <a>validation results</a> with a severity level representing a violation, and <code>false</code> otherwise.
</p>
</section>
<section id="conformanceDisallows">
<h5>Conformance-Disallow Set (sh:conformanceDisallows)</h5>
<p>
Each SHACL instance of <code>sh:ValidationReport</code> in the results graph MAY have one or more values
for the property <code>sh:conformanceDisallows</code>. All values of <code>sh:conformanceDisallows</code> MUST be IRIs.
</p>
<p>
All values combined define the set of disallowed
severity levels. Presence of any <code>sh:ValidationResult</code> with a severity level in the set of disallowed severity levels MUST result in a <code>sh:conforms</code> value of <code>false</code> on the associated <code>sh:ValidationReport</code> instance.
</p>
<p>
If no values are present in the results graph for the property <code>sh:conformanceDisallows</code>, then a default set MUST be used, comprised of <code>sh:Violation</code>, <code>sh:Warning</code>, and <code>sh:Info</code>.
</p>
<p>
The conformance-disallow set is defined by the validation engine.
A validation engine MAY provide mechanisms to customize this set.
</p>
</section>
<section id="result">
Expand Down Expand Up @@ -7762,6 +7818,7 @@ <h2>Changes between SHACL 1.0 Core and SHACL 1.2 Core</h2>
<li>Added the new constraint component <a href="#ReifierShapeShapeConstraintComponent"><code>sh:ReifierShape</code></a>; see <a href="https://github.com/w3c/data-shapes/issues/300">Issue 300</a></li>
<li>Added parameter <a href="#subClassOfInShapesGraph"></a> to look up rdfs:subClassOf triples in the union of the shapes graph and the data graph; see <a href="https://github.com/w3c/data-shapes/issues/185">Issue 185</a></li>
<li>Generalized <a href="#order"></a> to also allow xsd:integers; see <a href="https://github.com/w3c/data-shapes/issues/479">Issue 479</a></li>
<li>Added new <a href="#conformanceDisallows"><code>sh:conformanceDisallows</code> property</a> to the validation report; see <a href="https://github.com/w3c/data-shapes/issues/453">Issue 453</a></li>
</ul>
</section>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@prefix ex: <http://example.com/ns#> .
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix sht: <http://www.w3.org/ns/shacl-test#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

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 (
<conformance-disallows-001>
) ;
.
<conformance-disallows-001>
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 <conformance-disallows-002> ;
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 ;
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@prefix ex: <http://example.com/ns#> .
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix sht: <http://www.w3.org/ns/shacl-test#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

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 (
<conformance-disallows-002>
) ;
.
<conformance-disallows-002>
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 <conformance-disallows-001> ;
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 ;
.
2 changes: 2 additions & 0 deletions shacl12-test-suite/tests/core/validation-reports/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
<>
a mf:Manifest ;
rdfs:label "Tests for validation reports" ;
mf:include <conformance-disallows-001.ttl> ;
mf:include <conformance-disallows-002.ttl> ;
mf:include <shared.ttl> ;
.
8 changes: 8 additions & 0 deletions shacl12-vocabularies/shacl.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;
Expand Down