Re: Defining exclusive or in core SHACL

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 Monday, 23 November 2015 14:55:29 UTC