zazuko / rdf-validate-shacl

Validate RDF data purely in JavaScript. An implementation of the W3C SHACL specification on top of the RDFJS stack.
MIT License
95 stars 12 forks source link

Unexpected sh:or SHACL violation #98

Open Sabachi opened 2 years ago

Sabachi commented 2 years ago

SHACL validation incorrectly creates a violation for the sh:or constraint when the NodeShape with the sh:or constraint also has a complex sh:property pointing towards a sh:node (Which is a NodeShape in itself).

Visit https://s.zazuko.com/RJmit for a minimum working example (mwe). We expect the SHACL report to look like this:

{
    _:report a sh:ValidationReport ;
        sh:result [
            rdf:type sh:ValidationResult ;
            sh:resultSeverity sh:Violation ;
            sh:sourceConstraintComponent sh:NodeConstraintComponent ;
            sh:sourceShape <http://example.com/ns#educationPropShape> ;
            sh:focusNode <http://example.com/ns#Alice> ;
            sh:value <http://example.com/ns#bachelor> ;
            sh:detail [
                rdf:type sh:ValidationResult ;
                sh:resultSeverity sh:Violation ;
                sh:sourceConstraintComponent sh:MinCountConstraintComponent ;
                sh:sourceShape [
                    sh:path <http://example.com/ns#details> ;
                    sh:minCount 1 ;
                ] ;
                sh:focusNode <http://example.com/ns#bachelor> ;
                sh:resultPath <http://example.com/ns#details> ;
                sh:resultMessage "Less than 1 values" ;
            ] ;
            sh:resultPath <http://example.com/ns#education> ;
            sh:resultMessage "Value does not have shape <http://example.com/ns#bachelorNodeShape>" ;
        ] ;
        sh:conforms false .
}

In the mwe the sh:detail contains an additional SHACL violation that we don't expect to see in the SHACL report.

giacomociti commented 2 months ago

this should be fixed by #126, we just need to upgrade the playground to use version 0.5.4