Re: Defining exclusive or in core SHACL

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