@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix : <foo://rooms#>.
:in a owl:ObjectProperty, owl:FunctionalProperty; owl:inverseOf :has;
  rdfs:domain :Furniture; rdfs:range :Room.
:Room owl:oneOf (:bedroom :livingroom :guestroom).
[] a owl:AllDifferent; owl:members (:bedroom :livingroom :guestroom).
:bedroom a :Room,
  [a owl:Restriction; owl:onProperty :has; owl:onClass :Bed; owl:qualifiedCardinality 1],
  [a owl:Restriction; owl:onProperty :has; owl:onClass :Wardrobe; owl:qualifiedCardinality 1],
  [a owl:Restriction; owl:onProperty :has; owl:onClass :Chair; owl:qualifiedCardinality 1],
  [a owl:Restriction; owl:onProperty :has; owl:onClass :Table; owl:maxQualifiedCardinality 0].
# :bedroom  :has :bed1 . # comment in or out ...
:guestroom a :Room,
  [a owl:Restriction; owl:onProperty :has; owl:onClass :Table; owl:maxQualifiedCardinality 0].
:livingroom a :Room,
  [a owl:Restriction; owl:onProperty :has; owl:onClass :Bed; owl:maxQualifiedCardinality 0],
  [a owl:Restriction; owl:onProperty :has; owl:onClass :Chair; owl:qualifiedCardinality 4].

:Furniture a owl:Class;
  owl:disjointUnionOf (:Bed :Wardrobe :Table :Chair);
  owl:equivalentClass [a owl:Restriction; owl:onProperty :in; owl:cardinality 1].


:Bed owl:oneOf (:bed1 :bed2 :bed3).  ### one in bedroom, none in livingr. -> two in guestroom
[] a owl:AllDifferent; owl:members (:bed1 :bed2 :bed3).
:Wardrobe owl:oneOf (:wr1).
:Table owl:oneOf (:t1).   ### only one. must be in livingroom -> no in bedroom.
:Chair owl:oneOf (:c1 :c2 :c3 :c4 :c5).
[] a owl:AllDifferent; owl:members (:c1 :c2 :c3 :c4 :c5).
  ### one must be in bedroom, 4 in livingroom, no one remains for guestroom

:InBedroom a owl:Class; owl:equivalentClass [ a owl:Restriction;
   owl:onProperty :in; owl:hasValue :bedroom ].
:InGuestroom a owl:Class; owl:equivalentClass [ a owl:Restriction;
   owl:onProperty :in; owl:hasValue :guestroom ].
:InLivingroom a owl:Class; owl:equivalentClass [ a owl:Restriction;
   owl:onProperty :in; owl:hasValue :livingroom ].
:NotInBedroom a owl:Class; owl:equivalentClass
   [ owl:intersectionOf (:Furniture [ owl:complementOf :InBedroom])].
:NotInLivingroom a owl:Class; owl:equivalentClass
   [ owl:intersectionOf (:Furniture [ owl:complementOf :InLivingroom])].
:NotInGuestroom a owl:Class; owl:equivalentClass
   [ owl:intersectionOf (:Furniture [ owl:complementOf :InGuestroom])].

## for the queries:
:RoomWithChair owl:equivalentClass
  [a owl:Restriction; owl:onProperty :has; owl:someValuesFrom :Chair].
## :guestroom a :RoomWithChair.   ## makes it inconsistent
:RoomWithoutChair owl:equivalentClass [a owl:Restriction;
  owl:onProperty :has; owl:onClass :Chair; owl:maxQualifiedCardinality 0].
:RoomWithTwoBeds owl:equivalentClass [a owl:Restriction;
  owl:onProperty :has; owl:onClass :Bed; owl:qualifiedCardinality 2].
