Skip to content

SHACL validation report with violations resulting in sh:conforms true #188

@costas80

Description

@costas80

See the original discussion of this issue here.

It seems that runtime errors may result in violations being added to the SHACL validation report, while still resulting in an overall sh:conforms true. To illustrate with an example, considering this shape ...

@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foobar: <https://foo.bar/> .

foobar:FooShape a sh:NodeShape;
	sh:targetNode foobar:FooShape;
	sh:sparql [
		sh:select """
			SELECT $this WHERE {
				$this https://foo.bar/predicate ?value.
			}""";
	];
	sh:severity sh:Violation.

... where the IRIREF is invalid, this throws an exception while carrying out the validation. The exception results in a violation being recorded, however the overall sh:conforms is still set to true:

PREFIX dash:    <http://datashapes.org/dash#>
PREFIX foobar:  <https://foo.bar/>
PREFIX graphql: <http://datashapes.org/graphql#>
PREFIX ns0:     <http://www.w3.org/ns/locn#>
PREFIX ns1:     <http://itb.ec.europa.eu/sample/po#>
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 swa:     <http://topbraid.org/swa#>
PREFIX tosh:    <http://topbraid.org/tosh#>
PREFIX xsd:     <http://www.w3.org/2001/XMLSchema#>

[ rdf:type     sh:ValidationReport;
  sh:conforms  true;
  sh:result    [ rdf:type                      dash:FailureResult;
                 sh:focusNode                  foobar:FooShape;
                 sh:resultMessage              "Failed to create validator: Invalid SPARQL constraint (Line 3, column 11: Unresolved prefixed name: https:):\n\r\n\t\t\tSELECT $this WHERE {\r\n\t\t\t\t$this https://foo.bar/predicate ?value.\r\n\t\t\t}";
                 sh:resultSeverity             sh:Violation;
                 sh:sourceConstraintComponent  sh:SPARQLConstraintComponent;
                 sh:sourceShape                foobar:FooShape
               ]
] .

Whether or not a runtime error due to a bad shape should be reported as a violation is a secondary point (in my view it should be reported). The key issue is that this results in a seemingly inconsistent report. I would expect that any report including violations should have sh:conforms false.

What is your opinion on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions