OWL2

Chapter 4
Web Ontology Language: OWL2
Grigoris Antoniou
Paul Groth
Frank van Harmelen
Rinke Hoekstra
1
Chapter 4
A Semantic Web Primer
Lecture Outline
1.
2.
3.
4.
5.
6.
2
Introduction
Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS
The OWL Language
OWL2 Profiles
Summary
Chapter 4
A Semantic Web Primer
Introducation

3
The variety of things we described using RDF and
RDF Schema in previous chapters is deliberately
very limited
–
RDF is roughly limited to binary ground predicates (A
ground predicate(闭谓词或已决谓词),is an atomic
formula all of whose argument terms are ground terms(基
项), that is, contain no variables)
–
RDF Schema is roughly limited to a class hierarchy and a
property hierarchy with domain and range restrictions on
these properties
–
Both were designed with flexibility in mind
Chapter 4
A Semantic Web Primer
Introducation

In many cases, however, we need to express more
advanced, more “expressive” knowledge
–

The Web Ontology Working group and the OWL
Working Group have identified a number of
characteristic use cases(用例)for the Semantic
Web
–
4
e.g. that one person has exactly one birth date or, that no
person can be in different cities at the same time
that require much more language features than those that
RDF and RDFS have to offer
Chapter 4
A Semantic Web Primer
Introducation

5
The resulting language, OWL2, for the Web
Ontology Language, is closely related to a fragment
of a family of logics
–
These logics are specially crafted for representing
terminological(术语学的)knowledge
–
They are Description Logic (DL,描述逻辑) which
have a long history and their features are well
understood by the community
–
OWL2 is the second iteration of the OWL language
Chapter 4
A Semantic Web Primer
Lecture Outline
1.
2.
3.
4.
5.
6.
6
Introduction
Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS
The OWL Language
OWL2 Profiles
Summary
Chapter 4
A Semantic Web Primer
Ontology and Ontology Languages
7

We have seen that RDF and RDFS allow us to
describe “concepts” that exist in a domain and
share these descriptions across the Web

What is an ontology?
–
An explicit formal specification of the concepts in a
domain is called an ontology
–
Languages that are used to express ontologies are
therefore called ontology languages
Chapter 4
A Semantic Web Primer
Requirements for Ontology Languages
8

A well-defined(明确定义的)syntax(句法)

A formal(形式化的)semantics

Sufficient expressive power(表现力)

Convenience of expression(表述的便捷)

Efficient reasoning support(推理支持)
Chapter 4
A Semantic Web Primer
Syntax
9

In the area of programming languages, a welldefined syntax is a necessary condition for
machine to process information

A well-defined syntax allows you to write down
everything you would like to express in an
unambiguous manner

OWL2 builds upon RDF and RDFS and uses an
extension of their syntax
Chapter 4
A Semantic Web Primer
Syntax

A well-defined syntax does not have to be very
user-friendly(用户友好的)
–

10
e.g. the RDF/XML syntax is notoriously hard to people
to read
This drawback is not significant because most
ontology engineers will make use of specialized
ontology development tools
Chapter 4
A Semantic Web Primer
Formal Semantics
11

A formal semantics describe the meaning of a
language precisely(精确地)

Precisely means that the semantics does not refer
to any subjective(主观的)intuitions(直觉), nor
is it open to different interpretations(解释)

The combination of a formal semantics with a welldefined syntax allows us to interpret sentences
expressed using the syntax: we now know what is
meant by the sentence
Chapter 4
A Semantic Web Primer
Formal Semantics

Formal semantics also allows us to reason about
the knowledge expressed in the sentences
–
For instance, the formal semantics of RDFS allows us to
reason about class membership
–
Given
:x rdf:type
:C.
:x is an instance of :D
:C rdfs:subClassOf
12
:p rdfs:range
:x :p
:y.
:D.
:D.
Chapter 4
:y rdf:type :D.
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages
13

The expressive power of RDF and RDFS is very
limited : We often need to provide more precise
definitions than what RDF and RDFS allow us to
state

Class Membership(类成员关系)
–
We have seen RDFS offers some simple mechanisms
for determining class membership of instances using
subclass, domain, and range
–
A more precise description of the conditions would
allow for more fine-grained(细粒度的)reasoning
Chapter 4
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages

14
Class Membership
–
For instance, if we declare that certain property-value
pairs are a sufficient condition for membership in a
class :A, then if an instance :x satisfies these
conditions, we can conclude that :x must be an
instance of :A
–
Something is only a tennis match if it involves at least
players, rackets, etc.(necessary condition or
sufficient condition???)
Chapter 4
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages

15
Classification(分类)
–
We would like to use the conditions on class
membership to infer relations between classes
–
For instance, the definition of a tennis match can be
reused to define badminton matches
Chapter 4
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages

16
Equivalence(等价)and equality(相等)
–
It can be useful to express equivalence between
classes. For instance, the class :Tortoise(龟)
and :Land_Turtle share all the members
–
We would like to be able to state when two instances
are the same: the :morning_star and the :evening_star
are names for the same planet :venus
–
It should also be possible to determine equivalence
and equality by applying formal semantics to the
description of the classes
Chapter 4
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages

17
Disjointness(不相交性)and Difference(不同)
–
Sometimes we know that two classes do not share
any instances or that two instances are decidedly not
the same thing
–
For instance, :Winner and :Loser are disjoint classes,
and :roger_federer and :rafael_nadal are different
individuals
Chapter 4
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages


18
Boolean Combinations(布尔组合)of Classes
–
Sometimes classes need to be combined in ways that go
beyond subclass relations
–
For instance, we may want to define the class :Person to be
the disjoint union of :Female and :Male
Local Scope(局部作用域)of Properties
–
rdfs:range states that the instances in the range of a
property all belong to a certain class
–
We can not declare range restrictions that differentiate(区
分) between contexts
Chapter 4
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages

Local Scope of Properties
–

19
For instance, we cannot say that tennis players play
only tennis, while other people may play badminton
Special Characteristics of Properties
–
Transitive(传递)property, such as :greater_than
–
Unique(唯一)property, such as: is_mother_of
–
A property is the inverse(逆)of another property,
like :eats and :is_eaten_by
Chapter 4
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages

20
Cardinality Restrictions(基数限制)
–
Sometimes we need to place restrictions on how many
distinct values a property may or must take
–
For instance, each person has exactly two parents, or
a course is taught by at least one lecturer
Chapter 4
A Semantic Web Primer
Reasoning About Knowledge in
Ontology Languages


21
Consistency(一致性)
–
Once we can determine the relations between classes, we
may also want to determine conflicts(冲突)between their
definitions
–
Suppose we declared that :Fish and :Mammal are disjoint
classes, then it is an error to assert that :dolphin is an
instance of both
–
A sufficiently expressive ontology language would allow us
to detect all these types of inconsistencies(不一致性)
An ontology language must make it as convenient as
possible to build sentences that makes use of its
expressiveness
Chapter 4
A Semantic Web Primer
Reasoning Support

Formal semantics is a prerequisite(先决条件)for
reasoning support

Derivations(推导)such as the preceding ones can be
done mechanically instead of by hand

Automatic reasoning is important because it allows us to
check the correctness of the ontology
–
–
–
22
checking the consistency of the ontology
checking for unintended relations between classes
checking for unintended classifications of instances
Chapter 4
A Semantic Web Primer
Reasoning Support

Checks like the preceding ones are extremely valuable
for
–
–

Formal semantics and reasoning support are usually
provided by
–
–
23
designing large ontologies, where multiple authors are
involved
integrating and sharing ontologies from various sources
mapping an ontology language to a known logical formalism
using automated reasoners that already exist for those
formalisms
Chapter 4
A Semantic Web Primer
Trade-off between Expressive Power
and Efficient Reasoning Support

We need an ontology language richer than RDFS

When designing such languages, one should bear it
in mind the trade-off
–

We need a compromise:
–
24
The richer the logical formalism, the less efficient the
reasoning support becomes, sometimes crossing the
border of decidability
A language can be supported by reasonably efficient
reasoners while sufficiently expressive to represent a
large variety of knowledge
Chapter 4
A Semantic Web Primer
Lecture Outline
1.
2.
3.
4.
5.
6.
25
Introduction
Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS
The OWL Language
OWL2 Profiles
Summary
Chapter 4
A Semantic Web Primer
Compatibility of OWL2 with RDF/RDFS

Ideally, OWL2 would extend RDFS
–
–

But simply extending RDFS would work against
obtaining expressive power and efficient reasoning
–
26
adopts the RDFS meanings of classes and properties and
adds language primitives to offer required expressiveness
consistent with the layered architecture of the Semantic
Web
Certain constructions are very expressive and would lead to
uncontrollable computational properties if included in the
logic underlying OWL2
Chapter 4
A Semantic Web Primer
Two Semantics of OWL2

The full set of requirements for an ontology
language seems unobtainable
–

The W3C working groups split OWL2 into two
different sublanguages
–
27
A language as expressive as a combination of RDFS
with a full logic cannot be supported by any efficient
reasoning
each with a different underlying semantics geared
toward fulfilling different aspects of the full set of
requirements
Chapter 4
A Semantic Web Primer
OWL2 Full: RDF-based Semantics

The entire language is called OWL2 Full and
uses all the OWL2 language primitives

It also allows the combination of these
primitives in arbitrary ways with RDF and RDFS
–
28
For instance, we could impose a cardinality constraint
on the class of all classes, limiting the number of
classes that can be described in any ontology
Chapter 4
A Semantic Web Primer
OWL2 Full: RDF-based Semantics


Advantages of OWL2 Full
–
It is mapped to an RDF-based semantics
–
It is therefore both structurally and semantically fully
upward-compatible with RDF
Disadvantage of OWL2 Full is
–
29
The language has become so powerful as to be
undecidable, dashing any hope of complete reasoning
support
Chapter 4
A Semantic Web Primer
OWL2 DL: Direct Semantics
30

To regain computational efficiency, OWL2 DL is
mapped onto a description logic (DL)

Description logics are a subset of predicate
logic for which efficient reasoning support is
possible

OWL2 DL restricts the way in which the
primitives of OWL2, RDF, and RDFS may be
used
Chapter 4
A Semantic Web Primer
OWL2 DL: Restrictions

OWL2 DL does not allow the application of
OWL2’s primitives to each other

OWL2 DL can only define classes of non-literal
resources
–
31
All OWL2 DL classes are instances of owl:Class rather
than rdfs:Class
Chapter 4
A Semantic Web Primer
OWL2 DL: Restrictions

OWL2 DL strictly separates properties for which
the range includes non-literal resources from
those that relate to literal values
–

In OWL2 DL a resource cannot be a class,
property, or instance at the same time
–
32
All OWL2 DL properties are instances of either
owl:ObjectProperty or owl:DatatypeProperty
They may share the same name but are treated as
distinct things by the underlying logic
Chapter 4
A Semantic Web Primer
Subclass relationships between OWL2
and RDF/RDFS
rdfs:Resource
rdfs:Class
owl:Class
disjoint
rdfs:Literal
rdf:Property
owl:ObjectProperty
owl:DatatypeProperty
Advantages and Disadvantages of
OWL2 DL

Advantages
–

OWL2 DL permits efficient reasoning support and can
make use of a wide range of existing reasoners
Disadvantages
–
We lose full compatibility with RDF: an RDF document
will have to be extended or restricted before it
becomes a legal OWL2 DL document
–
Every legal OWL2 DL document is a legal RDF
document
Lecture Outline
1.
2.
3.
4.
5.
6.
35
Introduction
Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS
The OWL Language
OWL2 Profiles
Summary
Chapter 4
A Semantic Web Primer
The OWL Language

In OWL2, the members of classes are commonly
called individuals(个体)rather than instances
(实例)

When we state that some resource is of a certain
type, we call this an assertion(断言)
–
For instance,
:roger-federer rdf:type :Person.
36
is a class assertion relating the individual :roger_federer to its
class
Chapter 4
A Semantic Web Primer
The OWL Language

When we combine classes, properties, and
instances, they form expressions(表达式)
–
For instance,
_:x
rdf:type
owl:Class;
owl:unionOf (:Man :Woman).
is a class expression that specifies the union of the
classes :Man and :Woman.
37
Chapter 4
A Semantic Web Primer
The OWL Language

If we relate the preceding definition to one of our
classes, we create an axiom(公理)
–
For instance,
:Person owl:equivalentClass _:x.
_:x
rdf:type
owl:Class;
owl:unionOf (:Man :Woman).
is an equivalent class axiom (sometimes called restrictions)
that states that :Person is equivalent to the union we
introduced
38
Chapter 4
A Semantic Web Primer
Syntax

OWL2 builds upon RDF and RDFS and thus can be
expressed using all valid RDF syntaxes

Functional-Style Syntax: much more compact and
readable than many of the other syntaxes
–
Closely relates to the formal structure of ontologies
–
For instance, the above class restrictions can be written as:
EquivalentClasses(:Person ObjectUnionOf(:Man :Woman))
39
Chapter 4
A Semantic Web Primer
Syntax

OWL/XML: This is an XML syntax for OWL2 that does
not follow the RDF conventions
–
The main benefit is that it allows us to interact with ontologies
using standard off-the-shelf(现成的)XML authoring tools
–
For instance, the previous equivalent class restrictions can be
written as:
<EquivalentClasses>
<Class abbreviatedIRI=“:Person”/>
<ObjectUnionOf><Class IRI=“#Man”/><Class IRI=“#Woman”/>
</ObjectUnionOf>
</EquivalentClasses>
40
Chapter 4
A Semantic Web Primer
Syntax

Manchester Syntax: Originally developed by the
University of Manchester, this syntax is designed to be
as human-readable(人类可读的)as possible

It is the syntax used in the user interface of most
ontology editors
–
For instance, the previous equivalent class restrictions can be
written as:
Class: Person
EquivalentTo: Man or Woman
41
Chapter 4
A Semantic Web Primer
Ontology Documents

When using the Turtle syntax, OWL2 ontology
documents, or simply ontologies, are just like any
other RDF document

An OWL2 ontology starts with a collection of
assertions which introduce
–
–
–
–
–
42
–
a base namespace
the ontology itself
its name
possible comments
version control, and
inclusion of other ontologies
Chapter 4
A Semantic Web Primer
An Example of Ontologies
@prefix :<http://www.semanticwebprimer.org/ontologies/apartment
s.ttl#>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology/>.
@prefix dbpedia: <http://dbpedia.org/resource/>.
@base
<http://www.semanticwebprimer.org/ontologies/apartments.ttl>.
43
Chapter 4
A Semantic Web Primer
An Example of Ontologies
<http://www.semanticwebprimer.org/ontologies/apartments.ttl>
rdf: type owl:Ontology;
rdfs:label “Apartments Ontology”^^xsd:string;
rdfs:comment “An example OWL2 ontology”^^xsd:string;
owl:versionIRI
<http://www.semanticwebprimer.org/ontologies/apartments.ttl#1.
0>;
owl:imports <http://dbpedia.org/ontology/>;
owl:imports <http://dbpedia.org/resource/>.
44
Chapter 4
A Semantic Web Primer
Imports

Only one of the assertions that has some
consequences for the logical meaning of the ontology:
owl:imports

owl:imports points to other ontologies and the
axioms of the latter become part of the current
ontology

What kind of problems would this incur?
–
45
In order to use some of the information in DBpedia, we have
to import all 672 million triples described in it
Chapter 4
A Semantic Web Primer
Imports
46

It only allows importing of an entire ontology, not
parts of it

Namespaces are used for disambiguation(消除模棱
两可), while imported ontologies provide definitions
for use

Typically an ontology contains an import statement
for every namespace it uses

The owl:imports property is transitive
Chapter 4
A Semantic Web Primer
Property Types

Object properties: relate individuals to other individuals
:rents
rdf:type owl:ObjectProperty;
rdfs:domain :Person;
rdfs:range
:Apartment;
rdfs:subPropertyOf

:liveIn.
Datatype Properties: relate individuals to literal(文字)values
of a certain data type
:age
rdf:type
owl:DatatypeProperty;
rdfs:range xsd:nonNegativeInteger.
47
Chapter 4
A Semantic Web Primer
Annotation Properties

Annotation properties(注解属性)are properties
that do not carry any meaning under the direct
semantics of OWL2 DL
–

48
That is, they are ignored by a DL reasoner and will be taken
into account by RDFS and OWL2 Full reasoners
Annotation properties are typically used for adding
readable labels, comments, or explanations
Chapter 4
A Semantic Web Primer
An Example of Annotation Properties
:label
rdf:type
owl:AnnotationProperty;
rdfs:range
rdf:PlainLiteral;
rdfs:subPropertyOf
:Apartment
:label
rdf:label.
“Apartment”@en,
“Appartement”@nl.

49
In general case, annotation properties have literal
values, but they may be used to relate non-literal
resources as well
Chapter 4
A Semantic Web Primer
Top and Bottom Properties
50

All object properties in OWL2 are a subproperty of
owl:topObjectProperty

owl:topObjectProperty relates all individuals in the
ontology

Conversely, owl:bottomObjectProperty relates no
individuals

owl:topDataProperty relates all individuals to any
possible literal value

owl:bottomDataProperty relates no individual to any
literal value
Chapter 4
A Semantic Web Primer
Transitive Properties

rdfs:subClassOf is a transitive property

We can define a property as transitive as follows:
:isPartOf rdf:type owl:ObjectProperty;
rdf:type owl:TransitiveProperty.

51
Transitive properties are so-called composite
properties(复合属性): they can be said to be
composed of multiple steps
Chapter 4
A Semantic Web Primer
An Example of Transitive Properties

For instance,
:BaronWayApartment
:isPartOf
:BaronWayBuilding.
:BaronWayKitchen
:isPartOf
:BaronWayApartment.
A reasoner will infer:
:BaronWayKitchen

52
:isPartOf
:BaronWayBuilding.
The last :isPartOf relation is composed of the two
preceding property assertions
Chapter 4
A Semantic Web Primer
Symmetric and Asymmetric Properties
53

Some properties, such as :isAdjacentTo, are
symmetric(对称)

Symmetric properties are equivalent to their
inverse

For other properties, it will never be the case. For
instance, the :isCheaperThan relation is
asymmetric(不对称)
Chapter 4
A Semantic Web Primer
Examples of Symmetric and
Asymmetric Properties
:isAdjacentTo rdf:type
owl:ObjectProperty;
rdf:type
owl:SymmetricProperty.
:isCheapterThan rdf:type
54
owl:ObjectProperty;
rdf:type
owl:AsymmetricProperty;
rdf:type
owl:TransitiveProperty.
Chapter 4
A Semantic Web Primer
Functional and Inverse-Functional
Properties
55

For some properties, we know that every individual
can always have at most one other individual
related via that property

A functional property(函数属性) is a property
that is a function: it relates an individual to at most
one value

For instance, :age, :height, or :directSupervisor
Chapter 4
A Semantic Web Primer
Functional and Inverse-Functional
Properties
56

An inverse-functional property is a property for
which two different individuals cannot have the
same value

For instance, :isTheSocialSecurityNumberfor
Chapter 4
A Semantic Web Primer
Reflexive and Irreflexive Properties

57
Reflexivity(反身性)of a property means that
every individual is related to itself via that property
–
For instance, everything :isPartOf itself
–
or, everything is rdfs:subClassOf itself
Chapter 4
A Semantic Web Primer
Reflexive and Irreflexive Properties

58
Irreflexivity(反自反性)means that no individual is
related to itself via that property
–
Most properties with disjoint domain and range are
irreflexive
–
For instance, :rents
–
or, nobody can be related to himself via property :parentOf
Chapter 4
A Semantic Web Primer
Examples of Reflexive and Irreflexive
Properties
:isPartOf rdf:type owl:ObjectProperty;
rdf:type owl:ReflexiveProperty.
:rents
rdf:type owl:ObjectProperty;
rdf:type
59
owl:IrreflexiveProperty.
Chapter 4
A Semantic Web Primer
Property Axioms
60

In addition to property types, we can specify
additional characteristics of properties in terms of
how they relate to classes and other properties

Domain and range
–
The way that OWL2 treats domain and range for properties
is exactly the same as in RDFS
–
Domains and ranges can only be used to determine class
membership for individuals. For instance,
:p rdfs:range :D.
:x :p
:y.
Chapter 4
A Semantic Web Primer
Inverse Properties

OWL2 allows us to define the inverse of properties

For instance, :rents and :isRentedBy
:isRentedBy
rdf:type owl:ObjectProperty;
owl:inverseOf

61
:rents.
This means that a reasoner will determine that two
individual p and m have the relation
m :isRentedBy p in addition to p :rents m
Chapter 4
A Semantic Web Primer
Equivalent Properties

Properties can also be defined as equivalent

Equivalence is a convenient mechanism for
mapping elements of different ontologies

For instance,
:isPartOf
rdf:type
owl:ObjectProperty;
owl:equivalentProperty dbpedia:partOf.
62
Chapter 4
A Semantic Web Primer
Disjoint Properties

For some properties we know that no two
individuals related via one property can be related
via the other

For instance, :rents and :owns
:rents
63
rdf:type
owl:ObjectProperty;
rdfs:domain :Person;
rdfs:range
:Apartment;
owl:disjointProperty :owns.
Chapter 4
A Semantic Web Primer
Property Chains

A more complex feature of OWL2 is the ability to
define chains of properties

Sometimes it is useful to specify shortcuts along
the graph of properties

For instance, if we know that
:Paul :rents :BaronWayApartment.
:BaronWayApartment :isPartOf :BaronWayBuilding.
:BaronWayBuilding dbpedia:location dbpedia:Amsterdam.
64
Chapter 4
A Semantic Web Primer
Property Chains

We will be able to know that
:Paul :liveIn :Amsterdam.

In OWL2, we can specify this using a property
chain axiom:
:liveIn rdf:type owl:ObjectProperty;
owl:propertyChainAxiom (:rents :isPartOf :location).

65
The property chain axiom does not make
the :liveIn property equivalent to the chains of
properties; it is rather a subproperty of the chain
(or superproperty ???)
Chapter 4
A Semantic Web Primer
Class Axioms
66

Classes are defined by asserting a resource to be
of type owl:Class

Two pre-defined classes: owl:Thing and
owl:Nothing

owl:Thing is the most general class
–
Every individual is an instance of this class
–
Every instance of owl:Class is a subclass of owl:Thing
Chapter 4
A Semantic Web Primer
Class Axioms

67
owl:Nothing class is the empty class
–
owl:Nothing has no instances
–
Every instance of owl:Class is a superclass of
owl:Nothing
–
Inconsistent classes cannot have any instances, thus
equivalent to owl:Nothing
Chapter 4
A Semantic Web Primer
Subclass Relations

Subclass relations are defined as in RDFS
:LuxuryApartment rdf:type owl:Class;
rdfs:subClassOf :Apartment.
68
Chapter 4
A Semantic Web Primer
Class Equivalence

Equivalence(等价)of classes means that every
instance of a class must be an instance of its
equivalent class, and vice versa
:Apartment owl:equivalentClass dbpedia:Apartment

Asserting an equivalent relation between classes is
equivalent to asserting subclass relations in both
directions
:Apartment rdfs:subClassOf dbpedia:Apartment.
dbpedia:Apartment rdfs:subClassOf
69
Chapter 4
:Apartment.
A Semantic Web Primer
Punning

Is dbpedia:Apartment a class?
–
No, it is an individual
@prefix dbpedia: <http://dbpedia.org/resource/>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology/>.
70

The classes in DBpedia ontology are not intended to
classify individual entities but rather individual topics

Treating individuals as classes is called metamodeling(元建模技术), not allowed in the direct
semantics of OWL2
Chapter 4
A Semantic Web Primer
Punning

OWL2 circumvents this limitation by punning(双
关语):
–
Whenever URI dbpedia:Apartment appears in a
class axiom, it is treated as a class
–
Whenever it appears in individual assertions, it is
treated as individual
–
How about?
dbpedia:Apartment rdfs:subClassOf
71
Chapter 4
:Apartment.
A Semantic Web Primer
Enumerations

72
The most straightforward way to define a class is
by explicitly enumerating(列举、枚举)all
individuals
–
though inexpressive and computationally expensive
–
For instance,
:BaronWayRooms rdf:type owl:Class;
owl:one of (:BaronWayKitchen
:BaronWayBedroom1
:BaronWayBedroom 2
:BaronWayLivingroom
:BaronWayBathroom
…).
Chapter 4
A Semantic Web Primer
Disjoint Classes

Disjointness of classes means that no member of
one class can also be a member of the other class

For instance,
:LuxuryApartment owl:disjointWith :ColdWaterFlat.
–
73
No :luxuryApartment can be a :ColdWaterFlat at the
same time
Chapter 4
A Semantic Web Primer
Complement

The complement C of a class A is the class of all
things not belonging to A
–

In other words, the union of A and C is equivalent to
owl:Thing
Complementarity(互补性)is a very poweful
modeling construct
:FurnishedApartment rdfs:subClassOf :Apartment.
:UnfurnishedApartment rdfs:subClassOf :Apartment;
owl:complementOf
74
Chapter 4
:FurnishedApartment.
A Semantic Web Primer
Complement

If we state the following
:SemiDetached owl:disjointWith :Apartment.
What would happen to :SemiDetached?

75
:SemiDetached is empty, equivalent to
owl:Nothing
Chapter 4
A Semantic Web Primer
Union and Disjoint Union

We often know that for some class it is equivalent
to two or more other classes

This can be specified using the owl:unionOf
construct

For example,
:Apartment rdf:type owl:Class;
owl:unionOf (:ColdWaterFlat
:LuxuryApartment
:PenthouseApartment
:StudioApartment…).
76
Chapter 4
A Semantic Web Primer
Union and Disjoint Union

In many cases, the member classes of the union
are mutually disjoint

We can state this directly
:Apartment rdf:type owl:Class;
owl:disjointUnionOf (:FurnishedApartment
:UnfurnishedApartment).
77
Chapter 4
A Semantic Web Primer
Intersection

We can state that a class is exactly the
intersection of two or more other classes

For instance
:LuxuryApartment rdf:type owl:Class;
owl:intersectionOf (:GoodLocationApartment
:LargeApartment
:NiceViewApartment
:LuxuryBathroomApartment).
78
Chapter 4
A Semantic Web Primer
Class Axioms on Properties

OWL2 allows for more fine-grained(细粒度的)
control of class definitions

We can specify additional class axioms
–
–

79
that restrict the set of individuals that may be
considered to be a member of a class by looking at
their properties
that allow us to automatically infer class membership
Class restriction axioms are attached to an owl:Class
by relating them to an anonymous class (an
owl:Restriction)
Chapter 4
A Semantic Web Primer
Universal Restrictions
80

A universal restriction(全称限制)on a class C and
property p states that for every member of C all
values of p belong to a certain class

In other words, the universal restriction can be used
to specify a range for a property (local to the
restricted class)

This type of restriction is built using the
owl:allValuesFrom construct
Chapter 4
A Semantic Web Primer
An Example of Universal Restrictions
:LuxuryBathroomApartment
rdf:type
owl:Class;
rdfs:subClassOf [rdf:type
owl:Restriction;
owl:onProperty :hasBathroom;
owl:allValuesFrom :LuxuryBathroom].

81
The :LuxuryBathroomApartment class is a subclass of the
set of individuals that only have instances of
:LuxuryBathroom as value for :hasBathroom property
Chapter 4
A Semantic Web Primer
An Example of Universal Restrictions
:LuxuryBathroomApartment
rdf:type
owl:Class;
rdfs:subClassOf [rdf:type
owl:Restriction;
owl:onProperty :hasBathroom;
owl:allValuesFrom :LuxuryBathroom].

82
The owl:allValuesFrom restriction merely states that if a
member of the restricted class (that is, the
:LuxuryBathroomApartment class) has a value for the
property, then that value must be a member of the
specified :LuxuryBathroom class.
Chapter 4
A Semantic Web Primer
An Example of Universal Restrictions
:LuxuryBathroomApartment
rdf:type
owl:Class;
rdfs:subClassOf [rdf:type
owl:Restriction;
owl:onProperty :hasBathroom;
owl:allValuesFrom :LuxuryBathroom].

However, the restriction does not require the
property to have any value at all!
–
83
In the above example, a luxury bathroom apartment does
not have to have a bathroom at all!
Chapter 4
A Semantic Web Primer
Existential Restrictions
84

An existential restriction(存在限制)on a Class C
and property p states that for every member of C
there exists at least some value for p that belongs to
a certain class

This type of restriction is specified using an
owl:someValuesFrom keyword
Chapter 4
A Semantic Web Primer
An Exmaple of Existential Restrictions
:LuxuryBathroomApartment
rdf:type
owl:Class;
rdfs:subClassOf [rdf:type
owl:Restriction;
owl:onProperty :hasBathroom;
owl:someValuesFrom :LuxuryBathroom].

85
The :LuxuryBathroomApartment class is a subclass of the set
of individuals that have at least some instance of
:LuxuryBathroom as value for :hasBathroom property
Chapter 4
A Semantic Web Primer
Necessary versus Sufficient
Conditions (preliminaries)

Definition: A necessary condition for some state of affairs
S is a condition that must be satisfied in order for S to obtain.

For example, a necessary condition for getting an A in C341
is that a student hand in a term paper. This means that if a
student does not hand in a term paper, then a student will not
get an A, or, equivalently, if a student gets an A, then a
student hands in a term paper.
(http://philosophy.wisc.edu/hausman/341/Skill/nec-suf.htm)
86
Chapter 4
A Semantic Web Primer
Necessary versus Sufficient
Conditions (preliminaries)

Definition: A sufficient condition for some state of affairs S
is a condition that, if satisfied, guarantees that S obtains.

For example, a sufficient condition for getting an A in C341 is
getting an A on every piece of graded work in the course.
This means that if a student gets an A on every piece of
graded work in the course, then the student gets an A.
(http://philosophy.wisc.edu/hausman/341/Skill/nec-suf.htm)
87
Chapter 4
A Semantic Web Primer
Necessary versus Sufficient
Conditions (Self-Test)
88

Being a mammal is a sufficient condition for being human. (F)

Being human is a sufficient condition for being a mammal. (T)

Being alive is a necessary condition for having a right to life. (T)

Being alive is a sufficient condition for having a right to life. (F)

If it is true that if P then Q, then P is a sufficient condition for
Q. (T)

If it is true that if P then Q, then Q is a necessary condition for
P. (T)
Chapter 4
A Semantic Web Primer
Necessary and Sufficient Conditions
89

The rdfs:subClassOf restriction states necessary
conditions for class membership

We could also have used owl:equivalentClass
property to state that the restricted class is exactly
the same described by the restriction

The owl:equivalentClass restriction states
necessary and sufficient conditions
Chapter 4
A Semantic Web Primer
Necessary and Sufficient Conditions

A reasoner can only directly infer class membership for
individuals based on both necessary and sufficient conditions

For instance, the following does not make a reasoner
conclude that every individual that has a :hasBathroom
relation with an individual of type :LuxuryBathroom must be
an instance of :LuxuryBathroomApartment
:LuxuryBathroomApartment
rdf:type
owl:Class;
rdfs:subClassOf [rdf:type
owl:Restriction;
owl:onProperty :hasBathroom;
owl:someValuesFrom :LuxuryBathroom].
90
Chapter 4
A Semantic Web Primer
Necessary and Sufficient Conditions

The individual might only be an instance of a subclass
of the restriction, for instance, LuxuryBathroomHouse
:LuxuryBathroomApartment
rdf:type
owl:Class;
rdfs:subClassOf [rdf:type
owl:Restriction;
owl:onProperty :hasBathroom;
owl:someValuesFrom :LuxuryBathroom].

91
If we make the class equivalent to the class specified by
the restriction, it is clear that any individual satisfies the
restriction must be a member of the class
Chapter 4
A Semantic Web Primer
Value Restrictions

Value restrictions are helpful when
– we want to define a class based on relations with
known individuals, or specific values for datatype
properties
:AmsterdamApartment
rdf:type
owl:Class;
owl:equivalentClass [rdf:type owl:Restriction;
owl:onProperty dbpedia-owl:location;
owl:hasValue dbpedia:Amsterdam].
92
Chapter 4
A Semantic Web Primer
Cardinality Restrictions

A cardinality restriction constraints the number of
values a certain property may have for a class
:StudioApartment
rdf:type
owl:Class;
owl:subClassOf [rdf:type owl:Restriction;
owl:onProperty :hasRoom;
owl:cardinality “1”^^xsd:integer].
**studio apartment(一居室公寓)
93
Chapter 4
A Semantic Web Primer
Cardinality Restrictions


94
If we additionally specify the class these values need
to belong to, the restriction is said to be qualified(限
定的)
We can turn the previous example into a qualified
cardinality restriction
:StudioApartment
rdf:type
owl:Class;
owl:subClassOf [rdf:type owl:Restriction;
owl:onProperty :hasRoom;
owl:qualifiedCardinality “1”^^xsd:integer];
owl:onClass [owl:unionOf(:LivingRoom
Chapter 4
A Semantic Web Primer
:Kitchen :Bedroom)] ].
Data Range Restrictions and Datatypes
95

Universal and existential restrictions on datatype
properties allow members of a class to have any value
from the specified datatype as value for the property

Sometimes, we need more precise definitions to
define, for instance, the class of adults who can rent
apartments, or the minimum size of apartments
Chapter 4
A Semantic Web Primer
An Example of Data Range
Restrictions
:Adult rdfs:subClassOf dbpedia:Person;
rdfs:subClassOf [ rdf:type owl:Restriction;
owl:onProperty :hasAge;
Anonymous class
owl:someValuesFrom
[ rdf:type rdfs:Datatype;
Anonymous class
owl:onDatatype xsd:integer;
owl:withRestrictions (
[xsd:minInclusive “18”^^xsd:integer]
)
]
].
96
Chapter 4
A Semantic Web Primer
An Example of Data Range
Restrictions

We could also have introduced a new named
datatype for reuse
:AdultAge rdf:type rdfs:Datatype;
owl:onDatatype xsd:integer;
owl:withRestrictions (
[xsd:minInclusive “18”^^xsd:integer] ).
:Adult rdfs:subClassOf dbpedia:Person;
rdfs:subClassOf [ rdf:type owl:Restriction;
owl:onProperty :hasAge;
owl:someValuesFrom :AdultAge].
97
Chapter 4
A Semantic Web Primer
Self Restrictions

Good apartments will sell themselves. You do not need to
spend much time redecorating it for it to sell well
– In OWL2 we can express this using a self restriction
ex:GoodApartment
rdf:type owl:Class;
rdfs:subClassOf [ rdf:type owl:Restriction;
owl:onProperty ex:sells;
owl:hasSelf
“true”^^xsd:boolean ].

98
Not applicable to datatype properties in OWL2 DL
Chapter 4
A Semantic Web Primer
Keys

Databases typically use keys(键)to identify
records
–

99
These keys are not necessarily URIs and it can be
difficult to come up with an elegant conversion
scheme
OWL2 allows us to indicate that, for certain classes,
the value of a specific datatype property should be
considered as a unique identifier(唯一的标识符)
Chapter 4
A Semantic Web Primer
An Example of Keys

For instance, the combination of postcode and street address
number will provide a unique identifier for any dwelling(住宅
)in Netherlands
:postcode rdf:type
owl:DatatypeProperty.
:addressNumber rdf:type owl:DatatypeProperty.
:Dwelling

100
rdf:type owl:Class;
owl:hasKey (:postcode :addressNumber).
Any two individuals(i.e. Dwellings)share the same value for
:postcode and :addressNumber must be considered to be the
same (inverse functional property defined)
Chapter 4
A Semantic Web Primer
Individual Facts
101

We turn our attention to the individual entities
governed by our data model

In many cases, we only need class axioms to infer
extra information

Statements about individuals are called assertions
Chapter 4
A Semantic Web Primer
Class and Property Assertions

Class membership and property assertions in
OWL2 are stated in the same way as in RDFS
:Apartment
rdf:type owl:Class;
:BaronWayApartment rdf:type :Apartment;
:hasNumberOfRooms “4”^^xsd:integer;
:isRentedBy
:Paul.
102
Chapter 4
A Semantic Web Primer
Open-World Assumption
103

The open-world assumption says that we cannot
conclude some statement x to be false simply
because we cannot show x to be true

The opposite assumption (closed-world
assumption) would allow deriving falsity from the
inability to derive truth
Chapter 4
A Semantic Web Primer
Open-World Assumption
Question: “Did it rain in Tokyo yesterday?”
Answer: “I don’t know that it rained, but that’s not
enough reason to conclude that it didn’t rain.”
Open-world assumption is appropriate!
104
Chapter 4
A Semantic Web Primer
Open-World Assumption
Question: “Was there a big earthquake disaster in
Tokyo yesterday?”
Answer: “I don’t know that there was, but if there had
been such a disaster, I’d have heard about it.
Therefore I conclude that there wasn’t such a
disaster.”
Close-world assumption is appropriate!
105
Chapter 4
A Semantic Web Primer
Identity Assertions

Because OWL2 has the open-world assumption, we can
never assume that two individuals with different URIs
must be different entities
–

We might be dealing a single individual with multiple
names
It is often more convenient to state identity(身份)
relations explicitly
:BaronWayApartment owl:sameAs :PaulsApartment;
owl:differentFrom :FranksApartment.
106
Chapter 4
A Semantic Web Primer
Identity Assertions

The list of different individuals can easily grow quite
long

We can state this a bit more elegantly using the
owl:AllDifferent construct
_:x rdf:type owl:AllDifferent;
owl:members (:FranksApartment
107
Chapter 4
:PaulsApartment).
A Semantic Web Primer
Negative Assertions(否定断言)
108

Sometimes we know that something is not the
case

Ruling out(排除)possibilities allows us to infer
new knowledge in an open world

For instance, if :BaronWayApartment is not rented
by :Frank, then we may be able to infer that it is not
:FranksApartment
Chapter 4
A Semantic Web Primer
An Example of Negative Assertions
_:x rdf:type owl:NegativePropertyAssertion;
owl:sourceIndividual :BaronWayApartment;
owl:assertionProperty :isRentedBy;
owl:targetIndividual

109
:Frank.
If owl:assertionProperty points to a datatype
property, we use owl:targetValue instead of
owl:targetIndividual
Chapter 4
A Semantic Web Primer
An Example of Negative Assertions

If we know that an individual is not a member of a
certain class, we can state this by asserting it to be
a member of that class’s complement
:BaronWayApartment
rdf:type [owl:complementOf :LuxuryApartment].
110
Chapter 4
A Semantic Web Primer
Lecture Outline
1.
2.
3.
4.
5.
6.
111
Introduction
Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS
The OWL Language
OWL2 Profiles
Summary
Chapter 4
A Semantic Web Primer
OWL2 Profiles

112
The OWL2 specification includes a number of socalled profiles(配置文件,概要)
–
Some are subsets of OWL2 DL
–
Others are more expressive without the full
semantics of OWL2 Full

Motivations: Many ontologies tend to use only a
fraction of the language constructs in DL

Reasoner performance can be increased by using a
less expressive language
Chapter 4
A Semantic Web Primer
OWL2 Profiles
In particular, the profiles are
–
restricted by syntax: the semantics of a profile’s
syntax is provided by OWL2 DL specifications
–
defined by logics that can handle at least some
interesting inference service in polynomial time
with respect to either:


113
The number of facts in the ontology, or
The size of the ontology as a whole
Chapter 4
A Semantic Web Primer
OWL2 EL



114
The primary strength of OWL2 EL lies in the ability to
reason in polynomial time(多项式时间)on
ontologies with a large number of class axioms(类公
理)
Designed to cover the expressive power of several
existing large-scale ontologies in the health care(卫
生保健) and life sciences domain (e.g. SNOMED-CT,
Gene Ontology, and GALEN)
The most significant difference from OWL2 DL is it
drops owl:allValuesFrom restriction but supports
rdfs:range restriction
Chapter 4
A Semantic Web Primer
OWL2 QL
115

Reasoners developed for OWL2 DL and OWL2 EL
are relatively inefficient when dealing with ontologies
that have relatively uncomplicated class definitions
and contain a large number of assertions

The QL profile is designed to efficiently handle query
answering on such ontologies

It adopts technologies from relational database
management
Chapter 4
A Semantic Web Primer
OWL2 RL

The RL profile of OWL2 is based on so-called
Description Logic Programs(描述逻辑程序), enabling
interactions between description logics and rules

It is the largest syntactic fragment of OWL2 DL that is
implementable using rules
–

116
Rules can be run in parallel, thus allowing for scalable
reasoning implementations
Rule implementations of OWL2 RL can implement
subsets of OWL2 Full―OWL2 RL provides a bridge
between OWL2 DL and OWL2 Full
Chapter 4
A Semantic Web Primer
OWL DLP和其他语言的关系
Lecture Outline
1.
2.
3.
4.
5.
6.
118
Introduction
Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS
The OWL Language
OWL2 Profiles
Summary
Chapter 4
A Semantic Web Primer
Summary

OWL2 extends RDF and RDFS with a number of
very expressive language features
–

Formal semantics and reasoning support are
provided by
–
–
119
including cardinality constraints, class equivalence,
intersection, and disjunction
mapping an ontology language to a known logical
formalism
using automated reasoners that already exist for
those formalisms
Chapter 4
A Semantic Web Primer
Summary
120

OWL2 has four standard syntaxes: RDF/XML,
OWL/XML, the Functional-Style syntax, and
Manchester syntax

OWL2 comes in two flavors
–
OWL2 DL imposes some restrictions on the
combination of OWL2 and RDFS elements to retain
decidability(可判定性)
–
OWL2 Full is a fully compatible extension of RDFS with
all OWL2 language features, but is known to be
undecidable
Chapter 4
A Semantic Web Primer
Summary
121

The three profiles, OWL2 EL, OWL2 QL, and
OWL2 RL, are syntactic subsets that have
desirable computational properties

OWL2 RL is implementable using rules and has
become the de facto standard for expressive
reasoning on the Semantic Web
Chapter 4
A Semantic Web Primer