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

Re: Defining exclusive or in core SHACL

From: Martynas Jusevičius <martynas@graphity.org>
Date: Mon, 23 Nov 2015 15:54:54 +0100
Message-ID: <CAE35VmzdYB7iAb2xvUxji2YH0P2xEna5GufGv4ziPTJuc0QA=w@mail.gmail.com>
To: Jose Emilio Labra Gayo <jelabra@gmail.com>
Cc: "public-rdf-shapes@w3.org" <public-rdf-shapes@w3.org>
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

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