Skip to content

feat: #192 add severity levels that are not violations #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
16 changes: 14 additions & 2 deletions shacl12-core/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,14 @@ <h4>Declaring the Severity of a Shape or Constraint</h4>
<th>Severity</th>
<th>Description</th>
</tr>
<tr>
<td><code>sh:Trace</code></td>
<td>A trace message that is not a violation.</td>
</tr>
<tr>
<td><code>sh:Debug</code></td>
<td>A debug message that is not a violation.</td>
</tr>
<tr>
<td><code>sh:Info</code></td>
<td>A non-critical constraint violation indicating an informative message.</td>
Expand All @@ -1752,6 +1760,10 @@ <h4>Declaring the Severity of a Shape or Constraint</h4>
<td>A constraint violation.</td>
</tr>
</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>
Comment on lines +1763 to +1766
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my one last hangup on this PR is this escape and the lack of demonstration of a "test configuration record".

The tests @bergos added, 4 and 5, are fine demonstrations of a validation result set with conformance of true and the non-violation levels. (Thank you, Thomas.)

Can the test suite support a new test 6, mostly duplicative of 4 or 5, but instead using sh:Warning and a conformance of true? How would test suite conformance be reproducible?

I feel like another property in the ValidationReport would be helpful, that logs whether its sh:conformance value was set to "excuse" sh:Info or sh:Warning severity results from tripping sh:conformance into false. [] a sh:ValidationReport ; sh:excuses sh:Warning ; ...? sh:permits, sh:permitsSeverity, or sh:excusesSeverity might work too.

<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 Down Expand Up @@ -2802,7 +2814,7 @@ <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> is empty 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 results with a severity level representing a violation and no <a>failure</a>
has been reported by it.
</p>
<p>
Expand Down Expand Up @@ -2917,7 +2929,7 @@ <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>, and <code>false</code> otherwise.
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="result">
Expand Down
2 changes: 2 additions & 0 deletions shacl12-test-suite/tests/core/misc/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
mf:include <severity-001.ttl> ;
mf:include <severity-002.ttl> ;
mf:include <severity-003.ttl> ;
mf:include <severity-004.ttl> ;
mf:include <severity-005.ttl> ;
.
43 changes: 43 additions & 0 deletions shacl12-test-suite/tests/core/misc/severity-004.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@prefix dash: <http://datashapes.org/dash#> .
@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:TestShape
rdf:type sh:NodeShape ;
sh:datatype xsd:integer ;
sh:severity sh:Debug ;
sh:targetNode "Hello" ;
.
<>
rdf:type mf:Manifest ;
mf:entries (
<severity-004>
) ;
.
<severity-004>
rdf:type sht:Validate ;
rdfs:label "Test of sh:severity sh:Debug 004" ;
mf:action [
sht:dataGraph <> ;
sht:shapesGraph <> ;
] ;
mf:result [
rdf:type sh:ValidationReport ;
sh:conforms "true"^^xsd:boolean ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode "Hello" ;
sh:resultSeverity sh:Debug ;
sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
sh:sourceShape ex:TestShape ;
sh:value "Hello" ;
] ;
] ;
mf:status sht:approved ;
.
43 changes: 43 additions & 0 deletions shacl12-test-suite/tests/core/misc/severity-005.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@prefix dash: <http://datashapes.org/dash#> .
@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:TestShape
rdf:type sh:NodeShape ;
sh:datatype xsd:integer ;
sh:severity sh:Trace ;
sh:targetNode "Hello" ;
.
<>
rdf:type mf:Manifest ;
mf:entries (
<severity-005>
) ;
.
<severity-005>
rdf:type sht:Validate ;
rdfs:label "Test of sh:severity sh:Trace 005" ;
mf:action [
sht:dataGraph <> ;
sht:shapesGraph <> ;
] ;
mf:result [
rdf:type sh:ValidationReport ;
sh:conforms "true"^^xsd:boolean ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode "Hello" ;
sh:resultSeverity sh:Trace ;
sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
sh:sourceShape ex:TestShape ;
sh:value "Hello" ;
] ;
] ;
mf:status sht:approved ;
.
12 changes: 12 additions & 0 deletions shacl12-vocabularies/shacl.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,18 @@ sh:Severity
rdfs:subClassOf rdfs:Resource ;
rdfs:isDefinedBy sh: .

sh:Trace
a sh:Severity ;
rdfs:label "Trace"@en ;
rdfs:comment "The severity for a trace validation result."@en ;
rdfs:isDefinedBy sh: .

sh:Debug
a sh:Severity ;
rdfs:label "Debug"@en ;
rdfs:comment "The severity for a debug validation result."@en ;
rdfs:isDefinedBy sh: .

sh:Info
a sh:Severity ;
rdfs:label "Info"@en ;
Expand Down