w3c / data-shapes

RDF Data Shapes WG repo
87 stars 33 forks source link

Support for nested shapes in report #108

Closed hmottestad closed 5 years ago

hmottestad commented 5 years ago

Nested shapes in sh:or do not produce very useful reports.

Consider the following shape:

ex:PersonShape
    a sh:NodeShape  ;
    sh:targetClass ex:Person ;
    sh:property [
                sh:or (
                    [
                    sh:path ex:age ;
                      sh:datatype xsd:integer ;
                    ]
                    [
                    sh:path ex:age ;
                      sh:datatype xsd:long ;
                    ]
                  ) ;
        ] .

Should a failing validation report link to the OrConstraintComponent or the DatatypeConstraintComponent? Or both, like this:

@prefix sh: <http://www.w3.org/ns/shacl#> .

_:bnode1 a sh:ValidationResult;
  sh:focusNode <http://example.com/ns#validPerson1>;
  sh:resultPath <http://example.com/ns#age>;
  sh:sourceConstraintComponent sh:DatatypeConstraintComponent, sh:OrConstraintComponent;
  sh:sourceShape _:node1d1e71ol2x1, _:node1d1e71ol2x3 .

[] a sh:ValidationReport;
  sh:conforms false;
  sh:result _:bnode1 .
HolgerKnublauch commented 5 years ago

It should only link to the sh:or but sh:details could be used to provide info into deeper causes.

https://www.w3.org/TR/shacl/#results-detail

In the case of sh:or, there would be pointers to all nested shapes, because all of them have failed. In the TopBraid API there is a flag to activate those nested sh:details.

hmottestad commented 5 years ago

Thank you @HolgerKnublauch

I've implemented it as you have recommended. The SHACL engine in RDF4J is getting closer and closer to being useful now :)