I OWL I want to model the case where for a certain class only one or the other subclass is allowed. I want to model a restriction that allows for a property to be only linked like (A XOR B) OR (some general superclass) for multiple instances
X p A1 .
X p A2 .
X p M . # OK
Y p K .
Y p A3 .
Y p B1 . #Not ok, A and B linked.
A concrete example:
I have a class cart, and each cart has exactly n Seats.
There are two types of seats available (adult, child) as well as a unspecified amount of other Parts, which is the superclass of Seats. Linked are they all via a :hasPart relationship.
:Cart a owl:Class .
:Part o owl:Class .
:hasPart a owl:ObjectProperty;
:rdfs:domain :Part .
:Seat a owl:Class ; rdfs:subClassOf :Part .
:AdultSeat a owlClass; rdfs:subClassOf :Seat .
:ChildSeat a owlClass; rdfs:subClassOf :Seat .
[a owl:AllDisjointClasses; owl:members ( <all leaf classes> )]
# some other parts
With OWL I want to now model that a cart can either have AdultSeats xor ChildSeats.
I think I need two opposite restrictions that model <minCardinality of SeatA to 1 & maxCardinality of SeatB to 0>. I am still working out how to formulate these two cases.
However, given that I have them I still wonder how I can restrict :hasPart to one of these cases and still allow linking other parts.
To get to
(A XOR B) OR <something not A OR B>one can work with the complement. To reach an explicit XOR one would intersect over A OR B again, depending on the situation this could be done in multiple ways.My old idea was to model the XOR explicit as
(A and not B) OR (notA and B)which yields, still wondering if there is a shorter way as it looks cumbersome.