Inferencia en OWL

Anuncio
Inferencia en OWL
Inferencia y OWL: Ejemplos Prácticos
Sean Bechhofer
Inferencia y Classes
•
•
•
La ontología personas y animales contiene un conjunto de
classes y properties que ilustran aspectos particulares del
razonamiento en OWL
Podemos hacer inferenciass sobre relaciones entre las clases,
en particular subsumption entre clases
A subsumes B cuando una instancia de B debe ser
necesariamente una instancia de A.
A
B
Inferencia e Individuos
•
•
Además, el modelo contiene una serie de individuos
Podemos hacer inferencia sobre individuos, en particular inferir
que individuos particulares deben ser instancias de ciertas
clases
– Esto ocurre debido a las relaciones de subsumption entre classes,
o por las relaciones entre individuos.
Suposición “Unique Name
Assumption”
•
•
El Unique Name Assumption (UNA) dice que dos individuos
con diferentes nombres son individuos distintos.
La semántica de OWL no hace el UNA
– Hay mecanismos en el lenguaje (owl:differentFrom y
owl:AllDifferent) que permiten establecer que individuos son
diferentes.
•
Sin embargo, muchos razonadores DL asumen UNA.
– En los siguientes ejemplos se asume que los individuos son
distintos.
Bus Drivers are Drivers
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)
•
•
•
•
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.
Cat Owners like Cats
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))))
•
•
•
•
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
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
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))
•
•
•
•
•
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.
Giraffes are Vegetarians
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))
•
•
•
•
•
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
Old Ladies own Cats
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))))
•
•
•
•
•
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.
Mad Cows are inconsistent
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)))
•
•
•
•
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.
The Daily Mirror is a Tabloid
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)))
•
•
•
•
•
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.
Pete is a Person, Spike is an Animal
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))
•
•
•
•
•
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.
Walt loves animals
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))))
•
•
•
•
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).
Tom is a Cat
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))))
•
•
•
•
•
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.
Reglas Distributivas
•
Reglas distributivas para cuantificación existencia son similares a la
disjunción y a la conjunción
– restriction(some p unionOf(A B) ≡
unionOf(restriction(some (p A)) restriction(some (p B)))
•
Hay inferencias que pueden hacerse dada la interacción entre la
cuantificación existencial, la intersección y la unión
– 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)
•
•
Estas inferencias no son equivalencias lógicas.
La unión es distributiva en existenciales, la intersección no.
Una ontología simple
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)
•
•
•
Tenemos clases básicas, Person, Academic, Professor y Student.
Hay una subclase de Happy Persons.
Students y Academics son disjuntos.
Ejemplo Individuos
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)))
Professor
Charlie
Diane
Happy
Student
Arthur
Bob
•
Se puede inferir que Professors y Students son disjuntos debido al
axioma de disjunción en relacIón a Academics.
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))
•
Estos individuos proveen testigos para la no equivalencia de definiciones.
– 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].
Reglas de Distribución
•
Reglas de distribución para cuantificación universal son similares a las
de and/or
– restriction(all p intersectionOf(A B) ≡
intersectionOf(restriction(all (p A)) restriction(all (p B)))
•
Hay inferencias que se pueden hacer para expresiones que tienen
cuantificación universal y disjunción:
– 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)
•
•
Estas inferencias no son equivalencias lógicas.
La intersección es distributiva para la cuantificación universal, la unión
no lo es.
Closed and Open Worlds
•
En los ejemplos previos, se tiene que Patricia no es una instancia de
– restriction(all friends intersectionOf(Student Happy))
•
Esto es debido a open world assumption (OWA).
– No podemos suponer que si no sabemos algo es falso.
•
•
En este ejemplo, pueden haber otros amigos de Patricia que no son
Students.
Reasoning en DLs is monotonico
– Si se sabe que x es una instancia de A, entonces añadir más información
al modelo no puede hacer que esto sea falso
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))
•
Los individuos tienen además restricciones de cardinalidad que cierran
los roles y permiten hacer inferencias sobre todos los amigos que
tienen
•
Xanthe es ahora una instancia de
– restriction(all friends intersectionOf(Student Happy))
Billy No Mates
Individual(a:William type(restriction(a:hasFriend cardinality(0))))
•
•
William no tiene amigos.
Pero William es una instancia de:
– restriction(all friends intersectionOf(Student Happy))
– restriction(all friends unionOf(Student Happy))
•
Es una instancia de
– restriction(all friends X)
•
•
Parar cualquier X (even Nothing).
Cuantificación universal sobre un conjunto vacío es trivialmente
verdad.
UNA revisited
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)
•
•
•
Fred tiene exactamente un amigo.
Fred tiene un amigo John y un amigo Jack
Esto permite inferir que John y Jack son la misma persona.
Descargar