Defining exclusive or in core SHACL

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 Sunday, 22 November 2015 07:48:44 UTC