This document discusses the Web Ontology Language (OWL), which allows defining classes, individuals, and properties to represent domain knowledge and interconnections in a machine-readable format. OWL builds upon RDF and RDF Schema by adding more expressive features to define complex class descriptions and restrictions over properties. These features include logical class constructors, quantifiers to specify property restrictions, and cardinality constraints. OWL syntax can represent ontologies as XML documents that define classes, properties, and individuals with semantic relationships.
Unleash Your Potential - Namagunga Girls Coding Club
Semantic Web - OWL
1. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu
Semantic Web
Unit 6: Web Ontology Language
Faculty of Science, Technology and Communication (FSTC)
Bachelor en informatique (professionnel)
2. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 2
6. Web Ontology Language (OWL)
Semantic Web Roadmap:
Controlled growth bottom
up according to this
architecture.
Architecture was (slightly)
modified in the last years.
3. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 3
6.1. Ontologies and OWL
6.2. OWL Syntax
6.3. OWL expressivity
6.4. References
6. Web Ontology Language (OWL)
4. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu
Limitations of RDF rdfs:Resource
foaf:Person
worksFor
age
myNS:Firm
How many firms can a person work for at
maximum?
Must every person work for a firm?
RDF allows to describe and serialize semantics in a machine readable form
RDF allows to reuse and share vocabularies
RDF is very limited in expressing restrictions over properties
Very limited reasoning services
6.1. Ontologies and OWL
6. Web Ontology Language (OWL)
5. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 5
6.1. Ontologies and OWL
Level of knowledge representation and semantics
XML / XML Schema
objects, structure
RDF / RDF Schema
knowledge about
objects, relations
between objects
OWL
domain knowledge,
interconnections
6. Web Ontology Language (OWL)
6. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 6
6.1. Ontologies and OWL
Level of knowledge representation and semantics
OWL
domain knowledge,
interconnections
An ontology is an explicit, formal specification of a
shared conceptualization (Thomas R. Gruber, 1993)
Conceptualization : abstract model of domain related expressions
Specification : domain related
Explicit : semantics of all expressions is clear
Formal : machine-readable
Shared : consensus (different people have different perceptions)
6. Web Ontology Language (OWL)
7. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 7
6.1. Ontologies and OWL
Web Ontology Language characteristics
OWL: W3C recommendation since 2004
Allows to define classes, instances of classes, properties and restriction over properties
OWL can be serialized as XML
No unique name assumption if two objects are different, then this must be specified
explicitly
Example:
Woman Person Female
Man Person Male
Does not mean that Woman Man
Woman Person Female
Man Person Male Woman
Open World Assumption what is not explicitly specified is not false
Example:
Woman(Barbara)
Is Barbara a woman? YES
Is Barbara a man? Don’t know
6. Web Ontology Language (OWL)
OWL2: W3C recommendation since 2009
8. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 8
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Level of representation (example)
formal semantics of OWL (Description Logics syntax)
<owl:Class rdf:ID="Woman">
<rdfs:subClassOf rdf:resource="#Person">
</owl:Class>
Woman Person
abstract syntax
class(a:Woman partial a:Person)
XML serializaion
Namespaces
<rdf:RDF
xmlns ="http://www.linckels.lu/demoOntology#"
xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsd ="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs ="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl ="http://www.w3.org/2002/07/owl#" >
...
</rdf:RDF>
9. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 9
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Defining an ontology
<owl:Ontology rdf:about="">
<rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
This is an example of how to declare an ontology
</rdfs:comment>
<owl:versionInfo>v0.5</owl:versionInfo>
<owl:imports rdf:resource="http://www.linckels.lu/demo"/>
<owl:priorVersion rdf:resource="http://www.semweb.de/swrc"/>
</owl:Ontology>
OWL document header (example)
Inherited from RDF Schema Further OWL elements
rdfs:comment
rdfs:label
rdfs:seeAlso
rdfs:isDefinedBy
owl:versionInfo
owl:priorVersion
owl:backwardCompatibleWith
owl:incompatibleWith
owl:DeprecatedClass
owl:DeprecatedProperty
owl:imports
10. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 10
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Classes in OWL
OWL classes are similar to RDFS classes
There exist 2 predefined classes:
• Thing : the top class () which contains all individuals
• Nothing : the bottom or empty class ()
Defining a class:
<owl:Class rdf:about="Woman" />
Individuals in OWL
OWL individuals are similar to RDFS objects
Defining an individual:
<rdf:Description rdf:about="Barbara">
<rdf:type rdf:resource="#Woman" />
</rdf:Description>
<Woman rdf:about="Barbara" />
=
<NamedIndividual rdf:about="Barbara">
<rdf:type rdf:resource="#Woman"/>
</NamedIndividual>
11. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 11
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Roles in OWL
OWL roles are similar to RDFS properties
There exist 2 variants of properties:
• object properties : defining relations between classes
• datatype properties : defining property datatypes
Example of an object property:
<owl:ObjectProperty rdf:about="worksFor">
<rdfs:domain rdf:resource="#Person" />
<rdfs:range rdf:resource="#Firm" />
</owl:ObjectProperty>
Example of a datatype property:
<owl:DatatypeProperty rdf:about="age">
<rdfs:domain rdf:resource="#Person" />
<rdfs:range rdf:resource="&xsd;integer" />
</owl:DatatypeProperty>
rdfs:Resource
Person
worksFor
age
Firm
12. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 12
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Roles in OWL
Example of an instance with roles:
<Firm rdf:about="BigCompany" />
<Person rdf:about="Barbara">
<age rdf:datatype="&xsd;integer">26</age>
<worksFor rdf:resource="#BigCompany" />
</Person>
rdfs:Resource
Person
worksFor
age
Firm
<NamedIndividual rdf:about="BigCompany">
<rdf:type rdf:resource="Firm"/>
</NamedIndividual>
<NamedIndividual rdf:about="Barbara">
<rdf:type rdf:resource="Person"/>
<age rdf:datatype="&xsd;integer">26</age>
<worksFor rdf:resource="#BigCompany" />
</NamedIndividual>
13. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 13
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Hierarchy of classes
Inheritance as disjointness
<owl:Class rdf:about="Person" />
<owl:Class rdf:about="Woman">
<rdfs:subClassOf rdf:resource="#Person" />
</owl:Class>
<owl:Class rdf:about="Mother">
<rdfs:subClassOf rdf:resource="#Woman" />
</owl:Class>
<owl:Class rdf:about="Man">
<rdfs:subClassOf rdf:resource="#Person" />
<owl:disjointWith rdf:resource="#Woman" />
</owl:Class>
<owl:Class rdf:about="Father">
<rdfs:subClassOf rdf:resource="#Man" />
</owl:Class>
Logical inference allows to conclude that
• Mother is a sub-class of Person
• Father is disjoint with Mother
Person
Woman
Mother
Man
Father
Can a
woman
be a
man?
14. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 14
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Hierarchy of classes
Equivalent classes
<owl:Class rdf:about="Personne">
<owl:equivalentClass rdf:resource="#Person">
</owl:Class>
<owl:Class rdf:about="Woman">
<rdfs:subClassOf rdf:resource="#Person" />
</owl:Class>
Logical inference allows to conclude that Woman is a
sub-class of Personne
Logical inference allows to conclude that Barbara is
also an instance of Personne
<Person rdf:about="Barbara" />
PersonPersonne
Woman
=
15. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 15
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Special statements
Two individuals can be declared as being the same by linking them together, e.g.,
<owl:Person rdf:about="William_Jefferson_Clinton">
<owl:sameAs rdf:resource="BillClinton" />
</owl:Person>
Person
fullname
Two URIs actually refer to the same thing: the individuals have the
same "identity"
An owl:allDifferent statement allows to specify a list of individuals that are all disjoint
An owl:differentFrom statement indicates that two URIs refer to different individuals
<owl:AllDifferent>
<owl:distinctMembers rdf:parseType="Collection">
<Person rdf:about="#William_Jefferson_Clinton"/>
<Person rdf:about="#BillClinton"/>
<Person rdf:about="#President_Clinton"/>
</owl:distinctMembers>
</owl:AllDifferent>
16. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 16
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Special statements
Declaration of a finite list of individuals
<owl:Class rdf:about="Continent">
<owl:oneOf rdf:parseType="Collection">
<owl:Thing rdf:about="#Europe">
<owl:Thing rdf:about="#Asia">
<owl:Thing rdf:about="#Africa"/>
<owl:Thing rdf:about="#NorthAmerica"/>
<owl:Thing rdf:about="#SouthAmerica"/>
<owl:Thing rdf:about="#Australia"/>
</owl:oneOf>
</owl:Class>
Here, an instance of the class Continent can only be one of the indicated individuals, e.g.,
<Continent rdf:about="Europe" />
17. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 17
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Special statements
Logical constructors over classes:
• owl:intersectionOf : conjunction of classes
• owl:unionOf : disjunction of classes
• owl:complementOf : negation
Such logical constructors are used to build complex classes from simple classes, e.g., to build
the following concept description:
Mother Woman hasChild.Person
simple class simple value restrictionconjunction
concept description for the new complex class Mother
A mother is a woman who has, among all other things, at least one child who is a person.
18. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 18
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Restrictions over properties
Example:
To express that a Parent can only have a child that is a person, a
restriction over the property hasChild is required, formally:
Parent hasChild.Person
<owl:ObjectProperty rdf:about="hasChild">
<rdfs:domain rdf:resource="#Parent" />
<rdfs:range rdf:resource="#Person" />
</owl:ObjectProperty>
<owl:Class rdf:about="Parent">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasChild" />
<owl:allValuesFrom rdf:resource="#Person" />
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
Using the universal quantifier ()
RDFS specification: the
value of the property goes
from Parent to Person
OWL restriction:
instances of the hasChild
property must have the
value Person
19. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 19
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Restrictions over properties
Example:
To express that a Parent has at least one child, and that child is a
person, a restriction over the property hasChild is required,
formally:
Parent hasChild.Person
<owl:ObjectProperty rdf:about="hasChild">
<rdfs:domain rdf:resource="#Parent" />
<rdfs:range rdf:resource="#Person" />
</owal:ObjectProperty>
<owl:Class rdf:about="Parent">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasChild />
<owl:someValuesFrom rdf:resource="#Person" />
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
Using the existential quantifier ()
20. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 20
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Restrictions over properties
Example:
To express that a Parent can only have a child that is a person, a
restriction over the property hasChild is required, formally:
Parent hasChild.Person
<owl:ObjectProperty rdf:about="hasChild">
<rdfs:domain rdf:resource="#Parent" />
<rdfs:range rdf:resource="#Person" />
</owal:ObjectProperty>
<owl:Class rdf:about="Parent">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasChild" />
<owl:hasValue rdf:resource="#Person" />
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
Special case of
owl:someValuesFrom
Specifying a fix value restriction for a property
21. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 21
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Restrictions over properties
Example:
To express that a Parent must have exactly 3 children a restriction
over the property hasChild is required, formally:
Parent 3hasChild
<owl:ObjectProperty rdf:about="hasChild">
<rdfs:domain rdf:resource="#Parent" />
<rdfs:range rdf:resource="#Person" />
</owal:ObjectProperty>
<owl:Class rdf:about="Parent">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasChild />
<owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">
3
</owl:cardinality>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
Exact cardinality specification
owl:minCardinality and
owl:maxCardinality allow to
specify the boundaries
22. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 22
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Relations between properties
<owl:ObjectProperty rdf:about="hasParent">
<owl:inverseOf rdf:resource="#hasChild" />
</owal:ObjectProperty>
Relations between properties can be expressed:
owl:subPropertyOf : specifying hierarchies of properties
owl:inverseOf : specifies inverse properties, e.g., isParentOf hasChild–
owl:equivalentProperty : specifying identical properties
Defining advanced property characteristics:
owl:TransitiveProperty : R is transitive iff,
(x,y,z) R(x,y) R(y,z) R(x,z)
owl:SymmetricProperty : R is symmetric iff,
(x,y) R(x,y) iff R(y,x)
owl:FunctionalProperty : R is functional iff,
(x,y,z) R(x,y) R(x,z) y=z
owl:InverseFunctionalProperty: R is inverse functional iff,
(x,y,z) R(y,x) R(z,x) y=z
23. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 23
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Relations between properties
<owl:ObjectProperty rdf:about="isLocated">
<rdf:type rdf:resource="&owl;TransitiveProperty" />
<rdfs:domain rdf:resource="&owl;Thing" />
<rdfs:range rdf:resource="#Location" />
</owl:ObjectProperty>
<Location rdf:about="EschAlzette">
<isLocated rdf:resource="#Luxembourg" />
</Location>
<Location rdf:about="Luxembourg">
<isLocated rdf:resource="#Europe" />
</Location>
<Location rdf:about="Europe" />
Example of a transitive property:
Esch/Alzette is located in Luxembourg and Luxembourg is located in Europe
Logical inference allows to conclude that Esch/Alzette is located in Europe
26. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 26
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Relations between properties
<owl:ObjectProperty rdf:about="hasUncle">
<owl:propertyChainAxiom rdf:parseType="Collection">
<owl:ObjectProperty rdf:resource="hasParent" />
<owl:ObjectProperty rdf:about="hasBrother" />
</owl:propertyChainAxiom>
</owl:ObjectProperty>
OWL2 allows role chains
Example:
The brother of my parent is my uncle.
hasUncle hasParent ◦ hasBrother
27. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 27
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Building concept descriptions
<owl:Class rdf:about="Parent">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Person"/>
<rdf:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasChild" />
<owl:someValuesFrom rdf:resource="#Person" />
</owl:Restriction>
</rdf:subClassOf>
</owl:intersectionOf>
</owl:Class>
Building concept descriptions means creating an intersection of concepts and value restrictions
Example 1:
A Parent is a Person and has at least one child, and that child is a person, formally:
Parent Person hasChild.Person
28. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 28
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Building concept descriptions
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Person"/>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasChild"/>
<owl:allValuesFrom>
<owl:unionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Doctor"/>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasChild"/>
<owl:someValuesFrom rdf:resource="#Doctor"/>
</owl:Restriction>
</owl:unionOf>
</owl:allValuesFrom>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
Example 2: Person hasChild.(Doctor hasChild.Doctor)
29. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 29
6.2. OWL Syntax
6. Web Ontology Language (OWL)
Summary
OWL DL implements DL
30. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 30
6.3. OWL expressivity
6. Web Ontology Language (OWL)
OWL and Description Logics
Complete list of differences:
http://www.w3.org/TR/owl-ref/#Sublanguage-def
OWL Full
OWL DL
OWL
Lite
OWL exists in three variants with a different degree of expressivity:
OWL Lite
•classification hierarchy
•simple constraints
•cardinality constraints
•cardinality values [0..1]
•no container classes
•no disjunction
•simple computable and
decidable inferences
•complexity: ExpTime
(worst case)
OWL DL
•based on DL
•includes all OWL
language constructs
•several limitations, e.g.,
no reification
•computable and
decidable inferences
•complexity: NExpTime
(worst case)
OWL Full
•highest level of
expressivity
•a class can be treated
simultaneously as a
collection of individuals,
and as an individual in its
own right
•allows an ontology to
augment the meaning of
the pre-defined (RDF or
OWL) vocabulary.
•complex reasoning
allowed but no guarantee
to be computable and
decidable
31. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 31
6.3. OWL expressivity
6. Web Ontology Language (OWL)
OWL Full
OWL Full
OWL DL
OWL
Lite
All DL and RDF(S) elements
No difference between classes, roles and individuals
• owl:Thing is the same than rdfs:resource
• owl:Class is the same than rdfs:Class
• owl:DatatypeProperty is a sub-class of owl:ObjectProperty
• owl:ObjectProperty is the same than rdf:Property
OWL DL
Not all RDF(S) elements are allowed, e.g., not allowed: rdfs:class and rdfs:Property
Classes and roles are separated
Roles cannot be transitive, symmetric, inverse or functional inverse
OWL Lite
Not allowed elements: oneOf, unionOf, complementOf, hasValue, and disjointWith
Restriction over properties allow only cardinalities of 0 and 1
32. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 32
6.3. OWL expressivity
6. Web Ontology Language (OWL)
OWL and Description Logics
OWL DL-sublanguages:
OWL Full
OWL DL
OWL
Lite
: and + (transitive roles)
: for role hierarchy, e.g., hasDaugher hasChild
: for nominals/singleton classes, e.g., Luxembourg(Luxembourg)
: for inverse roles, e.g., isChildOf hasChild–
: for number restrictions, e.g., ≤2hasChild
: for qualified number restriction, e.g., ≤hasChild.Doctor
OWL Lite is (D), where D stands for a datatype theory
OWL DL is (D), where D stands for a datatype theory
Datatype theory D is a mapping from a set of datatypes to a set of values, plus a mapping
from data values to their denotation
Example:
Expressing that 1 represents an integer value: "1"^^xsd:integer
33. Semantic Web ::: Serge Linckels ::: http://www.linckels.lu/ ::: serge@linckels.lu 33
6.4. References
6. Web Ontology Language (OWL)
Semantic Web: Concepts,
Technologies and
Applications
K.K. Breitman, M.A. Casanova,
W. Truszkowski
Handbook on Ontologies
Steffen Staab, Rudi Studer
Foundations of Semantic Web
Technologies
Pascal Hitzler, Markus Krötzsch,
Sebastian Rudolph
E-Librarian Service
User-Friendly Semantic
Search in Digital
Libraries
Serge Linckels, Christoph
Meinel