This DL-Query is not returning any individuals:
- Query (Protégé syntax) :
hasPet exactly 1 DomesticAnimal
Here's part of the ontology:
:hasPet a owl:ObjectProperty;
rdfs:domain :Human;
rdfs:range :DomesticAnimal;
owl:inverseOf : petOf;
:Joe a :Human;
hasPet :Lassy.
:Bob a :Human;
hasPet :Sparkey, Lucky.
Queries:
petOf value Bob
returnsSparkey
andLucky
petOf value Joe
returnsLassy
hasPet exactly 1
returns nothing.
Why isn't the last query returning Joe
?
I have tried it with in Protégé with Pellet, HermiT, and FaCT++, and it didn't work.
The class expression
hasPet exactly 1 DomesticAnimal
has as instances exactly those individuals which are related by the propertyhasPet
to exactly oneDomesticAnimal
. Exactly one means at least one and no more than one. Based on the tripleswe know that Joe and Bob each have at least one pet, but we do not know anything about how many they might have. Joe might have pets other than Lassy, so we don't know that Joe has exactly one pet. It is possible that Sparkey and Lucky happen to be the same individual, so Bob has at least one pet, but we do not have an upper bound on the number of pets that Bob has.
OWL, as well as RDF, makes the open world assumption, which means that OWL does not assume that the data provided is an exhaustive enumeration of everything in the world that is true. If it did, there would be no point in inference. The absence of an assertion of
s p o
does not imply thatNOT( s p o )
, but rather just that there is no judgment yet ons p o
.You can add some more knowledge to your data to get the conclusions that you want, though. You describe Joe with the following:
From this you will be able to infer that
For Bob, it looks like you expect that Sparkey and Lucky are different animals, so you'll need
owl:differentFrom
:I did not include
Bob hasPet only { Sparkey, Lucky }
in these axioms, because they are not necessary to infer that Bob has more than one pet, but you could include it. I also included just one of theowl:differentFrom
assertions that could have been made. Now Bob is known to have two distinct pets, and thus known to not be ahasPet exactly 1 DomesticAnimal
. With this data loaded into Protégé, the DL queryhasPet exactly 1 DomesticAnimal
works as expected:Example Ontology
In case you want to be able to quickly load this structure into Protégé, here's an ontology with individuals, property, and axioms as described above. I did not define the
petOf
property, but you can still run your first two queries asinverse hasPet value Joe
andinverse hasPet value Bob
and get the expected results.