Re: Two properties or none

I have tried it with shexcala (http://labra.github.io/ShExcala/) and it
works as you expected.

Although by now, you can play with the command line tool, I am currently
working on an online validator using shexcala.

Best regards, Jose Labra



On Tue, Jun 3, 2014 at 5:55 PM, Olivier Rossel <olivier.rossel@gmail.com>
wrote:

> Hi all.
>
> I need to model a given constraint:
> in a given set of resources, two properties must appear together, or none.
>
> Let me be more specific:
> any resource with a property "ex:a" of type "xsd:string" must be tested
> against the <IssueShape> shape
> and must PASS.
>
> At the moment, here are my shapes:
> ###############
> PREFIX ex: <http://ex.example/#>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>
> start = <IssueShape>
>
> <IssueShape> {
>     ex:a   xsd:string,
>     (ex:state xsd:string,
>      ex:state2 xsd:string)?
> }
> ###################
>
> and here is my set of data:
> ###################
> PREFIX ex: <http://ex.example/#>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>
> <Issue1>
> ex:a "a"
> .
> <Issue2>
>   ex:state        "a";
>   ex:a "a"
> .
> #################
>
> Here are my expectations:
> <Issue2> is supposed to fail, whereas <Issue1> is supposed to be ok.
>
> My experience with the online demos are:
>
> -----
> 1) with http://www.w3.org/2013/ShEx/SimpleShExDemo
>  -----
>
> <Issue1> PASS.
> <Issue2> is not tested.
> <Issue2> is in the remaining triples:
>   <Issue2> <http://ex.example/#state> "a".
>   <Issue2> <http://ex.example/#a> "a".
>
> -----
> 2) with http://www.w3.org/2013/ShEx/FancyShExDemo and Pre-typed graph
> node: <Issue1>
> -----
>
> PASS
>
> -----
> 3) with http://www.w3.org/2013/ShEx/FancyShExDemo and Pre-typed graph
> node: <Issue2>
> -----
>
> FAIL {
> Errors:
>  ☹   mixed matches of     <http://ex.example/#state> <
> http://www.w3.org/2001/XMLSchema#string>,
>     <http://ex.example/#state2> <http://www.w3.org/2001/XMLSchema#string>
> passed: [[        PASS {
>       <http://ex.example/#state> <http://www.w3.org/2001/XMLSchema#string>
> matched by <Issue2> <http://ex.example/#state> "a".
>     }]]
> empty: [[        FAIL {
>       <http://ex.example/#state2> <http://www.w3.org/2001/XMLSchema#string>
> permitted to not match
>     }]]
> Matches:
>   <http://ex.example/#a> <http://www.w3.org/2001/XMLSchema#string>
> matched by <Issue2> <http://ex.example/#a> "a".
>   <http://ex.example/#state> <http://www.w3.org/2001/XMLSchema#string>
> matched by <Issue2> <http://ex.example/#state> "a".
>   <http://ex.example/#state2> <http://www.w3.org/2001/XMLSchema#string>
> permitted to not match
> }
>
> -----
> 4) with http://www.w3.org/2013/ShEx/FancyShExDemo and selecting "Find
> node types"
> -----
>
> I get this message: <Issue1> is a <IssueShape>
> And no list of remaining triples.
>
>
> ----------------------------------------------------------------------------------------------------------------------------------
>
> In short, I never get a report that clearly states:
> <Issue1> was tested against the <IssueShape> shape and PASSed.
> <Issue2> was tested against the <IssueShape> shape and FAILed.
>
>
> Is there a way to get such a report with the actual ShEx spec and
> implementation?
> Is my requirement related to the concept of closed shapes? (still under
> discussion, afaiu).
>
>
>


-- 
Saludos, Labra

Received on Tuesday, 3 June 2014 20:33:32 UTC