Introduction to Web Ontology Language (OWL)
Bangladesh Short-Term Course (Artificial Intelligence)
Plaban Kumar Bhowmick
Assistant Professor
Centre of Excellence in Artificial Intelligence
Indian Institute of Technology Kharagpur
Ontology is a formal Specification of a shared conceptualization of a domain of interest [Gruber 93]
Formal Specification
of
Conceptualization
Concepts
…
…
…
Domain of
Interest
of
Reasoning
+
Processable
Group of
shared
People
Web agents
Applications
Ontology
Services
What’s there in an ontology?
Person
Man
Woman
Father
Grandfather
Daughter
Aunt
hasAncenstor
hasParent
isWifeof
hasWife
Ontology Language Requirements
Formal Semantics and Reasoning
Limitation of Expressive Power of RDF Schema
Limitation of Expressive Power of RDF Schema
Origins of OWL
DAML
DAML+OIL
OIL
OWL
RDF
Ontology in Layer Cake
OWL-RDFS Connection
SUBJECT
PREDICATE
OBJECT
Same Data Model
OWL-RDFS Connection
rdfs:Resource
rdfs:Class
rdf:Property
owl:Class
owl:ObjectProperty
owl:DatatypeProperty
Three Species of OWL
Three Species of OWL
Three Species of OWL
Full
DL
Lite
The OWL Syntax
<owl:Class rdf:ID="associateProfessor">
<rdfs:subClassOf rdf:resource="#academicStaffMember"/>
</owl:Class>
Class Elements
<owl:Class rdf:about="#associateProfessor">
<owl:disjointWith rdf:resource="#professor"/>
<owl:disjointWith rdf:resource="#assistantProfessor"/>
</owl:Class>
Someone who is an associate professor is not either a professor or an assistant professor
<owl:Class rdf:ID="faculty">
<owl:equivalentClass rdf:resource="#academicStaffMember"/>
</owl:Class>
Define Faculty class to be equivalent to academicStaffMember class
Disjoint
Equivalence
Two Special Classes
owl:Thing
owl:Nothing
Set of all individuals
Empty set
Property Elements
<owl:DatatypeProperty rdf:ID="age">
<rdfs:range rdf:resource=
"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"/>
</owl:DatatypeProperty>
Property Elements
<owl:ObjectProperty rdf:ID="isTaughtBy">
<rdfs:domain rdf:resource="#course"/>
<rdfs:range rdf:resource="#academicStaffMember"/>
<rdfs:subPropertyOf rdf:resource="#involves"/>
</owl:ObjectProperty>
Property Elements
<owl:ObjectProperty rdf:ID="teaches">
<owl:inverseOf rdf:resource="#isTaughtBy"/>
#<rdfs:range rdf:resource="#course"/>
#<rdfs:domain rdf:resource="#academicStaffMember"/>
</owl:ObjectProperty>
Inverse Properties
owl:inverseOf
<owl:ObjectProperty rdf:ID="lecturesIn">
<owl:equivalentProperty rdf:resource="#teaches"/>
</owl:ObjectProperty>
Equivalent Properties
owl:equivalentProperty
Property Restrictions
<owl:Class rdf:about="#firstYearCourse">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#isTaughtBy"/>
<owl:allValuesFrom rdf:resource="#Professor"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
Defining the class of all possible values that a property can take
owl:allValuesFrom
first year courses are taught by only professors
Property Restrictions
<owl:Class rdf:about="#academicStaffMember">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#teaches"/>
<owl:someValuesFrom rdf:resource="#undergraduateCourse"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
Defining the class of some possible values that a property can take
owl:someValuesFrom
all academic staff members must teach at least one undergraduate course
Property Restrictions
<owl:Class rdf:about="#mathCourse">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#isTaughtBy"/>
<owl:hasValue rdf:resource="#949352"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
A specific value that a property can take
owl:hasValue
mathematics courses are taught by staff member with
ID 949358
Property Restrictions
<owl:Class rdf:about="#course">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#isTaughtBy"/>
<owl:minCardinality>
1
</owl:minCardinality>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
Maximum and minimum cardinality
owl:maxCardinality owl:minCardinality
every course is taught by at least someone
OWL Special Properties
OWL Functional Property
OWL Inverse Functional Property
OWL Inverse Functional Property
bioMotherOf (invFunc)
Arjuna
Pritha
Kunti
bioMotherOf (invFunc)
hasBioMother (func)
hasBioMother (func)
Boolean Combinations
<owl:Class rdf:about="#course">
<rdfs:subClassOf>
<owl:complementOf rdf:resource="#staffMember"/>
</rdfs:subClassOf>
</owl:Class>
Set complement operation
owl:complementOf
Courses and staff members are complement
Boolean Combinations
<owl:Class rdf:ID="peopleAtUni">
<owl:equivalentClass>
<owl:unionOf rdf:parseType="Collection">
<owl:Class rdf:about="#staffMember"/>
<owl:Class rdf:about="#student"/>
</owl:unionOf>
</owl:equivalentClass>
</owl:Class>
Set union operation
owl:unionOf
People at university consist of staff members and students
Boolean Combinations
<owl:Class rdf:ID="facultyInCS">
<owl:equivalentClass>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#faculty"/>
<owl:Restriction>
<owl:onProperty rdf:resource="#belongsTo"/>
<owl:hasValue rdf:resource="#CSDepartment"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:equivalentClass>
</owl:Class>
Set intersection operation
owl:inersectionOf
CS faculty is set equal to the intersection of faculty set and set of all objects from CS department
Boolean Enumeration
<owl:Class rdf:ID=“WineColor">
<owl:oneOf rdf:parseType="Collection">
<owl:Thing rdf:about="#White"/>
<owl:Thing rdf:about="#Red"/>
<owl:Thing rdf:about="#Rose"/>
</owl:oneOf>
</owl:Class>
Enumerate a set of individuals
owl:oneOf
Winecolor = {White, Red, Rose}
Defining Individuals
<rdf:Description rdf:ID=“949352”>
<rdf:type> rdf:resource=“#academicStaffMember”
</rdf:Description>
<academicStaffMember rdf:ID=“949352”/>
<owl:NamedIndividual rdf:about=“949352”/>
<rdf:type rdf:resource=“#academicStaffMember”/>
Open World Assumption and Individuals
<owl:ObjectProperty rdf:ID=“isTaughtBy”>
<rdf:type rdf:resource=“&owl;FunctionalProperty” />
</rdf:ObjectProperty>
<course rdf:ID=“CIT1111”>
<isTaughtBy rdf:resource = “#949318”/>
<isTaughtBy rdf:resource = “#949352”/>
</course>
<lecturer rdf:ID=“949318”>
<owl:differentFrom rdf:resource=“#949352”/>
</course>
<lecturer rdf:ID=“949318”>
<owl:sameAs rdf:resource=“#949352”/>
</course>
Defining Distinct Individuals
<owl:AllDifferent>
<owl:distinctMembers rdf:parseType=“Collection”>
<lecturer rdf:about=“#949318” />
<lecturer rdf:about=“#949352” />
<lecturer rdf:about=“#949111” />
</owl:distinctMembers>
</owl:AllDifferent>
OWL Elements
OWL Elements
OWL 2 Extension
<owl:Class rdf:about=“Professor“ />
<Professor rdf:about=“rudiStuder” />
<owl:Class rdf:about=“Institute” />
<owl:ObjectProperty rdf:about=“Professor” />
<Institute rdf:about=“aifb”>
<Professor rdf:resource=“rudiStuder”/>
</Institute>
A name must not stand for both an abstract and an concrete role
OWL 2 Extension
<owl:AllDisjointClasses>
<owl:members rdf:parseType="Collection">
<owl:Class rdf:about="#UndergraduateStudent"/>
<owl:Class rdf:about="#GraguateStudent"/>
<owl:Class rdf:about="#OtherStudent"/>
</owl:members>
</owl:AlllDisjointClasses>
Disjoint Classes more than two
owl:disjointWith owl:AllDisjointClasses
OWL 2 Extension
OWL 2 Extension
OWL 2 Extension
<owl:ObjectProperty rdf:about=“hasExaminer”>
<rdfs:subPropertyOf>
<owl:ObjectProperty>
<owl:inverseOf rdf:resource=“participatedIn”>
</owl:ObjectProperty>
</rdfs:subPropertyOf>
<owl:ObjectProperty>
Inverse property
owl:inverseOf
If exam A has the person B as examiner, then B participates in A; Not every B participating in exam A is an examiner in A
OWL 2 Extension
A
hasExaminer
participtedIn
hasExaminer
participatedIn
subPropertyOf
inverseOf
B1
B2
hasParticipation
OWL 2 Extension
<owl:ObjectProperty rdf:about=“hasUncle”>
<owl:propertyChainAxiom rdf:parseType=“Collection”>
<owl:ObjectProperty rdf:resource=“hasParent”>
<owl:ObjectProperty rdf:resource=“hasBrother”>
<owl:propertyChainAxiom>
<owl:ObjectProperty>
Role Chains
owl:propertyChainAxiom
Concrete roles must not be used
OWL 2 Extension
<owl:Class rdf:about=“Exam”>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource=“hasExaminer”/>
<owl:maxQualifiedCardinality>
2
<owl:maxQualifiedCardinality>
<owl:onClass rdf:resource=“Professor”>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
Qualified Cardinality Restrictions
owl:qualifiedCardinality, owl:minQualifiedCardinality owl:maxQualifiedCardinality
OWL 2 Extension
<owl:Class rdf:about=“SelfTaughtStudent”>
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource=“teaches”/>
<owl:hasSelf rdf:datatype=“&xsd;boolean”>true<owl:hasSelf />
</owl:Restriction>
</owl:equivalentClass>
</owl:Class>
Self Construct
owl:hasSelf
OWL 2 Extension
<owl:NegativePropertyAssertion>
<owl:sourceIndividual rdf:about=“John Nash” />
<owl:assertionProperty rdf:about=“hasColleague” />
<owl:targetIndividual rdf:about=“Alan Turing”>
</owl:NegativePropertyAssertion>
Negated Role Assignments
owl:NegativePropertyAssertion
OWL 2: Functional Style Syntax Specification
Primary Resource
Rector A. et al. (2004) OWL Pizzas: Practical Experience of Teaching OWL-DL: Common Errors & Common Patterns. Engineering Knowledge in the Age of the Semantic Web. EKAW 2004. Springer, Berlin, Heidelberg
Frequent Modelling Errors
Defined Vs. Primitive Class
Equivalent Class
<owl:Class rdf:about="CheeseyPizza">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<rdf:Description rdf:about="Pizza"/>
<owl:Restriction>
<owl:onProperty rdf:resource="hasTopping"/>
<owl:someValuesFrom rdf:resource="CheeseTopping"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
A cheesy pizza is any pizza that has, amongst other things,
some cheese topping
Equivalent Class
A cheesy pizza is any pizza that has, amongst other things,
some cheese topping
Pizza
rdf:type
:hasTopping
rdf:type
Cheese
:hasTopping
rdf:type
Meat
CheesyPizza
rdf:type
Equivalent Class
EquivalentClasses(CheesyPizza
ObjectIntersectionOf(
Pizza
ObjectSomeValuesFrom
(hasTopping Cheese)))
A cheesy pizza is any pizza that has, amongst other things,
some cheese topping
Sub Class
<owl:Class rdf:about=“MargheritaPizza”>
<rdfs:subClassOf>
<owl:Class>
<owl:intersectionOf rdf:parseType=“Collection”>
<owl:Restriction>
<owl:onProperty rdf:resource=“hasTopping”/>
<owl:someValuesFrom rdf:about="MozzarellaTopping“/>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource=“hasTopping”/>
<owl:someValuesFrom rdf:about=" TomatoTopping”/>
</owl:Restriction>
</ owl:intersectionOf>
</owl:Class>
<rdfs:subClassOf>
</owl:Class>
All Margherita pizzas have, amongst other things, some mozzarella topping and also some tomato topping
Sub Class
SubClassOf(MargheritaPizza
ObjectIntersectionOf(
ObjectSomeValuesFrom
(hasTopping Mozzarella)
ObjectSomeValuesFrom
(hasTopping Tomato)))
All Margherita pizzas have, amongst other things, some mozzarella topping and also some tomato topping
Sub Class
SubClassOf(MargheritaPizza
ObjectSomeValuesFrom (hasTopping
ObjectIntersectionOf( Mozzarella Tomato)))
All Margherita pizzas have, amongst other things, some mozzarella topping and also some tomato topping
Sub Class
All Margherita pizzas have, amongst other things, some mozzarella topping and also some tomato topping
:hasTopping
rdf:type
Mozzarella
:hasTopping
rdf:type
Tomato
MargheritaPizza
rdf:type
:hasTopping
rdf:type
Mozzarella
rdf:type
Tomato
MargheritaPizza
rdf:type
Stating Disjointness
<owl:AllDisjointClasses>
<owl:members rdf:parseType="Collection">
<owl:Class rdf:about="#Vegetable"/>
<owl:Class rdf:about="#Meat"/>
<owl:Class rdf:about="#Seafood"/>
<owl:Class rdf:about="#Cheese"/>
</owl:members>
</owl:AlllDisjointClasses>
Vegetable, Meat, Seafood Cheese are all Disjoint
DisjointClasses(Vegetable Meat Seafood Cheese)
<owl:Class rdf:about=“DogOwner”>
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType=“Collection”>
<rdf:Description rdf:about=“Person”/>
<owl:Restriction>
<owl:onProperty rdf:resource=“hasPet”/>
<owl:someValuesFrom rdf:resource=“Dog”/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
A dog owner is any person who has as a pet some dog
SomeValuesFrom: Existensial
EquivalentClasses(DogOwner
ObjectIntersectionOf(
Person
ObjectSomeValuesFrom
(hasPet Dog)))
A dog owner is any person who has as a pet some dog
AllValuesFrom: Universal
<owl:Class rdf:about=“FirstClassLounge”>
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType=“Collection”>
<rdf:Description rdf:about=“Lounge”/>
<owl:Restriction>
<owl:onProperty rdf:resource=“hasOccupant”/>
<owl:allValuesFrom rdf:resource=“FirstClassPassenger”/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
A first class lounge is any lounge where the occupants are
only first class passengers
AllValuesFrom: Universal
EquivalentClasses(FirstClassLounge
ObjectIntersectionOf(
Lounge
ObjectAllValuesFrom
(hasOccupant FirstClassPassenger)))
A first class lounge is any lounge where the occupants are
only first class passengers
AllValuesFrom: Universal
:occupant
rdf:type
FCP
:occupant
rdf:type
FCP
FirstClassLounge
rdf:type
A first class lounge is any lounge where the occupants are
only first class passengers
rdf:type
Lounge
:occupant
rdf:type
FCP
:occupant
rdf:type
SCP
FirstClassLounge
rdf:type
rdf:type
Lounge
<owl:Class rdf:about=“VegPizza”>
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType=“Collection”>
<rdf:Description rdf:about=“Pizza”/>
<owl:Restriction>
<owl:onProperty rdf:resource=“hasTopping”/>
<owl:allValuesFrom>
<owl:unionOf rdf:parseType=“Collection”>
<rdf:Description rdf:about=“Vegetable”/>
<rdf:Description rdf:about=“Cheese”/>
</owl:unionOf>
</owl:allValuesFrom>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
A vegetarian pizza is any pizza which, amongst other things, has only vegetable and/or cheese toppings
EquivalentClasses(VegPizza
ObjectIntersectionOf(
Pizza
ObjectAllValuesFrom(hasTopping
ObjectUnionOf
(Vegetable Cheese))))
A vegetarian pizza is any pizza which, amongst other things, has
only vegetable and/or cheese toppings
A vegetarian pizza is any pizza which, amongst other things, has only vegetable and/or cheese toppings
Pizza
rdf:type
:hasTopping
rdf:type
Veg
:hasTopping
rdf:type
Cheese
VegPizza
rdf:type
Pizza
rdf:type
:hasTopping
rdf:type
Veg
VegPizza
rdf:type
<owl:Class rdf:about=“ProtienLoversPizza”>
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType=“Collection”>
<rdf:Description rdf:about=“Pizza”/>
<owl:Restriction>
<owl:onProperty rdf:resource=“hasTopping”/>
<owl:allValuesFrom>
<owl:intersectionOf rdf:parseType=“Collection”>
<rdf:Description rdf:about=“Meat”/>
<rdf:Description rdf:about=“SeaFood”/>
</owl:intersectionOf>
</owl:allValuesFrom>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
A protein lover’s pizza is any pizza that, amongst other things, has only toppings that are both meat and also seafood
EquivalentClasses(ProtienLoversPizza
ObjectIntersectionOf(
Pizza
ObjectAllValuesFrom(hasTopping
ObjectIntersectionOf
(Meat SeaFood))))
A protein lover’s pizza is any pizza that, amongst other things, has only toppings that are both meat and also seafood
A protein lover’s pizza is any pizza that, amongst other things, has only toppings that are both meat and also seafood
Pizza
rdf:type
:hasTopping
rdf:type
Meat
:hasTopping
rdf:type
Seafood
ProtienLoverPizza
rdf:type
rdf:type
rdf:type
Complement
Complement
‘Some’ does not imply ‘Only’
SubClassOf(MargheritaPizza
ObjectIntersectionOf(
ObjectSomeValuesFrom
(hasTopping Mozzarella)
ObjectSomeValuesFrom
(hasTopping Tomato)))
SubClassOf(MargheritaPizza
ObjectIntersectionOf( ObjectSomeValuesFrom
(hasTopping Mozzarella)
ObjectSomeValuesFrom
(hasTopping Tomato)
ObjectAllValuesFrom
(hasTopping ObjectUnionOf
(Mozzarella Tomato))))
All Margherita pizzas have, amongst
other things, some mozzarella topping
and also some tomato topping
But, these “Margherita pizzas” might also have, say, spicy beef topping
All Margherita pizzas have, amongst
other things, some mozzarella topping
and also some tomato topping
and also have only mozzarella and/or tomato topping
Satisfied
Satisfied
Not Satisfied
‘Only’ does not imply ‘Some’
SubClassOf(EmptyPizza
ObjectComplementOf(
ObjectSomeValuesFrom
(hasTopping owl:Thing)))
EquivalentClasses(VegPizza
ObjectIntersectionOf(
Pizza
ObjectAllValuesFrom (hasTopping
ObjectComplementOf (Meat)))
ObjectAllValuesFrom (hasTopping
ObjectComplementOf (Fish)))))
All empty pizzas, amongst other things, do not have anything as topping
Empty pizza satisfies the definition of vegetarian pizza
A vegetarian pizza is any pizza which, amongst other things, has only topping that is not meat and also has only topping that is not fish.
Confusion between “some not” and “not some”
EquivalentClasses(VegetarianPizzaW
ObjectIntersectionOf(
Pizza
ObjectSomeValuesFrom
(hasTopping (
ObjectComplementOf(Meat)))
ObjectSomeValuesFrom
(hasTopping (
ObjectComplementOf(Seafood))))
A vegetarian pizza (w) is any pizza that, amongst other things, both has
some topping which is not meat and also some topping which is not seafood
Confusion between “some not” and “not some”
EquivalentClasses(VegetarianPizzaC
ObjectIntersectionOf(
Pizza
ObjectComplementOf(
ObjectSomeValuesFrom
(hasTopping Meat))
ObjectComplementOf(
ObjectSomeValuesFrom
(hasTopping Seafood))))
A vegetarian pizza (c) is any pizza that, amongst other things, both
does not have some meat topping and also does not have some seafood topping
A vegetarian pizza (w) is any pizza that, amongst other things, both has
some topping which is not meat and also some topping which is not seafood
A vegetarian pizza (c) is any pizza that, amongst other things, both
does not have some meat topping and also does not have some seafood topping
Pizza
rdf:type
:hasTopping
rdf:type
:hasTopping
rdf:type
VegPizzaW
rdf:type
Pizza
rdf:type
:hasTopping
rdf:type
Meat
:hasTopping
rdf:type
Seafood
VegPizzaC
rdf:type
:hasTopping
Meat
rdf:type
Cardinality Constraints
EquivalentClasses(InterestingPizza
ObjectIntersectionOf(
Pizza
ObjectMinCardinality
(3 hasTopping)))
An interesting pizza is any pizza that, amongst other things, has
at least 3 (distinct) toppings
SubClassOf(Pizza
ObjectMaxCardinality(1 hasBase))
Any pizza, amongst other things, has at most 1 pizza base
An interesting pizza is any pizza that, amongst other things, has at least 3 (distinct) toppings
Pizza
rdf:type
:hasTopping
:hasTopping
InterestingPizza
rdf:type
:hasTopping
Owl:differentFrom
Modest are those people who do not praise themselves
EquivalentClasses(ModestPerson
ObjectIntersectionOf(
Person
ObjectComplementOf(
ObjectHasSelf
(praise))))
All old ladies must have a pet and the pets can only be cats
SubClassOf(OldLady
ObjectIntersectionOf(
ObjectSomeValuesFrom
(hasPet owl:Thing)
ObjectAllValuesFrom
(hasPet Cat)))