Post on 06-Apr-2018
8/3/2019 OWL Tutorial Final
1/42
Ontology Web Language(OWL)
*Based on the Protg-OWL tutorial by Matthew Horridge et al.
8/3/2019 OWL Tutorial Final
2/42
Stanislav Pokraev
Outline
OWL executive summary
Components of OWL ontologies
Reasoning about OWL ontologies
Examples
8/3/2019 OWL Tutorial Final
3/42
Stanislav Pokraev
OWL Executive Summary
What is OWL
Web Ontology Language
A language to define vocabularies for modelling a world
A language to state facts (claims) about a world
W3C standard (http://www.w3.org/TR/owl-ref/)
http://www.w3.org/TR/owl-ref/http://www.w3.org/TR/owl-ref/http://www.w3.org/TR/owl-ref/http://www.w3.org/TR/owl-ref/8/3/2019 OWL Tutorial Final
4/42
Stanislav Pokraev
Individuals
Represent entities or phenomena in a domain of interest e.g. Netherlands, My_car, Telematica_Instituut
John
JamesAmsterdam
London
Netherlands
Germany
8/3/2019 OWL Tutorial Final
5/42
Stanislav Pokraev
Classes
Person City
Country
An abstraction mechanism for grouping individuals with similarcharacteristics (e.g. Cars, Humans, Red things)
Defined by membership criteria (e.g. having a red color)
hence, two classes with the same members still may be different
We can explicitly state that an individual is a member of a class(e.g. My_car is a Red_Car)
Car
John
JamesAmsterdam
London
Netherlands
Germany
8/3/2019 OWL Tutorial Final
6/42
Stanislav Pokraev
Properties
hasBrother
hasCapitalCity
livesIn
livesIn
Can be defined independently from individuals
Define a binary relationship between two individuals orbetween an individual and a data value
name
PersonCity
CountryCar
John
JamesAmsterdam
London
Netherlands
Germany
25
hasAge
8/3/2019 OWL Tutorial Final
7/42
Stanislav Pokraev
Class Definition
A class can be defined
Axiomaticaly
i.e., by stating that the class exists e.g. Human, Car
By extension
i.e., by enumerating all individuals that belongto the class
e.g. {Belgium, Netherlands, Luxembourg}
By intension
i.e., by defining the membership criteria of theclass
e.g. having a red color
8/3/2019 OWL Tutorial Final
8/42
Stanislav Pokraev
Class Hierarchies
Person
Man
Father
Classes can be organised into a superclass-subclasshierarchy (also known as a taxonomy).
Father Man Person
If an individual is a member of a class, it is a member ofall its superclasses
A Man;we dont know
if it is a Father
8/3/2019 OWL Tutorial Final
9/42
Stanislav Pokraev
A class can be defined
as a subclass of an other class
Man Human.
a necessary condition to be a Man is to be Human
xMan x Human
as an equivalent (synonym) of an other class
MereMortal
Human. a necessary and sufficient condition to be
MereMortal is to be a Human
x MereMortal Human
Class Construction by IntensionSubclasses and Equivalent classes
8/3/2019 OWL Tutorial Final
10/42
Stanislav Pokraev
As an intersection of two or more classes
Human Male ( Man)a necessary and sufficient condition to be a Man is tobe Human and Male
As an union of two or more classes
Human Male
a necessary and sufficient condition to be a member ofthe class is to be Human or Male
Class Construction by IntentionIntersection and Union
Union of Human and Male
8/3/2019 OWL Tutorial Final
11/42
Stanislav Pokraev
Class Construction by IntensionComplement
As the complement of a class
Non_Human Humana necessary and sufficient condition to be aNon_Human is not to be a Human
Human
Non_Human
Either Human or Non_Humanwe dont know
8/3/2019 OWL Tutorial Final
12/42
Stanislav Pokraev
Thing and Nothing
Class owl:Thing ( T ) the necessary and sufficient condition to be a Thing is
always TRUE
All classes are subclasses of T
All individuals are members of T
Class owl:Nothing ( ) the necessary and sufficient condition to be Nothing is
always FALSE
is a subclass of all classes No individual is a member of
8/3/2019 OWL Tutorial Final
13/42
Stanislav Pokraev
Disjoint Classes
ManWoman
Classes that cannot have common members
Woman Man
A sufficient condition not to be a Man is to be a Woman and
vice versa.
a BallPoint
8/3/2019 OWL Tutorial Final
14/42
Stanislav Pokraev
Object and Datatype Properties
Object propertieslink individuals to individuals e.g. James hasFather George
Datatype propertieslink individuals to data values e.g. James hasAge 25
James
hasFather
George
hasAge
25
8/3/2019 OWL Tutorial Final
15/42
Stanislav Pokraev
Classes and Properties
Object properties relate an individual to an individual(i.e., members of Thing)
We can state that an object property can onlyrelate
members of class D (domain) to members of class R(range)
Likewise for a datatype property we can state that itsrange must be a primitive data type or a certain XML
schema type (xsd:int, xsd:string, etc)
8/3/2019 OWL Tutorial Final
16/42
8/3/2019 OWL Tutorial Final
17/42
Stanislav Pokraev
Existential Quantifier Restriction
$prop.ClassA
Defines an (anonymous) class X
necessary and sufficient condition to be member of X isto have at least oneproprelation to a member of ClassA.
$hasChild.Person
8/3/2019 OWL Tutorial Final
18/42
Stanislav Pokraev
Universal Quantifier Restriction
" prop.ClassA
Defines an (anonymous) class X
necessary and sufficient condition to be a memberof X is to have all(zero or more) prop relation to amember of ClassA
"drinks.Water
8/3/2019 OWL Tutorial Final
19/42
Stanislav Pokraev
Combining Existential and UniversalQuantifiers
Vegitarian $eats.VegitarianFood "eats.VegitarianFood
A vegitarian is someone who eats vegitarian food and only eatsvegitarian food
eats
eats
eats
VegitarianFood
Vegitarian
8/3/2019 OWL Tutorial Final
20/42
Stanislav Pokraev
Variations: hasValue Restrictions
prop.individualA
Defines an (anonymous) Class X
necessary and sufficient condition to be member of the Xis to have a prop relation to the individualA.
8/3/2019 OWL Tutorial Final
21/42
Stanislav Pokraev
Variation: Cardinality Restrictions
Defines a anonymous Class X.
necessary and sufficient conditions to be a member of X is tohave a defined number of prop relations to other individualsof a given class
Minimum cardinality restriction ()
Parent1.hasChild
Maximum cardinality restriction ()
LowBuilding 3.hasFloor
Exact cardinality restriction (=
)
Human =2.biologicalParents
8/3/2019 OWL Tutorial Final
22/42
Stanislav Pokraev
Compex Class Construction
Person Female $hasChild.(Person $hasChild.Person)
or
Woman Person Female
Parent Person $hasChild.Person Grandmother Woman $hasChild.Parent
A grandmother is a female person who has at least one childwho also has at least one child
8/3/2019 OWL Tutorial Final
23/42
Stanislav Pokraev
Inferred Relations
We can state that two individuals are related by property P
OWL allows us to infer other relations
Stated relation
Stated relation
Inferred relation
8/3/2019 OWL Tutorial Final
24/42
Stanislav Pokraev
Property Hierarchies
Like classes, properties can be more or less specific
if P Q then
x P y implies x Q y
hasDaughter hasChild
James
hasDaughter
Anna
hasChild
8/3/2019 OWL Tutorial Final
25/42
Stanislav Pokraev
Inverse Property
If Q is inverse property ofPthenx P y implies y Q x
hasParent inverse property hasChild
James
hasChild
Anna
hasParent
8/3/2019 OWL Tutorial Final
26/42
Stanislav Pokraev
Symmetric Property
Netherlands
bordersWith
Germany
borthersWith
If P is a symmetric property thenx P y implies y P x
borthersWith a symmetric property
8/3/2019 OWL Tutorial Final
27/42
Stanislav Pokraev
Transitive Property
If P is a transitive property then
x P y and y P z imply x P z
hasAncestor a transitive property
James
hasAncestor
George Peter
hasAncestor
hasAncestor
8/3/2019 OWL Tutorial Final
28/42
Stanislav Pokraev
Variation: ElementOf and subClass
If C D
x C implies x D
Father Man
James
Father Man
8/3/2019 OWL Tutorial Final
29/42
Stanislav Pokraev
Functional Property
James
hasBirthMother
Peggy
hasBirthMother
Mum
sameAs
Relation that is single (0 or 1) valued
If P is functional property then
x P a and x P b imply ab
If hasBirthMother is a functional property and JameshasBirthMother Peggy and James hasBirthMother
Mum then Peggy and Mum are the same individual
8/3/2019 OWL Tutorial Final
30/42
Stanislav Pokraev
Inverse Functional Property
Relation whose inverse is functional (i.e. the value uniqueidentifies the individual)
If P is inverse functional property then
x P id and y P id implies xy
If isBirthMotherOf is an inverse functional property andPeggy isBirthMotherOf James and MumisBirthMotherOf of James then Peggy and Mum are thesame individual
James
isBirthMotherOf
Peggy
isBirthMotherOf
Mum
sameAs
8/3/2019 OWL Tutorial Final
31/42
Stanislav Pokraev
Property-Level Reasoning
For all stated (black) relationships compute theimplied (red dashed) relationships
hasMother
Peggy James
hasFather
George Peter
hasFather
hasAncestor
hasChild
Anna
hasChild hasChild
hasAncestor
hasParent
hasAncestor
hasAncestor
hasAncestor
hasParent
hasChild
hasAncestor
hasParent hasAncestor
hasParent
8/3/2019 OWL Tutorial Final
32/42
Stanislav Pokraev
Class-level Reasoning Basic Concepts
Subsumption C is subsumed by D if the membership condition for Cimplies the membership condition for D (hence
C D and all members of C are members of D)
Satisfiability
C is unsatisfiable iff C is subsumed by
Equivalence
C and D are equivalent iff C is subsumed by D and D issubsumed by C
Disjointness C and D are disjoint iff the intersection of C and D is
subsumed by
8/3/2019 OWL Tutorial Final
33/42
8/3/2019 OWL Tutorial Final
34/42
Stanislav Pokraev
Individuals-level Reasoning Tasks
Consistency check
checks if an individual can exist in a given model
Realisation
given a partial description of an individual, finds the mostspecific class that describes it
Instance retrieval
finds all individuals that belong to a given class
8/3/2019 OWL Tutorial Final
35/42
Stanislav Pokraev
Example
8/3/2019 OWL Tutorial Final
36/42
Stanislav Pokraev
Queries
Find all rooms
(retrieve (?room)
(?room |Room|)
)
8/3/2019 OWL Tutorial Final
37/42
Stanislav Pokraev
Queries
Find all conference rooms with a beamer
(retrieve (?room)
(?room |ConferenceRoomWithABeamer|)
)
8/3/2019 OWL Tutorial Final
38/42
Stanislav Pokraev
Queries
Is Room_B3.01 connected to the ConfereceRoom_A2.05 ?
(retrieve ()
(|Room_B3.01| |ConferenceRoom_A2.05| |isConnectedTo|)
)
8/3/2019 OWL Tutorial Final
39/42
Stanislav Pokraev
Queries
Find all conference rooms that have a beamer inside
(retrieve (?room)
(and
(?room |ConferenceRoom|)
(?beamer |Beamer|)
(?room ?beamer |hasInside|))
)
8/3/2019 OWL Tutorial Final
40/42
Stanislav Pokraev
Queries
Find all conference rooms that have a beamer inside and
are reachable from Room_B3.01
(retrieve (?room)
(and
(?room |ConferenceRoom|)
(?beamer |Beamer|)(?room ?beamer |hasInside|)
(?room |Room_B3.01| |isConnectedTo|)
)
)
8/3/2019 OWL Tutorial Final
41/42
Stanislav Pokraev
Queries
Find all rooms that have a printer inside, are on the samefloor as Room_B3.01 and are connected to Room_B3.01
(retrieve (?room)
(and
(?printer |Printer|)
(?room |Room|)(?floor |Floor|)
(|Room_B3.01| ?floor |isSpaceOnFloor|)
(?room ?floor |isSpaceOnFloor|)
(?room |Room_B3.01| |isConnectedTo|)
(?printer ?room |isInsideOfSpace|)
)
)
8/3/2019 OWL Tutorial Final
42/42
Queries
Find all printers that are not on the same floor asRoom_B3.01 but are reachable from Room_B3.01
(retrieve (?printer)
(and
(?printer |Printer|)
(?space |Space|)(?floor |Floor|)
(not
(|Room_B3.01| ?floor |isSpaceOnFloor|)
)
(?space ?floor |isSpaceOnFloor|)
(?space |Room_B3.01| |isConnectedTo|)
(?printer ?space |isInsideOfSpace|)
)
)