280 likes | 411 Views
Why did that happen?. OWL and Inference: Practical examples Sean Bechhofer. Inference and Classes. The people and pets example ontology contains a number of classes and properties intended to illustrate particular aspects of reasoning in OWL.
E N D
Why did that happen? OWL and Inference: Practical examples Sean Bechhofer
Inference and Classes • The people and pets example ontology contains a number of classes and properties intended to illustrate particular aspects of reasoning in OWL. • We can make inferences about relationships between those classes, in particular subsumption between classes • Recall that A subsumes B when it is the case that any instance of B must necessarily be an instance of A. A B
Inference and Individuals • In addition, the model contains a number of individuals • We can make inferences about the individuals, in particular inferring that particular individuals must be instances of particular classes. • This can be because of subsumption relationships between classes, or because of the relationships between individuals. • The following slides examine some of the inferences we can make in the example model and discuss why those inferences come about.
Unique Name Assumption • The Unique Name Assumption (UNA) says that any two individuals with different names are different individuals. • OWL semantics does not make the UNA • There are mechanisms in the language (owl:differentFrom and owl:AllDifferent) that allow us to assert that individuals are different. • However, many DL reasoners (including the one we use here) assume UNA. • For the following examples, there is a tacit assumption that all individuals are asserted to be distinct.
Classes • The following examples illustrate reasoning with classes and class definitions. • We show examples of • Inferred Subsumptions • Inconsistency
Bus Drivers are Drivers • A bus driver is a person that drives a bus • A bus is a vehicle • A bus driver drives a vehicle, so must be a driver • The subclass is inferred due to subclasses being used in existential quantification. Class(a:bus+driver complete intersectionOf(a:person restriction(a:drives someValuesFrom (a:bus)))) Class(a:driver complete intersectionOf(a:person restriction(a:drives someValuesFrom (a:vehicle)))) Class(a:bus partial a:vehicle)
Cat Owners like Cats • Cat owners have cats as pets • has pet is a subproperty of likes, so anything that has a pet must like that pet. • Cat owners must like a cat. • The subclass is inferred due to a subproperty assertion Class(a:cat+owner complete intersectionOf(a:person restriction(a:has_pet someValuesFrom (a:cat)))) SubPropertyOf(a:has_pet a:likes) Class(a:cat+liker complete intersectionOf(a:person restriction(a:likes someValuesFrom (a:cat))))
Drivers are Grown Ups Class(a:driver complete intersectionOf(a:person restriction(a:drives someValuesFrom (a:vehicle)))) Class(a:driver partial a:adult) Class(a:grownup complete intersectionOf(a:adult a:person)) • Drivers are defined as persons that drive cars (complete definition) • We also know that drivers are adults (partial definition) • So all drivers must be adult persons (e.g. grownups) • An example of axioms being used to assert additional necessary information about a class. We do not need to know that a driver is an adult in order to recognize one, but once we have recognized a driver, we know that they must be adult.
Sheep are Vegetarians • Sheep only eat grass • Grass is a plant • Plants and parts of plants are disjoint from animals and parts of animals • Vegetarians only eat things which are not animals or parts of animals • Note the complete definition, which means that we can recognise when things are vegetarians. Class(a:sheep partial restriction(a:eats allValuesFrom (a:grass)) a:animal) Class(a:grass partial a:plant) DisjointClasses(unionOf(restriction(a:part_of someValuesFrom (a:animal)) a:animal) unionOf(a:plant restriction(a:part_of someValuesFrom (a:plant)))) Class(a:vegetarian complete intersectionOf( restriction(a:eats allValuesFrom (complementOf(restriction(a:part_of someValuesFrom (a:animal))))) restriction(a:eats allValuesFrom (complementOf(a:animal))) a:animal))
Giraffes are Vegetarians • Giraffes only eat leaves • Leaves are parts of trees, which are plants • Plants and parts of plants are disjoint from animals and parts of animals • Vegetarians only eat things which are not animals or parts of animals • Similar to the previous example with the additional inference provided by the existential restriction in the definition of leaf Class(a:giraffe partial a:animal restriction(a:eats allValuesFrom (a:leaf))) Class(a:leaf partial restriction(a:part_of someValuesFrom (a:tree))) Class(a:tree partial a:plant) DisjointClasses(unionOf(restriction(a:part_of someValuesFrom (a:animal)) a:animal) unionOf(a:plant restriction(a:part_of someValuesFrom (a:plant)))) Class(a:vegetarian complete intersectionOf( restriction(a:eats allValuesFrom (complementOf(restriction(a:part_of someValuesFrom (a:animal))))) restriction(a:eats allValuesFrom (complementOf(a:animal))) a:animal))
Old Ladies own Cats • Old ladies must have a pet. • All pets that old ladies have must be cats. • An old lady must have a pet that is a cat. • An example of the interaction between an existential quantification (asserting the existence of a pet) and a universal quantification (constraining the types of pet allowed). • This also illustrates that an ontology is one view on the world – you may disagree with my modelling but I am being explicit about it. Class(a:old+lady complete intersectionOf(a:person a:female a:elderly)) Class(a:old+lady partial intersectionOf( restriction(a:has_pet allValuesFrom (a:cat)) restriction(a:has_pet someValuesFrom (a:animal)))) Class(a:cat+owner complete intersectionOf(a:person restriction(a:has_pet someValuesFrom (a:cat))))
Mad Cows are inconsistent • Cows are naturally vegetarians • A mad cow is one that has been eating sheeps brains • Sheep are animals • Thus a mad cow has been eating part of an animal, which is inconsistent with the definition of a vegetarian. Class(a:cow partial a:vegetarian) DisjointClasses(unionOf(restriction(a:part_of someValuesFrom (a:animal)) a:animal) unionOf(a:plant restriction(a:part_of someValuesFrom (a:plant)))) Class(a:vegetarian complete intersectionOf( restriction(a:eats allValuesFrom (complementOf(restriction(a:part_of someValuesFrom (a:animal))))) restriction(a:eats allValuesFrom (complementOf(a:animal))) a:animal)) Class(a:mad+cow complete intersectionOf(a:cow restriction(a:eats someValuesFrom (intersectionOf(restriction(a:part_of someValuesFrom (a:sheep)) a:brain))))) Class(a:sheep partial a:animal restriction(a:eats allValuesFrom (a:grass)))
Individuals • The following examples illustrate reasoning with individuals. • We look at why particular individuals can be inferred to be members of particular classes.
The Daily Mirror is a Tabloid • Mick drives a white van • Mick must be a person and an adult, so he is a man • Mick is a man who drives a white van, so he’s a white van man • A white van man only reads tabloids, and Mick reads the Daily Mirror, thus the Daily Mirror must be a tabloid • Here we see interaction between complete and partial definitions plus a universal quantification allowing an inference about a role filler. Individual(a:Daily+Mirror type(owl:Thing)) Individual(a:Mick type(a:male) value(a:drives a:Q123+ABC) value(a:reads a:Daily+Mirror)) Individual(a:Q123+ABC type(a:van) type(a:white+thing)) Class(a:white+van+man complete intersectionOf(a:man restriction(a:drives someValuesFrom (intersectionOf(a:van a:white+thing))))) Class(a:white+van+man partial restriction(a:reads allValuesFrom (a:tabloid)))
Pete is a Person, Spike is an Animal • Spike is the pet of Pete • So Pete has pet Spike • Pete must be a Person • Spike must be an Animal • Here we see an interaction between an inverse relationship and domain and range constraints on a property. Individual(a:Spike type(owl:Thing) value(a:is_pet_of a:Pete)) Individual(a:Pete type(owl:Thing)) ObjectProperty(a:has_pet domain(a:person) range(a:animal)) ObjectProperty(a:is_pet_of inverseOf(a:has_pet))
Walt loves animals • Walt has pets Huey, Dewey and Louie • Huey Dewey and Louie are all distinct individuals • Walt has at least three pets and is thus an animal lover. • Note that in this case, we don’t actually need to include person in the definition of animal lover (as the domain restriction will allow us to draw this inference). Individual(a:Walt type(a:person) value(a:has_pet a:Huey) value(a:has_pet a:Louie) value(a:has_pet a:Dewey)) Individual(a:Huey type(a:duck)) Individual(a:Dewey type(a:duck)) Individual(a:Louie type(a:duck)) DifferentIndividuals(a:Huey a:Dewey a:Louie) Class(a:animal+lover complete intersectionOf(a:person restriction(a:has_pet minCardinality(3))))
Tom is a Cat • Minnie is elderly, female and has a pet, Tom • Minnie must be a person • Minnie is be an old lady • All Minnie’s pets must be cats. • Here the domain restriction gives us additional information which then allows us to infer a more specific type. The universal quantification then allows us to infer information about the role filler. Individual(a:Minnie type(a:female) type(a:elderly) value(a:has_pet a:Tom)) Individual(a:Tom type(owl:Thing)) ObjectProperty(a:has_pet domain(a:person) range(a:animal)) Class(a:old+lady complete intersectionOf(a:person a:female a:elderly)) Class(a:old+lady partial intersectionOf( restriction(a:has_pet allValuesFrom (a:cat)) restriction(a:has_pet someValuesFrom (a:animal))))
General Patterns of Inference • The next slides and examples illustrate some of the interactions between quantification and boolean operators. • Distribution and De Morgan’s laws • We also discuss the ramifications of open world reasoning.
Distribution Rules • Distribution rules for existential quantification are similar to those for conjunction and disjunction: • restriction(some p unionOf(A B) unionOf(restriction(some (p A)) restriction(some (p B))) • There are also inferences that can be drawn between expressions involving existential quantification and conjunction: • restriction(some p intersectionOf(A B) intersectionOf(restriction(some (p A)) restriction(some (p B))) • intersectionOf(restriction(some (p A)) restriction(some (p B))) unionOf(restriction(some (p A)) restriction(some (p B))) • intersectionOf(restriction(some (p A)) restriction(some (p B))) restriction(some p unionOf(A B) • The above inferences are not logical equivalences. • Union is distributive in existentials, intersection is not.
A Simple Ontology • We have some basic classes, Person, Academic, Professor and Student. • There is also a subclass of Happy Persons. • Students and Academics are disjoint. Class(a:Person partial) Class(a:Academic partial a:Person) Class(a:Happy partial a:Person) Class(a:Lecturer partial a:Academic) Class(a:Professor partial a:Academic) Class(a:Student partial a:Person) ObjectProperty(a:hasFriend) ObjectProperty(a:isFriendOf inverseOf(a:hasFriend)) DisjointClasses(a:Student a:Academic)
Example Individuals Individual(a:arthur type(a:Student) type(a:Happy)) Individual(a:bob type(a:Student) type(complementOf(a:Happy))) Individual(a:charlie type(a:Professor) type(a:Happy)) Individual(a:diane type(a:Professor) type(complementOf(a:Happy))) • Note we can infer that Professors and Students are disjoint due to the disjointness axiom concerning Academics. Professor Charlie Diane Happy Student Arthur Bob
Example Individuals Individual(a:Patricia value(a:hasFriend a:Arthur)) Individual(a:Quentin value(a:hasFriend a:Charlie) value(a:hasFriend a:Bob)) Individual(a:Richard value(a:hasFriend a:Charlie)) Individual(a:Roberta value(a:hasFriend a:Bob)) • These individuals now provide witnesses for the non-equivalence of definitions. • restriction(some p intersectionOf(A B )[A] • intersectionOf(restriction(some (p A)) restriction(some (p B)))[B] • Quentin has a friend who is Happy (Charlie) and a friend who is a Student (Bob). Quentin is not known to have a friend who is both Happy and a Student. • We are able to infer that Quentin is an instance of [A], but not of [B].
Distribution Rules • Distribution rules for universal quantification are similar to those for and/or: • restriction(all p intersectionOf(A B) intersectionOf(restriction(all (p A)) restriction(all (p B))) • There are also inferences that can be drawn between expressions involving universal quantification and disjunction: • intersectionOf(restriction(all (p A)) restriction(all (p B))) unionOf(restriction(all (p A)) restriction(all (p B))) • restriction(all p intersectionOf(A B) unionOf(restriction(all (p A)) restriction(all (p B))) • unionOf(restriction(all (p A)) restriction(all (p B))) restriction(all p unionOf(A B) • Again, the above inferences are not logical equivalences. • Intersection is distributive in existentials, union is not.
Closed and Open Worlds • In our previous examples, we find that Patricia is not an instance of • restriction(all friends intersectionOf(Student Happy)) • This is due to the open world assumption (OWA). • We cannot assume that if we don’t know something then it is false. • In this example, there may be other friends that Patricia has that are not Students. • Reasoning in DLs is monotonic • If we know that x is an instance of A, then adding more information to the model cannot cause this to become false.
Example Individuals Individual(a:Xanthe type(restriction(a:hasFriend cardinality(1))) value(a:hasFriend a:Arthur)) Individual(a:Yolanda type(restriction(a:hasFriend cardinality(2))) value(a:hasFriend a:Charlie) value(a:hasFriend a:Bob)) Individual(a:Zaphod type(restriction(a:hasFriend cardinality(1))) value(a:hasFriend a:Charlie)) Individual(a:Zeke type(restriction(a:hasFriend cardinality(1))) value(a:hasFriend a:Bob)) • The above individuals have extra cardinality constraints that close the roles and allow us to make inferences about all the friends that they have. • So Xanthe is now an instance of • restriction(all friends intersectionOf(Student Happy))
Billy No Mates • William has no friends. • But William is an instance of: • restriction(all friends intersectionOf(Student Happy)) • restriction(all friends unionOf(Student Happy)) • In fact he’s an instance of • restriction(all friends X) • For any X (even Nothing). • Universal quantification over an empty collection is trivially true. Individual(a:William type(restriction(a:hasFriend cardinality(0))))
UNA revisited • Fred has exactly one friend. • Fred has a friend John and friend Jack • This allows us to infer that John and Jack must be the same person. • Recall that this inference would not drawn by many DL reasoners (including the current implementation of RACER) – instead in this case an inconsistency will be deduced. Individual(a:Fred type(restriction(a:hasFriend cardinality(1))) value(a:hasFriend a:John) value(a:hasFriend a:Jack)) Individual(a:John) Individual(a:Jack)