Re: Defining exclusive or in core SHACL

I suspect that the same problem arises if you want to capture the constraint that a single created date property is provided but its type can be any of the xsd date types, i.e. in ShEx I wrote
<Item> {
(dct:created  xsd:date | dct:created  xsd:dateTime | dct:created xsd:gYearMonth | dct:created xsd:gYear | dct:created psd:dateTime)
}

Alasdair


On 22 Nov 2015, at 07:47, Jose Emilio Labra Gayo <jelabra@gmail.com<mailto: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


Alasdair J G Gray
Fellow of the Higher Education Academy
Assistant Professor in Computer Science,
School of Mathematical and Computer Sciences
(Athena SWAN Bronze Award)
Heriot-Watt University, Edinburgh UK.

Email: A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk>
Web: http://www.alasdairjggray.co.uk
ORCID: http://orcid.org/0000-0002-5711-4872
Office: Earl Mountbatten Building 1.39
Twitter: @gray_alasdair












----- 
We invite research leaders and ambitious early career researchers to 
join us in leading and driving research in key inter-disciplinary themes. 
Please see www.hw.ac.uk/researchleaders for further information and how
to apply.

Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

Received on Monday, 23 November 2015 13:21:48 UTC