W3C home > Mailing lists > Public > public-rdf-shapes@w3.org > October 2017

Re: How looks ValidationReport + according ValidationResult for sh:or based shape?

From: Holger Knublauch <holger@topquadrant.com>
Date: Thu, 19 Oct 2017 10:33:55 +1000
To: public-rdf-shapes@w3.org
Message-ID: <7cc46a42-036a-6855-9215-a066c7aea94a@topquadrant.com>
Hi Konrad,

the spec uses a rather formal language to explain what is supposed to 
happen. In this particular case it states

if|v|conforms <https://www.w3.org/TR/shacl/#dfn-conforms>to none of 
themembers <https://www.w3.org/TR/shacl/#dfn-members>of|$or|there is 
avalidation result 
<https://www.w3.org/TR/shacl/#dfn-validation-results>with|v|as|sh:value|.

The test cases document

http://w3c.github.io/data-shapes/data-shapes-test-suite/#validate-rdf-data-tests

links to example(s) of what is supposed to be produced. This one here

https://github.com/w3c/data-shapes/blob/gh-pages/data-shapes-test-suite/tests/core/node/or-001.ttl

is close to what you seek, and produces

[
       rdf:type sh:ValidationReport ;
       sh:conforms "false"^^xsd:boolean ;
       sh:result [
           rdf:type sh:ValidationResult ;
           sh:focusNode ex:InvalidRectangle1 ;
           sh:resultSeverity sh:Violation ;
           sh:sourceConstraintComponent sh:OrConstraintComponent ;
           sh:sourceShape ex:RectangleWithArea ;
           sh:value ex:InvalidRectangle1 ;
         ] ;
       sh:result [
           rdf:type sh:ValidationResult ;
           sh:focusNode ex:InvalidRectangle2 ;
           sh:resultSeverity sh:Violation ;
           sh:sourceConstraintComponent sh:OrConstraintComponent ;
           sh:sourceShape ex:RectangleWithArea ;
           sh:value ex:InvalidRectangle2 ;
         ] ;
     ] ;

So, regardless of the structure of the sh:or, it will only ever produce 
a single sh:ValidationResult, and not any "nested" ones (although 
sh:detail could be used to record these, outside of the standard behavior).

If things remain unclear, please follow up. The example you mention 
below doesn't have a data graph, so it's difficult to answer.

HTH
Holger


On 18/10/2017 18:59, Konrad Abicht wrote:
> Hello,
>
> i am currently working on a SHACL Core processor for PHP[1]. Handling 
> the ValidationReport as result of sh:or is unclear for me. The section 
> 4.6.3 of the spec[2] does not outline how the ValidationResult looks 
> like, if one, none or all shapes fail.
>
> Is there anything i missed in the specification? If not, can you 
> please give me a simple example of a ValidationReport and according 
> ValidationResults for a given sh:or?
>
>> :NodeShape
>>     rdf:type sh:NodeShape ;
>>     sh:targetClass foaf:Person ;
>>     sh:or ([
>>             sh:path foaf:firstName ;
>>             sh:minCount 1 ;
>>         ],
>>         [
>>             sh:path foaf:givenName ;
>>             sh:minCount 1 ;
>>         ]) .
>
>
> [1] - https://github.com/k00ni/shacl-php
> [2] - https://www.w3.org/TR/shacl/#OrConstraintComponent
>
> Thanks in advance!
>
Received on Thursday, 19 October 2017 00:34:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:02:51 UTC