This exercise is intended to explore further the semantics of the restriction operations in OWL. You might want to try experimenting with an editor as you work through these examples. It can also be helpful to add sample individuals in order to test your assumptions about the classes and their interpretations. You should also experiment and add further classes or change the class definitions given here in order to test out your thinking.
Assume the following initial ontology of pets.
Namespace: owl = <http://www.w3.org/2002/07/owl#> Namespace: = <http://owl.cs.manchester.ac.uk/2009/07/sssw/pets#> Ontology: <http://owl.cs.manchester.ac.uk/2009/07/sssw/pets> ObjectProperty: hasPet Range: Animal Inverse: isPetOf Class: Person Class: Animal Class: Cat SubClassOf: Animal Class: Dog SubClassOf: Animal
Given the following class definition:
Class: PetOwner SubClassOf: Person that hasPet some Cat
We should always bear in mind the way in which the semantics of OWL DL is defined using interpretations. Thus in the above, when we say "we don't know X", we mean that there can be interpretations of the ontology which are models (e.g. which respect all the axioms) in which X is true, and there can interpretations of the ontology which are models in which X is false. Thus X isn't a consequence of the stated axioms, and we "don't know" in general whether it will be true or not.
Given the following class definition:
Class: PetOwner EquivalentTo: Person that hasPet some Cat
Given the following class definition:
Class: PetOwner SubClassOf: Person that hasPet some Cat and hasPet only Cat
Given the following class definition:
Class: PetOwner EquivalentTo: Person that hasPet some Cat and hasPet only Cat
Given the following class definition:
Class: PetOwner SubClassOf: Person EquivalentTo: hasPet some Cat Individual: Sean Facts: hasPet Fluffy Individual: Fluffy Types: Cat
In this example, we have an interaction between a subclass and an equivalence. The equivalence gives us sufficent conditions to recognise Sean as a PetOwner, and the subclass states some necessary conditions that must then hold, i.e. Sean is a Person. If we had modelled this as in example Cats II above, i.e.:
Class: PetOwner EquivalentTo: Person that hasPet some Cat Individual: Sean Facts: hasPet Fluffy Individual: Fluffy Types: Cat
we would not be able to draw the inference that Sean is a PetOwner, as we don't know that he's a Person.
Although this may be exactly what we want to model, we sometimes see this kind of modelling pattern as an "error", where an equivelance is stated for a single expression, rather than a conjunction of a number of restrictions.
Given the following class definition:
Class: PetOwner SubClassOf: Person that hasPet some (not Cat)
The second answer above may be unexpected. Note that this definition says that a PetOwner must have at least one pet that is not a Cat, but doesn't say anything about any other pets they might have.
Given the following class definition:
Class: PetOwner SubClassOf: Person and not (hasPet some Cat)
For this example, we now know that a PetOwner is a subclass of (not (hasPet some Cat)), thus a PetOwner cannot have a Cat as a Pet. However, this definition doesn't tell us whether a PetOwner actually has any Pets (hence the answer to the first question).
Generalisation of De Morgan's laws tells us that this definition is actually the same as the following:
Class: PetOwner SubClassOf: Person and hasPet only (not Cat)
Here, it perhaps clearer that this definition states that anything related to a PetOwner via hasPet is not a Cat — but we must remember that the universal quantification (only in Manchester syntax) does not make any statement about the existence of a related object.
Note the difference between example VI and VII.
Bonus Question Explore the consequences of replacing only with some and vice versa in examples VI and VII.
Given the following additional definitions:
DisjointClasses: Dog, Cat Class: PetOwner subClassOf: Person that hasPet some (Cat or Dog) and hasPet only (Animal)
You may find the last two answers above surprising. All we do know is that a PetOwner has a pet, and that pet is a Cat or a Dog. But we don't know which it is. Thus we can't say for sure that a PetOwner has a Dog or that a PetOwner has a Cat.
Given the following additional definitions:
DisjointClasses: Dog, Cat Class: PetOwner1 EquivalentTo: Person that (hasPet some Cat and hasPet some Dog) Class: PetOwner2 EquivalentTo: Person that (hasPet some Cat or hasPet some Dog) Class: PetOwner3 EquivalentTo: Person that hasPet some (Cat or Dog) Class: PetOwner4 EquivalentTo: Person that hasPet some (Cat and Dog)
Given the following additional information
ObjectProperty : hasPet Characteristics: transitive Class: Flea SubClassOf: Animal Class: PetOwner SubClassOf: Person that hasPet some (Cat that hasPet some Flea)
This answer may be a little surprising. The class definition of PetOwner states that a PetOwner has a Cat as a pet that has a Flea as a pet. This does not means that every Cat that is a pet has a Flea. Simply that if someone is a PetOwner, one of the Cats they have as a pet has a Fleas.
In order to illustrate this, consider the following:
Individual: Tibbs Types: Cat DifferentFrom: Fluffy Individual: Fluffy Types: Cat Individual: Sean Types: PetOwner, hasPet max 2 Facts: hasPet Tibbs, hasPet Fluffy
In this case, we know that Sean has two pets, Tibbs and Fluffy. As every PetOwner has a Cat which has a Flea, we know that either Tibbs or Fluffy has a Flea, but we can't tell which one. There are valid interpretations of this ontology in which Tibbs has a Flea and Fluffy does not, and vice versa. Thus Tibbs having a Flea is not a consequence of these statements.
This example is primarily intended to illustrate the subtle difference between an unqualified and a qualified property restriction.
Bonus question! Why might we have included assertions concerning the cardinality of the hasPet property and the differentFrom statements about Tibbs and Fluffy? If those assertions are not there, what can we say about Tibbs and Fluffy?
Bonus bonus question! If we state:
Individual: Tibbs Types: Cat, not hasParasite Fleas DifferentFrom: Fluffy
What can we now infer? And why?
The following example makes use of a new feature introduced into OWL2: Role chains. Given the following additional information
ObjectProperty: hasParasite SubPropertyChain: hasPet o hasParasite Class: Flea SubClassOf: Animal Class: PetOwner SubClassOf: Person that hasPet some (Cat that hasParasite some Flea)
Assuming the following additional statements:
Class: PetOwner SubClassOf: Person that hasPet max 2
This particular example is rather straightforward. The cardinality restriction means that a PetOwner can have at most two things related via the hasPet relation, whether they're Cats, Dogs or any other kind of Animal
This example uses a new features from OWL2: qualified cardinality restrictions.
Assuming the following additional statements:
Class: PetOwner SubClassOf: Person that hasPet max 2 Cat
To further illustrate this example, consider the following collection of instances:
Individual: Sean Types: PetOwner Facts: hasPet Tibbs, hasPet Fluffy, hasPet Spot Individual: Fluffy Types: Cat DifferentFrom: Spot, Tibbs Individual: Spot DifferentFrom: Fluffy, Tibbs Individual: Tibbs Types: Cat DifferentFrom: Fluffy, Spot
Sean has three pets (Fluffy, Spot and Tibbs, which are all different). A reasoner will be able to infer for us that, as Sean has two pets that are Cats (Fluffy and Tibbs), Spot is not a Cat.
Bonus Question What would happen if we were to assert that Spot was a Cat?
OWL2 provides a property characteristic of reflexivity. If a property is reflexive, then every individual in the domain must be related to itself via that property.
If we add the following to our ontology:
ObjectProperty: likes Characteristics: Reflexive Class: Misanthrope EquivalentTo: Person and (likes only (not (Person)))
Reflexivity can have some subtle side-effect. For example, what are the consequences of stating the following?
ObjectProperty: likes Characteristics: Reflexive domain: Person
Note also that a reflexive relation doesn't just mean that individuals are related to themselves. Thus an individual can like other things than itself (but it must, at minimum, like itself).
Bonus Question Additional property characteristics include irreflexivity and asymmetry. Try experimenting with the results of stating these characteristics for properties.