83
Introduction to OWL Introduction to OWL http://www.icsd.aegean.gr/kotis/OE&SW’07 http://www.icsd.aegean.gr/kotis/OE&SW’07 ΠΑΝΕΠΙΣΤΗΜΙΟ ΑΙΓΑΙΟΥ ΠΑΝΕΠΙΣΤΗΜΙΟ ΑΙΓΑΙΟΥ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΑΚΩΝ ΚΑΙ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΑΚΩΝ ΚΑΙ ΕΠΙΚΟΙΝΩΝΙΑΚΩΝ ΣΥΣΤΗΜΑΤΩΝ ΕΠΙΚΟΙΝΩΝΙΑΚΩΝ ΣΥΣΤΗΜΑΤΩΝ Πρόγραμμα Μεταπτυχιακών Σπουδών Πρόγραμμα Μεταπτυχιακών Σπουδών Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean - 2007 - 2007

Introduction to OWL Introduction to OWL SW’07 SW’07 ΠΑΝΕΠΙΣΤΗΜΙΟ ΑΙΓΑΙΟΥ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ

Embed Size (px)

Citation preview

Introduction to OWLIntroduction to OWLhttp://www.icsd.aegean.gr/kotis/OE&SW’07http://www.icsd.aegean.gr/kotis/OE&SW’07

ΠΑΝΕΠΙΣΤΗΜΙΟ ΑΙΓΑΙΟΥΠΑΝΕΠΙΣΤΗΜΙΟ ΑΙΓΑΙΟΥ

ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΑΚΩΝ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΑΚΩΝ ΚΑΙ ΕΠΙΚΟΙΝΩΝΙΑΚΩΝ ΣΥΣΤΗΜΑΤΩΝΚΑΙ ΕΠΙΚΟΙΝΩΝΙΑΚΩΝ ΣΥΣΤΗΜΑΤΩΝ

Πρόγραμμα Μεταπτυχιακών ΣπουδώνΠρόγραμμα Μεταπτυχιακών Σπουδών

Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean -  2007Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean -  2007

20/04/23Κώτης Κων/νος - Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007Aegean -  2007 2

Θέματα What is OWL Adds to RDF-S OWL versions (Lite, DL, Full) OWL Syntax Querying

Part of Material was taken from Ian Horrocks lectures series http://www.cs.man.ac.uk/~horrocks/Teaching/cs646/

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 3

Ontology Languages Wide variety of languages for “Explicit Specification”

Graphical notations Semantic networks Topic Maps (see http://www.topicmaps.org/) UML RDF

Logic based Description Logics (e.g., OIL, DAML+OIL, OWL) Rules (e.g., RuleML, LP/Prolog) First Order Logic (e.g., KIF) Conceptual graphs Non-classical logics (e.g., F-logic)

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean

-  2007 4

Ontology Languages Wide variety of languages for “Explicit Specification”

Graphical notations Semantic networks

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean

-  2007 5

Ontology Languages Wide variety of languages for “Explicit Specification”

Graphical notations Topic Maps

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean

-  2007 6

Ontology Languages Wide variety of languages for “Explicit Specification”

Graphical notations UML

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean

-  2007 7

Ontology Languages Wide variety of languages for “Explicit Specification”

Graphical notations RDF

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean

-  2007 8

Ontology Languages Wide variety of languages for “Explicit

Specification” Logic based

Description Logics (e.g., OIL, DAML+OIL, OWL) Rules (e.g., RuleML, LP/Prolog) First Order Logic (e.g., KIF)

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the Aegean

-  2007 9

Ontology Languages Wide variety of

languages for “Explicit Specification” Logic based

Conceptual graphs

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 10

Objects/Instances/Individuals Elements of the domain of discourse Equivalent to constants in FOL

Types/Classes/Concepts Sets of objects sharing certain characteristics Equivalent to unary predicates in FOL

Relations/Properties/Roles Sets of pairs (tuples) of objects Equivalent to binary predicates in FOL

Such languages are/can be: Well understood Formally specified (Relatively) easy to use machine processing

Many languages use “object oriented” model based on:

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 11

Web “Schema” Languages Existing Web languages extended to facilitate content

description XML XML Schema (XMLS) RDF RDF Schema (RDFS)

XMLS not an ontology language Changes format of DTDs (document schemas) to be XML Adds an extensible type hierarchy

Integers, Strings, etc. Can define sub-types, e.g., positive integers

RDFS is recognisable as an ontology language Classes and properties Sub/super-classes (and properties) Range and domain (of properties)

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 12

Problems with RDFS RDFS too weak to describe resources in sufficient detail

No localised range and domain constraints Can’t say that the range of hasChild is Person when applied to persons

and Elephant when applied to elephants No disjoint classes

Can’t say that that male and female are disjoint No union, intersection, complement of classes (boolean combinations of

classes) Can’t say that class person is the disjoint union of classes male and

female No existence/cardinality constraints

Can’t say that all instances of person have a mother that is also a person, or that persons have exactly 2 parents

No transitive, inverse or unique properties Can’t say that “grater than” is a transitive property, that hasPart is the

inverse of isPartOf or that “is mother of” is unique property.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 13

Example Schemas: a “university” description

disjointWithdisjointWith

equivalentClassFaculty

OWL semantics

Not allowed due to disjoint Classes

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 14

Web Ontology Language RequirementsDesirable features identified for Web Ontology Language:

Extends existing Web standards Such as XML, RDF, RDFS

Easy to understand and use Should be based on familiar KR idioms

Formally specified Of “adequate” expressive power Possible to provide automated reasoning support

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 15

Web Ontology Language Requirements

Well defined syntax machine processing of information

…but not user-friendly RDF syntax is hard

However, there are ontology developing tools that solve this problem…e.g. Protégé

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 16

Web Ontology Language Requirements

Formal semantics = describes the meaning of knowledge precisely, i.e.

No subjective intuitions, it is not open to different interpretations (by people or machines)

Importance of formal semantics is large…it allows people to reason about knowledge!!!

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 17

Web Ontology Language RequirementsFor ontological knowledge: Class membership (if x is instance of class C, and C is subclass of D,

then we can infer that x is an instance of D)

Equivalence of classes (if class A is equivalent to class B, and class

B is equivalent to class C, then A is equivalent to C, too)

Consistency check (cannot A and B classes own both the instance

x if these classes are disjoint)

Automatic Classification of instances/concepts (conclude that x must be an instance of class A, if x satisfies certain property-value pairs conditions)

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 18

Web Ontology Language Requirements

Semantics is a “mustmust”” for Reasoning Support. It allows one to:

Check the consistency of the ontology and knowledge

Check (not intended) relations between classes

Automatically classify instances in classes

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 19

Web Ontology Language Requirements

Formal semantics and reasoning are usually provided by mapping ontology language to a known logical formalism…

OWL Description Logic Use already existing reasoners, …FaCT,

RACER. D.L support efficient reasoning

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 20

From RDF to OWL Two languages developed to satisfy above requirements

OIL: developed by group of (largely) European researchers (several from EU OntoKnowledge project)

DAML-ONT: developed by group of (largely) US researchers (in DARPA DAML programme)

Efforts merged to produce DAML+OIL Development was carried out by “Joint EU/US Committee on Agent Markup

Languages” Extends (“DL subset” of) RDF

DAML+OIL submitted to W3C as basis for standardisation Web-Ontology (WebOnt) Working Group formed WebOnt group developed OWL language based on DAML+OIL OWL language now a W3C Candidate Recommendation Has become Proposed Recommendation

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 21

OWL Language Three species of OWL

OWL full is union of OWL syntax and RDF OWL DL restricted to FOL fragment OWL Lite is “easier to implement” subset of OWL DL

OWL DL based on SHIQ Description Logic OWL DL benefits from many years of DL research

Well defined semantics Formal properties well understood (complexity,

decidability) Known reasoning algorithms Implemented systems (highly optimised)

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 22

OWL types

OWL Lite supports those users primarily needing a classification hierarchy and simple constraint features

OWL DL supports those users who want the maximum expressiveness without losing computational completenesscompleteness (all entailments are guaranteed to be computed) and decidabilitydecidability (all computations will finish in finite time) of reasoning systems

OWL Full is meant for users who want maximum maximum expressivenessexpressiveness and the syntactic freedom of RDFsyntactic freedom of RDF with no computational guarantees

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 23

OWL types

Each of these sublanguages is an extension of its simpler predecessor, both in what can be legally expressed and in what can be validly concluded. The following set of relations hold. Their inverses do not. Every legal OWL Lite ontology is a legal OWL DL ontology. Every legal OWL DL ontology is a legal OWL Full ontology. Every valid OWL Lite conclusion is a valid OWL DL

conclusion. Every valid OWL DL conclusion is a valid OWL Full

conclusion

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 24

OWL types

Ontology developers adopting OWL should consider which species best suits their needs. The choice between OWL Lite and OWL DL depends on

the extent to which users require the more expressive restriction constructs provided by OWL DL.

Reasoners for OWL Lite will have desirable computational properties. Reasoners for OWL DL, while dealing with a decidable sublanguage, will be subject to higher worst-case complexity.

The choice between OWL DL and OWL Full mainly depends on the extent to which users require the meta-modelling facilities of RDF Schema (i.e. defining classes of classes).

When using OWL Full as compared to OWL DL, reasoning support is less predictable

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 25

What Are Description Logics? A family of logic based Knowledge Representation

formalisms Descendants of semantic networks and KL-ONE Describe domain in terms of concepts (classes), roles

(relationships) and individuals Distinguished by:

Formal semantics (typically model theoretic) Decidable fragments of FOL Closely related to Propositional Modal & Dynamic Logics

Provision of inference services Sound and complete decision procedures for key problems Implemented systems (highly optimised)

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 26

DL Architecture

Knowledge Base

Tbox (schema)

Abox (data)

Man ≡ Human ⊓ Male

Happy-Father ≡ Man ⊓ ∃ has-child

Female ⊓ …

John : Happy-Father

(John, Mary) : has-child Infe

ren

ce S

yste

m

Inte

rface

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 27

Description Logic Family DLs are a family of logic based KR formalisms Particular languages mainly characterised by:

Set of constructors for building complex concepts and roles from simpler ones

Set of axioms for asserting facts about concepts, roles and individuals

ALC is the smallest DL that is propositionally closed Constructors include booleans (and, or, not), and Restrictions on role successors

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 28

DL Concept and Role Constructors Range of other constructors found in DLs, including:

Number restrictions (cardinality constraints) on roles, e.g., 3 hasChild, 1 hasMother

Qualified number restrictions, e.g., 2 hasChild.Female, 1 hasParent.Male

Inverse roles, e.g., hasChild- (hasParent) Transitive roles, e.g., hasChild* (descendant) Role composition, e.g., hasParent o hasBrother (uncle)

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 29

DL Knowledge Base DL Knowledge Base (KB) normally separated into 2 parts:

TBox is a set of axioms describing structure of domain (i.e., a conceptual schema), e.g.:

HappyFather ≡ Man ⊓ hasChild.Female ⊓ … Elephant ≡ Animal ⊓ Large ⊓ Grey transitive(ancestor)

ABox is a set of axioms describing a concrete situation (data), e.g.:

John:HappyFather <John,Mary>:hasChild

Separation has no logical significance But may be conceptually and implementationally convenient

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 30

OWL as DL: Class Constructors

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 31

OWL example in RDFS Syntax

<owl:Class> <owl:intersectionOf rdf:parseType=" collection"> <owl:Class rdf:about="#Person"/> <owl:Restriction> <owl:onProperty rdf:resource="#hasChild"/> <owl:toClass> <owl:unionOf rdf:parseType=" collection"> <owl:Class rdf:about="#Doctor"/> <owl:Restriction> <owl:onProperty rdf:resource="#hasChild"/> <owl:hasClass rdf:resource="#Doctor"/> </owl:Restriction> </owl:unionOf> </owl:toClass> </owl:Restriction> </owl:intersectionOf></owl:Class>

E.g., Person ⊓ ∀hasChild.Doctor ⊔ ∃hasChild.Doctor:

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 32

OWL as DL: Axioms

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 33

OWL DL Semantics Mapping OWL to equivalent DL:

Facilitates provision of reasoning services (using DL systems) Provides well defined semantics

DL semantics defined by interpretations: I =(I, . I), where I is the domain (a non-empty set) . I is an interpretation function that maps:

Concept (class) name A →subset AI of I

Role (property) name R → binary relation RI over I Individual name i → iI element of I

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 34

DL Knowledge Bases (Ontologies) An OWL ontology maps to a DL Knowledge Base

T (Tbox) is a set of axioms of the form: C ⊑ D (concept inclusion) C ≡ D (concept equivalence) R ⊑ S (role inclusion) R ≡ S (role equivalence) R+ ⊑ R (role transitivity)

A (Abox) is a set of axioms of the form X ∊ D (concept instantiation) (x,y) ∊ R (role instantiation)

Reasoning with OWL

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 36

Why do we want/need to reason with OWL?

Semantic Web aims at “machine understanding”

Understanding closely related to reasoning

Recognising semantic similarity in spite of syntactic

differences

Drawing conclusions that are not explicitly stated

1. Philosophical Reasons

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 37

2. Practical Reasons Given key role of ontologies in e-Science and Semantic

Web, it is essential to provide tools and services to help users:

Design and maintain high quality ontologies, e.g.: Meaningful — all named classes can have instances Correct — captured intuitions of domain experts Minimally redundant — no unintended synonyms Richly axiomatised — (sufficiently) detailed descriptions

Store (large numbers) of instances of ontology classes, e.g.: Annotations from web pages (or gene product data)

Answer queries over ontology classes and instances, e.g.: Find more general/specific classes Retrieve annotations/pages matching a given description

Integrate and align multiple ontologies

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 38

Basic Inference Tasks

OWL Guide/Reference

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 40

OWL Syntax

OWL still uses RDF and RDF Schema to a large extent: All 3 types of OWL use RDF for syntax Instances are declared as in RDF, using RDF

descriptions OWL constructors like owl:Class,

owl:ObjectProperty, owl:DatatypeProperty

are specializations of RDF

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 41

OWL Syntax

Subclass relationship between OWL and RDF/RDFS

rdfs:Resource

rdfs:Class

owl:Class

rdf:Property

owl:ObjectProperty owl:DatatypeProperty

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 42

OWL Syntax

4 different forms RDF/XML syntax XML-based syntax (more easy for humans) Abstract syntax (more readable) Graphic syntax based on UML (human oriented)

We use the first since it is the primary syntax for OWL

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 43

Header - namespaces<rdf:RDF

xmlns:owl ="http://www.w3.org/2002/07/owl#"

xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"

xmlns:xsd ="http://www.w3.org/2001/XMLSchema#">

OWL ontologiesRDF documents

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 44

<owl:Ontology>

“housekeeping”info

Imports content from other ontologies to bePart of the current ontology

Reminder:

•Namespaces are used for disambiguation of resources•Imported ontologies provide definitions that can be used

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 45

Define Classes

Classes are defined with owl :Class element

Subsumption relation (subClassOf)

E.g.

<owl:Class rdf:ID=“associateProfessor”>

<rdfs:subClassOf rdf:resource=“#academicStaff”/>

</owl:Class> Borrows element from RDFSchema

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 46

Define Classes Classes are defined with owl :Class element

Disjoint relation (disjointWith)

E.g.

<owl:Class rdf:ID=“associateProfessor”>

<owl:disjointWith rdf:resource=“#assistantProfessor”/>

<owl:disjointWith rdf:resource=“#Professor”/>

</owl:Class>OWL element

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 47

Define Classes Classes are defined with owl :Class element

Equivalence relation (equivalentClass)

E.g.

<owl:Class rdf:ID=“faculty”>

<owl:equivalentClass rdf:resource=“#academicStaff”/>

</owl:Class>

OWL element

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 48

Predefined Classes - Enumeration Predefined Classes are owl:Thing and owl:Nothing

class extension of owl:Thing is the set of all individuals The class extension of owl:Nothing is the empty set Every OWL class is a subclass of owl:Thing and

owl:Nothing is a subclass of every class

A class description of the "enumeration" kind is defined with the owl:oneOf property. The value of this built-in OWL property must be a list of individuals that are the instances of the class.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 49

Predefined Classes - Enumeration A class can be described by exhaustively enumerating its instances.

The class extension of a class described with owl:oneOf contains exactly the enumerated individuals, no more, no less.

<owl:Class> <owl:oneOf rdf:parseType="Collection">

<owl:Thing rdf:about="#Eurasia"/> <owl:Thing rdf:about="#Africa"/> <owl:Thing rdf:about="#NorthAmerica"/> <owl:Thing rdf:about="#SouthAmerica"/> <owl:Thing rdf:about="#Australia"/> <owl:Thing rdf:about="#Antarctica"/>

</owl:oneOf> </owl:Class>

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 50

Define Classes – boolean combinations Intersection constructor (intersectionOf)

An owl:intersectionOf statement describes a class for which the class extension contains precisely those individuals that are members of the class extension of all class descriptions in the list.

<owl:Class> <owl:intersectionOf rdf:parseType="Collection">

<owl:Class> <owl:oneOf rdf:parseType="Collection">

<owl:Thing rdf:about="#Tosca" /> <owl:Thing rdf:about="#Salome" />

</owl:oneOf> </owl:Class> <owl:Class>

<owl:oneOf rdf:parseType="Collection"> <owl:Thing rdf:about="#Turandot" /> <owl:Thing rdf:about="#Tosca" />

</owl:oneOf> </owl:Class>

</owl:intersectionOf>

</owl:Class>

= “Tosca”

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 51

Define Classes – Boolean combinations union constructor (unionOf)

An owl:unionOf statement describes an anonymous class for which the class extension contains those individuals that occur in at least one of the class extensions of the class descriptions in the list.

<owl:Class> <owl:unionOf rdf:parseType="Collection">

<owl:Class> <owl:oneOf rdf:parseType="Collection">

<owl:Thing rdf:about="#Tosca" /> <owl:Thing rdf:about="#Salome" />

</owl:oneOf> </owl:Class> <owl:Class>

<owl:oneOf rdf:parseType="Collection"> <owl:Thing rdf:about="#Turandot" /> <owl:Thing rdf:about="#Tosca" />

</owl:oneOf> </owl:Class>

</owl:unionOf>

</owl:Class>

= Tosca, Salome, Turandot

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 52

Define Classes – Boolean combinations

More examples

<owl: Class rdf :ID=“peopleAtUni”>

<owl :unionOf rdf :parseType=“Collection”>

<owl :Class rdf :about=“#staffMember”/>

<owl :Class rdf :about=“#student”/>

</owl :unionOf>

</owl :Class>

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 53

Define Properties Properties are defined with owl :ObjectProperty and

owl :DatatypeProperty elements

ObjectProperty relates objects to objects E.g. Course isTaughtBy academicStaff

DatatypeProperty relates objects to datatype values E.g. Age nonNegativeInteger

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 54

Define PropertiesDatatypeProperty relates objects to datatype values

E.g. Age nonNegativeInteger

<owl :DatatypeProperty rdf:ID=“age”>

<rdfs :range rdf :resource= http://www.w3.org/2001/XMLSchema#nonNegativeInteger/>

</owl :DatatypeProperty>

Reminder:Domain/Range= restrictions on the values of properties

e.g. Knowledge Repr. is taught by Semantic Web(no sense) we need to restrict the range of the property

Room B5 is taught by K. Kotis(no sense) we need to restrict the domain of the property

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 55

Define PropertiesObjectProperty relates objects to objects

E.g. Course isTaughtBy academicStaff

<owl :ObjectProperty rdf:ID=“isTaughtBy”>

<rdfs :domain rdf :resource=“#cource”/>

<rdfs :range rdf :resource= “#academicStaff”/>

<rdfs :subPropertyOf rdf :resource=“#involves”/>

</owl :ObjectProperty>

Course academicStaff

isTaughtBydomainrange

involves

Staff

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 56

Define Propertiesowl: inverseOf defines the inverse property of a property

E.g. teaches / isTaughtBy

<owl :ObjectProperty rdf:ID=“teaches”>

<rdfs :domain rdf :resource=“#cource”/>

<rdfs :range rdf :resource= “#academicStaff”/>

<owl :inverseOf rdf :resource=“#isTaughtBy”/>

</owl :ObjectProperty>

Course academicStaff

teaches

domainrange

isTaughtByrange

domain

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 57

Define Propertiesowl: equivalentProperty defines the equivalent of a property

E.g. teaches / lecturesIn

<owl :ObjectProperty rdf:ID=“lecturesIn”>

<owl : equivalentProperty rdf :resource=“#teaches”/>

</owl :ObjectProperty>

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 58

Property restrictionsE.g. :“First year Courses must be taught bytaught by Professors

only”

<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>

Note: the subClassOf is used to declare that if a class C satisfies certain conditions, THEN all instances of C satisfy the conditions. This is equivalent to “C subClassOf D”, where D collects all objects that satisfy the conditions

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 59

Property restrictionsE.g. :“All academic Staff must teachteach at least one

undergraduate Course”

<owl :Class rdf:about=“#academicStaff”>

<rdfs :subClassOf>

<owl :Restriction>

<owl :onProperty rdf :resource=“#teaches”/>

<owl :someValuesFrom rdf :resource=“#undergraduateCourse”/>

</owl :Restriction>

</rdfs :subClassOf>

</owl :Class>

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 60

Property restrictionsE.g. :“Every Course must be taught bytaught by at least

someone”

<owl :Class rdf:about=“#academicStaff”>

<rdfs :subClassOf>

<owl :Restriction>

<owl :onProperty rdf :resource=“#teaches”/>

<owl :minCardinality rdf :datatype=“&xsd;nonNegativeInteger”/>

1

</owl :minCardinality>

</owl :Restriction>

</rdfs :subClassOf>

</owl :Class>

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 61

Property restrictionsE.g. :“A Department must have at least 10 and as most 30 members”

<owl :Class rdf:about=“#department”><rdfs :subClassOf>

<owl :Restriction><owl :onProperty rdf :resource=“#hasMember”/><owl :minCardinality rdf :datatype=“&xsd;nonNegativeInteger”/>

10 </owl :minCardinality>

</owl :Restriction></rdfs :subClassOf><rdfs :subClassOf>

<owl :Restriction><owl :onProperty rdf :resource=“#hasMember”/><owl :maxCardinality rdf :datatype=“&xsd;nonNegativeInteger”/>

30 </owl :maxCardinality>

</owl :Restriction></rdfs :subClassOf>

</owl :Class>

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 62

Property restrictionsE.g. :“A Phd Student must have exactly 3 supervisors”

<owl :Class rdf:about=“#phdStudent”><rdfs :subClassOf>

<owl :Restriction><owl :onProperty rdf :resource=“#hasSupervisor”/><owl :minCardinality rdf :datatype=“&xsd;nonNegativeInteger”/>

3 </owl :minCardinality>

</owl :Restriction></rdfs :subClassOf><rdfs :subClassOf>

<owl :Restriction><owl :onProperty rdf :resource=“#hasSupervisor”/><owl :maxCardinality rdf :datatype=“&xsd;nonNegativeInteger”/>

3 </owl :maxCardinality>

</owl :Restriction></rdfs :subClassOf>

</owl :Class>Use also owl :cardinality

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 63

Special logical Properties TransitiveProperty

E.g. :“the subRegionOf property between RegionsRegions is transitive”

<owl:TransitiveProperty rdf:ID="subRegionOf">

<rdfs:domain rdf:resource="#Region"/>

<rdfs:range rdf:resource="#Region"/>

</owl:TransitiveProperty>

If A,B,C are Regions, and “A subRegionOf B” and “B subRegionOf C”,

THEN the reasoner will be able to derive that “A also subRegionOf C”.

NOTE: OWL DL requires that for a transitive property no local or global cardinality constraints should be declared on the property itself or its superproperties, nor on the inverse of the property or its superproperties.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 64

Special logical Properties SymmetricProperty

E.g. :“the friendOf property between HumansHumans is symmetric”

<owl:SymmetricProperty rdf:ID="friendOf">

<rdfs:domain rdf:resource="#Human"/>

<rdfs:range rdf:resource="#Human"/>

</owl:SymmetricProperty>

If A,B are Humans, and “A friendOf B”

THEN the reasoner will be able to derive that “B also friendOf A”.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 65

Instances (Individuals) In addition to classes, we want to be able to

describe their members. We think of these as individuals in our universe of things. An individual is minimally introduced by declaring it to be a member of a class.

Individuals are defined with individual axioms (also called "facts"). We discuss two types of facts: Facts about class membership and property values of

individuals Facts about individual identity

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 66

Instances -Class membership and property values

Many facts typically are statements indicating class membership of individuals and property values of individuals E.g. an instance of the class Opera

<Opera rdf:ID="Tosca">

<hasComposer rdf:resource="#Giacomo_Puccini"/>

<hasLibrettist rdf:resource="#Victorien_Sardou"/>

<hasLibrettist rdf:resource="#Giuseppe_Giacosa"/>

<hasLibrettist rdf:resource="#Luigi_Illica"/>

<premiereDate rdf:datatype="&xsd;date">1900-01-14</premiereDate>

<premierePlace rdf:resource="#Roma"/>

<numberOfActs rdf:datatype="&xsd;positiveInteger">3</numberOfActs>

</Opera>

..includes a number of facts about the individual Tosca, an instance of the class Opera

<owl:Class rdf:about="#Opera"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasLibrettist" /> <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1 </owl:minCardinality> </owl:Restriction> <owl:Restriction> <owl:onProperty rdf:resource="#hasComposer"/> <owl:minCardinality rdf:datatype="&xsd; nonNegativeInteger">1 </owl:minCardinality> </owl:Restriction> …. </rdfs:subClassOf></owl:Class>

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 67

Instances -Class membership and property values

Subclass vs. instance It is very easy to confuse the instance-of relationship

with the subclass relationship. It may seem arbitrary to choose to make Tosca an

individual that is an instance of Opera, as opposed to a subclass of Opera. This is not an arbitrary decision.

The Opera class denotes the set of all opera varietals, and therefore any subclass of Opera should denote a subset of these varietals. Thus, ToscaTosca should be considered an instance of Opera, and not a subclass. It does not describe a subset of Opera varietals, it is an opera varietal

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 68

Instances -Class membership and property values

E.g. wine ontology

<owl:Class rdf:ID="WineGrape">

<rdfs:subClassOf rdf:resource="&food;Grape" /> </owl:Class>

<WineGrape rdf:ID=“SamosGrape" />

Instance of WineGrape

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 69

Instances - individual identity

Many languages have a so-called "unique names" assumption: different names refer to different things in the world

On the web, such an assumption is not possible E.g. the same person could be referred to in many

different ways (i.e. with different URI references) OWL does not make this assumption

Unless an explicit statement is being made that

“two URI references refer to the same or to different individuals”,

OWL tools should in principle assume either situation is possible.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 70

Instances - individual identity

OWL provides three constructs for stating facts about the identity of individuals: owl:sameAs is used to state that two URI references

refer to the same individual. owl:differentFrom is used to state that two URI

references refer to different individuals owl:AllDifferent provides an idiom for stating that a list of

individuals are all different.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 71

Instances - individual identity

owl:sameAs is used to state that two URI references refer to the same individual…:

<rdf:Description rdf:about="#William_Jefferson_Clinton"> <owl:sameAs rdf:resource="#BillClinton"/>

</rdf:Description>

In OWL Full, where a class can be treated as instances of (meta)classes, we can use the owl:sameAs construct to define class equality, thus indicating that two concepts have the same intensional meaning. An example: <owl:Class rdf:ID="FootballTeam">

<owl:sameAs rdf:resource="http://sports.org/US#SoccerTeam"/> </owl:Class>

<footballTeam owl:equivalentClass us:soccerTeam /> states that the two classes have the same class extension, but are not (necessarily) the same concepts.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 72

Instances - individual identity

owl:differentFrom is used to state that two URI references refer to different individuals An example:<Opera rdf:ID="Don_Giovanni"/> <Opera rdf:ID="Nozze_di_Figaro">

<owl:differentFrom rdf:resource="#Don_Giovanni"/> </Opera> <Opera rdf:ID="Cosi_fan_tutte">

<owl:differentFrom rdf:resource="#Don_Giovanni"/> <owl:differentFrom rdf:resource="#Nozze_di_Figaro"/> </Opera>

This states that there are three different operas.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 73

Instances - individual identity owl:AllDifferent provides an idiom for stating that a list of individuals are all

different. An example:<owl:AllDifferent>

<owl:distinctMembers rdf:parseType="Collection"><Opera rdf:about="#Don_Giovanni"/> <Opera rdf:about="#Nozze_di_Figaro"/> <Opera rdf:about="#Cosi_fan_tutte"/> <Opera rdf:about="#Tosca"/> <Opera rdf:about="#Turandot"/> <Opera rdf:about="#Salome"/>

</owl:distinctMembers> </owl:AllDifferent>

This states that these six URI references all point to different operas.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 74

Examples - Ontologies

http://www.schemaweb.info/schema/BrowseSchema.aspx

http://protege.stanford.edu/plugins/owl/ontologies.html

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 75

Data Types

we have seen the notion of a data range for specifying a range of data values. OWL allows three types of data range specifications: An RDF datatype specification. The RDFS class rdfs:Literal. An enumerated datatype, using the owl:oneOf construct.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 76

Data Types When using datatypes, please note that even if a property is defined to

have a range of a certain datatype, RDF/XML still requires that the datatype be specified each time the property is used. example:

<owl:DatatypeProperty rdf:about="#timeStamp"> <rdfs:domain rdf:resource="#Measurement"/> <rdf:range rdf:resource="&xsd;dateTime"/>

</owl:DatatypeProperty>

<Measurement> <timeStamp rdf:datatype="&xsd;dateTime">2003-01-24T09:00:08+01:00</timeStamp>

</Measurement>

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 77

Data Types OWL provides one additional construct for defining

a range of data values, namely an enumerated datatype. This datatype format makes use of the owl:oneOf construct, that is also used for describing an enumerated class.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 78

Importing an ontology

An owl:imports statement references another OWL ontology containing definitions, whose meaning is considered to be part of the meaning of the importing ontology. Each reference consists of a URI specifying from where the

ontology is to be imported. The owl:imports statements are transitive

if ontology A imports B, and B imports C, then A imports both B and C.

Although owl:imports and namespace declarations may appear redundant, they actually serve different purposes. Namespace declarations simply set up a shorthand for referring

to identifiers. They do not implicitly include the meaning of documents located at the URI.

owl:imports does not provide any shorthand notation for referring to the identifiers from the imported document.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 79

Version information

An owl:versionInfo statement generally has as its object a string giving information about this version

Although this property is typically used to make statements about ontologies, it may be applied to any OWL construct. For example, one could attach a owl:versionInfo

statement to an OWL class.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 80

Layering of OWL OWL Full: all constructors can be used

As long as the result is legal RDF OWL DL

any resource allowed to be only: class, data type, data type property, object property, individual, data value, part of the built-in vocabulary, and not more than one of these e.g. a class cannot be an individual at the same time!!!

Explicit typing, i.e. nothing is assumed, must be declared!!! Set of object properties and data type properties are disjoint. E.g.

cannot specify owl:inverseOf for data type property. No cardinality restrictions may be placed on transitive properties

OWL Lite Do not allow the constructors: (owl:) one of, disjointWith, unionOf,

complementOf, hasValue Cardinality only allowed for values 0 and 1 owl:equivalentClass is only allowed between class identifiers, not

anonymous classes

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 81

Discussion The idea behind the OWL Lite expressivity limitations is that they

provide a minimal useful subset of language features, that are relatively straightforward for tool developers to support.

The language constructs of OWL Lite provide the basics for subclass hierarchy construction: subclasses and property restrictions.

OWL Lite allows properties to be made optional or required. The limitations on OWL Lite place it in a lower complexity class than

OWL DL. This can have a positive impact on the efficiency of complete reasoners for OWL Lite.

Implementations that support only the OWL Lite vocabulary, but otherwise relax the restrictions of OWL DL, cannot make certain computational claims with respect to consistency and complexity. However, such implementations may be useful in providing interoperability of OWL systems with RDFS models, databases, markup tools, or other non-reasoning tools. The Web Ontology Working Group has not provided a name for this potentially useful subset.

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 82

Examples - Ontologies

http://www.schemaweb.info/schema/BrowseSchema.aspx

http://protege.stanford.edu/plugins/owl/ontologies.html

Do not forget that everything about OWL can be found at http://www.w3c.org

20/04/23Κώτης Κων/νος - Copyright Ai-Lab, ICSEng. Dept. University of the

Aegean -  2007 83

Querying

OWL-QL (under recommendation) http://ksl.stanford.edu/projects/owl-ql/ E.g. click here

Ontology Tools e.g. Protégé querying system E.g.