W3C home > Mailing lists > Public > public-rdf-shapes@w3.org > December 2015

Re: Defining exclusive or in core SHACL

From: Arthur Ryman <arthur.ryman@gmail.com>
Date: Tue, 15 Dec 2015 22:05:22 -0500
Message-ID: <CAApBiOmVR8UxWcVsfWcnb7Bje_2g03yfniowaEcThgPKU37-bQ@mail.gmail.com>
To: Martynas Jusevičius <martynas@graphity.org>
Cc: Jose Emilio Labra Gayo <jelabra@gmail.com>, "public-rdf-shapes@w3.org" <public-rdf-shapes@w3.org>
Jose,

You can say this in SHACL as boolean combination of shapes but it's
verbose: (Label And (Not Comment)) Or ((Not Label) And Comment).

-- Arthur

On Mon, Nov 23, 2015 at 9:54 AM, Martynas Jusevičius
<martynas@graphity.org> wrote:
> Jose,
>
> can't you use SPARQL? Something like:
>
> {
>   ?item rdfs:label ?label
>   FILTER NOT EXISTS { ?item rdfs:comment ?comment }
> }
> UNION
> {
>   ?item rdfs:comment ?comment
>   FILTER NOT EXISTS { ?item rdfs:label ?label }
> }
>
> Not tested, but you get the idea.
>
> Martynas
> graphityhq.com
>
> On Sun, Nov 22, 2015 at 8:47 AM, Jose Emilio Labra Gayo
> <jelabra@gmail.com> wrote:
>> Imagine that I want to declare items that either have rdfs:label or
>> rdfs:comment, but no both.
>>
>> I ShEx, I can define:
>>
>> <Item> {
>>  rdfs:label xsd:string | rdfs:comment xsd:string
>> }
>>
>> In Shacl, I was able to define it in the following way:
>>
>> :Item a sh:Shape ;
>>  sh:constraint [
>>  a sh:OrConstraint ;
>>  sh:shapes (
>>     [ sh:property [
>>       sh:predicate rdfs:label ;
>>       sh:datatype xsd:string ;
>>       sh:minCount 1 ;
>>       sh:maxCount 1 ;
>>     ]]
>>     [ sh:property [
>>       sh:predicate rdfs:comment ;
>>       sh:datatype xsd:string ;
>>       sh:minCount 1 ;
>>       sh:maxCount 1 ;
>>     ]]
>>   )
>>  ] ;
>>  sh:constraint [
>>   a sh:NotConstraint ;
>>   sh:shape [
>>     sh:constraint [
>>     a sh:AndConstraint ;
>>     sh:shapes (
>>      [sh:property [
>>       sh:predicate rdfs:label ;
>>       sh:datatype xsd:string ;
>>       sh:minCount 1 ;
>>       sh:maxCount 1
>>      ]]
>>      [sh:property [
>>       sh:predicate rdfs:comment ;
>>       sh:datatype xsd:string ;
>>       sh:minCount 1 ;
>>       sh:maxCount 1
>>      ]] )
>>    ]
>>   ]
>>  ]
>> .
>>
>> Is there any other way to do this in SHACL?
>>
>> --
>> -- Jose Labra
>>
>
Received on Wednesday, 16 December 2015 03:05:50 UTC

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