(07) Semantic Web Technologies - Description Logics

66
Semantic Web Technologies Lecture Dr. Harald Sack Hasso-Plattner-Institut für IT Systems Engineering University of Potsdam Winter Semester 2012/13 Lecture Blog: http://semweb2013.blogspot.com / This file is licensed under the Creative Commons Attribution-NonCommercial 3.0 (CC BY-NC 3.0 ) Dienstag, 27. November 12

Transcript of (07) Semantic Web Technologies - Description Logics

Page 1: (07) Semantic Web Technologies - Description Logics

Semantic Web Technologies

LectureDr. Harald Sack

Hasso-Plattner-Institut für IT Systems EngineeringUniversity of Potsdam

Winter Semester 2012/13

Lecture Blog: http://semweb2013.blogspot.com/This file is licensed under the Creative Commons Attribution-NonCommercial 3.0 (CC BY-NC 3.0)

Dienstag, 27. November 12

Page 2: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

2

Propo

sition

al Log

ic

&

First

Order

Logic

last lecture

Dienstag, 27. November 12

Page 3: (07) Semantic Web Technologies - Description Logics

Semantic Web Technologies , Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

3 1. Introduction 2. Semantic Web - Basic Architecture

Languages of the Semantic Web - Part 1

3. Knowledge Representation and LogicsLanguages of the Semantic Web - Part 2

4. Applications in the ,Web of Data‘

Semantic Web Technologies Content

Dienstag, 27. November 12

Page 4: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

4 3. Knowledge Representation and LogicsThe Languages of the Semantic Web - Part 2

• Excursion: Ontologies in Philosophy and Computer Science

• Recapitulation: Popositional Logic and First Order Logic

• Description Logics

• RDF(S) Semantics• OWL and OWL-Semantics• OWL 2 and Rules

Semantic Web Technologies Content

Dienstag, 27. November 12

Page 5: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

5

Descri

ption

Logics

next lecture

Dienstag, 27. November 12

Page 6: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

6 3.3 Description Logics3.3.1 Motivation3.3.2 Description Logics Overview3.3.3 ALC - Syntax and Semantic3.3.4 Inference and Reasoning3.3.5 Tableaux Algorithm

3. Knowledge Representation & Logic3.3 Description Logics

Dienstag, 27. November 12

Page 7: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13Turmbau zu Babel, Pieter Brueghel, 1563

7

An Ontology is aformal specification

of a sharedconceptualization

of a domain of interest

Tom Gruber, 1993

⇒ machine understandable⇒ group of people/agents⇒ about concepts⇒ between general description and individual use

Ontologies in Computer Science

Dienstag, 27. November 12

Page 8: (07) Semantic Web Technologies - Description Logics

Ontologies and Communication

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

8

Person 1 Person 2

Symbol

Concept

Thing

exchange of symbols„Golf“

conceptH1

conceptH2

agreement

M1 M2

Agent 1 Agent 2

exchangeof symbols

OntologyDescription

Semantics

Ontology agreement

specific domain,e.g. sports

Dienstag, 27. November 12

Page 9: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

9

RDF and RDFS• Definition of Classes,

Class Hierarchies,Relations,Individuals

• only for theDefinition ofsimple ontologies

• not appropriateto model morecomplexontologies

ISBN 0-00-651409-X

WWW

2004

a:hasTitel

a:hasPublicationdate

Springer

Heidelberg

a:hasName

a:hasLocation

a:hasPublisher

Harald Sack

http://hpi-web.de/HaraldSack.html

a:hasName

a:hasHomepage

a:hasAutor

Dienstag, 27. November 12

Page 10: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

10

Descri

ption

Logics

next lecture

We need moresemantic expressivity

Dienstag, 27. November 12

Page 11: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

11

3.3 Description Logics3.3.1 Motivation3.3.2 Description Logics Overview3.3.3 ALC - Syntax and Semantic3.3.4 Entailment and Reasoning3.3.5 Tableaux Algorithm

Dienstag, 27. November 12

Page 12: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

12logic-basedformalisms

Knowledge Representations

non logic-based formalisms

• closer to human intuition• therfore easier to

understand• usually don‘t have

consistent semantics

• E.g.:• Semantic Networks• Frame-based

representations• Rule-based

representations

• more complex and difficult to understand

• all based on first order logic• consistent semantics• FOL Syntax• FOL Semantic• FOL Entailment

• E.g.:• Description Logics

Dienstag, 27. November 12

Page 13: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

13

FOL as Semantic Web Language?

FOL• Why not simply take FOL for Ontologies?• FOL can do everything...

• compare higher programming languages to assemblers

• FOL has• high expressivity• too bulky for modelling• not appropriate to find consensus in modelling• proof theoretically very complex (semi-decidable)

• FOL is also not a Markup Language

Look for an appropriate fragment of FOL

Dienstag, 27. November 12

Page 14: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

14 • DLs are Fragments of FOL• In DL from simple descriptions more complex descriptions are

created with the help of Constructors.• DLs differ in the applied constructors (Expressivity)• DLs have been developed from „semantic Networks“• DLs are decidable (most times)• DLs posess sufficient expressivity (most times)• DLs are related to modal logics

• e.g., W3C Standard OWL 1 DL is based on description logics SHOIN(D)

Description Logics (DLs)

Dienstag, 27. November 12

Page 15: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

15

General DL Architecture

Knowledge Base

TBox Terminological Knowledge Knowledge about concepts of a domain (classes, attributes, properties,..)

EuroBook ≣ Book ⨅ PublishedInEurope

ABox Assertional Knowledge Knowledge about Individuals / Entities

EuroBook(“Semantic Web Grundlagen“)

Infe

renc

e E

ngin

e

Inte

rface

Dienstag, 27. November 12

Page 16: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

16 • DLs are a family of logic-based formalisms applied for knowledge representation

• Special languages characterized by:• Constructors for complex concepts and roles from simpler

concepts and roles• Set of Axioms to express Facts about concepts, roles and

individuals

•ALC (Attribute Language with Complement) is the smallest deductively complete DL

• Conjunction, Disjunction, Negation are class constructors, denoted as ⊓, ⊔ , ¬

• Quantifiers restrict domain and range of roles:

Man ⊓ ∃hasChild.Female ⊓ ∃hasChild.Male ⊓ ∀hasChild.(Rich ⊔ Happy)

General DL Architecture

Dienstag, 27. November 12

Page 17: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

17

Further DL Expressions

•Further Constructors are e.g.•Number restrictions for roles:≥3 hasChild, ≤1 hasMother

•Qualified number restrictions for roles:≥2 hasChild.Female, ≤1 hasParent.Male

•Nominals (definition by extension): {Italy, France, Spain}

•Concrete domains (datatypes): hasAge.(≥21)

•Inverse roles: hasChild– ≡ hasParent•Transitive roles: hasAncestor ⊑+ hasAncestor•Role composition: hasParent.hasBrother(uncle)

Dienstag, 27. November 12

Page 18: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

18 3.3 Description Logics3.3.1 Motivation3.3.2 Description Logics Overview3.3.3 ALC - Syntax and Semantic3.3.4 Entailment and Reasoning3.3.5 Tableaux Algorithm

Dienstag, 27. November 12

Page 19: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

19

ALC - Building Blocks

• Classes• Roles• Individuals

• Student(Christian)Individual Christian is of class Student

• Lecture(SemanticWeb)Individual SemanticWeb is of class lecture

• visitsLecture(Christian, SemanticWeb)Christian visits the lecture SemanticWeb

Dienstag, 27. November 12

Page 20: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

20 • Atomic Types• Concept names A,B, ... • Special concepts

• ⊤ - Top (universal concept)• ⊥ - Bottom concept

• Role names R,S, ...

• Constructors • Negation: ¬C • Conjunction: C ⊓ D

• Disjunction: C ⊔ D

• Existential quantifier: ∃R.C• Universal quantifier: ∀R.C

ALC - Building Blocks

Dienstag, 27. November 12

Page 21: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

21 • Class Inclusion• Professor ⊑ FacultyMember

• every Professor is a Faculty Member• equals (∀x)(Professor(x) → FacultyMember(x))

• Class Equivalence• Professor ≡ FacultyMember

• the Faculty Members are exactly the Professors• equals (∀x)(Professor(x) ↔ FacultyMember(x))

ALC - Building Blocks

Dienstag, 27. November 12

Page 22: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

22 • Conjunction ⊓

• Disjunction ⊔

• Negation ¬

(∀x)(Professor(x) → ((Person(x) Λ UniversityEmployee(x)) V (Person(x) Λ ¬Student(x)))

Professor ⊑ (Person ⊓ UniversityEmployee)! ! ⊔ (Person ⊓ ¬Student)

ALC - Complex Class Relations

Dienstag, 27. November 12

Page 23: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

23

ALC - Quantifiers on Roles

•Strict Binding of the Range of a Role to a Class•Examination ⊑ ∀has Supervisor.Professor

•An Examination must be supervised by a Professor

•(∀x)(Examination(x) → (∀y)(hasSupervisor(x,y) → Professor(y)))

•Open Binding of the Range of a Role to a Class•Examination ⊑ ∃hasSupervisor.Person

•Every Examination has at least one supervisor (who is a person)

•(∀x)(Examination(x) → (∃y)(hasSupervisor(x,y) Λ Person(y)))

Dienstag, 27. November 12

Page 24: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

24

ALC - Formal Syntax

•Production rules for creating classes in ALC:(A is an atomic class, C and D are complex Classes and R a Role)

•C,D::= A|⊤|!|¬C|C⊓D|C⊔D|∃R.C|∀R.C

•An ALC TBox contains assertions of the form C ⊑ D and C ≡ D, where C,D are complex classes.

•An ALC ABox contains assertions of the form C(a) and R(a,b), where C is a complex Class, R a Role and a,b Individuals.

•An ALC-Knowledge Base contains an ABox and a TBox.

Dienstag, 27. November 12

Page 25: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

25

ALC - Semantic (Interpretation)

•we define a model-theoretic semantic for ALC (i.e. Entailment will be defined via Interpretations)

•an Interpretation I=(ΔI,.I) contains

•a set ΔI (Domain) of Individuals and

•an interpretation function .I that maps•Individual names a to Domain elements aI∈ΔI

•Class names C to a set of Domain elements CI⊆ΔI

•Role names R to a set of Pairs of Domain elements RI⊆ΔI×ΔI

Dienstag, 27. November 12

Page 26: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

26

ALC - Semantic (Interpretation)

Individual Names Class Names Role Names

Dienstag, 27. November 12

Page 27: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

27 •Extension for complex classes:

•⊤I = ΔI and ⊥I = ∅

•(C ⊔ D)I = CI ∪ DI and (C ⊓ D)I = CI ∩ DI

•(¬C)I = ΔI \ CI

•∀R.C={a∈ΔI|(∀b∈ΔI)((a,b)∈RI&b∈CI)}

•∃R.C={a∈ΔI|(∃b∈ΔI)((a,b)∈RI∧b∈CI)}

ALC - Semantic (Interpretation)

Dienstag, 27. November 12

Page 28: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

28 •...and Axioms:

• C(a) holds, iff aI ∈ CI

• R(a,b) holds, iff (aI,bI) ∈ RI

• C ⊑ D holds, iff CI ⊆ DI

• C ≡ D holds, iff CI = DI

ALC - Semantic (Interpretation)

Dienstag, 27. November 12

Page 29: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

29

ALC - alternative Semantic

•Translation into FOL via Mapping π

•ABox: π (C(a))=C(a)π (R(a,b))=R(a,b)

•TBox:recursive Definition

•where C,D are complex Classes, R a Role and A an atomic Class.

Dienstag, 27. November 12

Page 30: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

30

ALC - Knowledgebase

•Terminological Knowledge (TBox)Axioms that describe the Structure of the modelled domain (conceptional Schema):•Human ⊑ ∃parentOf.Human

•Orphan ≡ Human ⊓ ¬∃hasParent.Alive

•Assertional Knowledge (ABox)Axioms that describe specific situations (data):•Orphan(harrypotter)•hasParent(harrypotter,jamespotter)

Dienstag, 27. November 12

Page 31: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

31

Description Logics

Operator/Constructor Syntax LanguageLanguage

Conjunction A ⊓ B

FLValue Restriction ∀R.C FL

Existential Quantifier ∃R

Top ⊤

Bottom ⊥

S*Negation ¬A

S*

Disjunction A ⊔ B AL*

Existential Restriction ∃R.C

Number Restriction (≤nR) (≥nR)

Set of Inividuals {a1,...,a2}

Role Hierarchy R ⊑ S HH

inverse Role R-1 II

Qualified Number Restriction (≤nR.C) (≥nR.C) QQ

Dienstag, 27. November 12

Page 32: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

32•ALC: Attribute Language with Complement

•S: ALC + Transitivity of Roles

•H: Role Hierarchies

•O: Nominals

•I: Inverse Roles

•N: Number restrictions ≤n R etc.

•Q: Qualified number restrictions ≤n R.C etc.

•(D): Datatypes

•F: Functional Roles

•R: Role Constructors

•OWL 1 DL is SHOIN(D) / OWL 2 DL is SHROIQ(D)

Description Logics

Dienstag, 27. November 12

Page 33: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

33 3.3 Description Logics3.3.1 Motivation3.3.2 Description Logics Overview3.3.3 ALC - Syntax and Semantic3.3.4 Inference and Reasoning3.3.5 Tableaux Algorithm

Dienstag, 27. November 12

Page 34: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

34

Open World vs. Closed World Assumption

• OWA: Open World AssumptionThe existence of further individuals is possible, if they are not explicitly excluded.

• CWA: Closed World AssumptionIt is assumed that the knowledge base contains all individuals.

if we assume that we know everything about Bill then all of his children are male

child(Bill,Bob)Man(Bob)

are all childrenof Bill male?

? ⊨ ∀child.Man(Bill)

no idea sincewe do not knowall children of Bill

DL answersdon‘t know

PROLOG answersyes

≤1 child.⊤(Bill) ? ⊨ ∀child.Man(Bill) yesnow we knoweverything aboutBill‘s children

Dienstag, 27. November 12

Page 35: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

35

Description Logics and Inference

• Let D be a Terminology (T-Box) and C and D concept descriptions in a language (description logic) L

• C is satisfiable wrt. D, iffthere exists a model I for D that holds CI≠∅

otherwise C is not satisfiable (a contradiction) wrt. D

• C is subsumed by D wrt. D, C ⊑D D or D ⊨ C ⊑ D, iff for all models I of D it holds that CI ⊆ DI

• C and D are equivalent wrt. D, C ≣D D or D ⊨ C ≣ D, iff for all models I of D it holds that CI = DI

• C and D are disjunct wrt. D, iff for all models I of D it holds thatCI ∩ DI = ∅

Dienstag, 27. November 12

Page 36: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

36 • Let D be a Terminology (T-Box) and A a set of Assertions (A-Box) in a language (description logic) L.Let α be an assertion, C a concept description and a a constant in L

• A is consistent wrt. D, iff there is an Interpretation I for L that is also a model for D and A

• a is entailed by A and D, A ∪ D ⊨ a, iff for all Interpretations I for L it holds that, if I is also a model for D and A, then I also is a model for the assertion a

• a is an Instance of C wrt. D and A, iff A ∪ D ⊨ C(a)

Description Logics and Inference

Dienstag, 27. November 12

Page 37: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

37

Problems of Inference (1)

• Global (In)Consistency of the knowledge base• Does the knowledge base make sense? KB ⊨ ┴?

• Class(in)consistency C ≡ ┴ ?• Must class C be empty?

• Class inclusion (Subsumption) C ⊑ D?• Structuring the knowledge base

• Class equivalency C ≡ D?• Are two classes the same?

Dienstag, 27. November 12

Page 38: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

38• Class disjunctness C ⊓ D = ┴?• Are two classes disjunct?

• Class membership C(a)?• Is individual a contained in class C?

• Instance generation (Retrieval) „find all x with C(x)“• Find all (known!) Individuals of class C.

Problems of Inference (2)

Dienstag, 27. November 12

Page 39: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

39 • Decidability: for each inference problem there always exists an algorithm that terminates in finite time• DLs are fragments of FOL, therefore (in principle)

FOL inference algorithms (Resolution, Tableaux) can be applied.

• But FOL algorithms do not always terminate!

• Problem: Find algorithms that always terminate!• There might be no „naive“ solutions!

Description Logics and Inference

Dienstag, 27. November 12

Page 40: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

40

Decidability and DL

• FOL inference algorithms (Tableaux algorithm and Resolution) must be adapted for DLs

• We will restrict to ALC

• Tableaux algorithm and Resolution show unsatisfiability of a theory (knowledge base)

• Adaption of entailment problems to the detection of contradictions in the knowledge base, i.e. proof of the unsatisfiability of the knowledge base!

Dienstag, 27. November 12

Page 41: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

41

Reduction to Unsatisfiability (1)

• Class (in)consistency C ≡ ┴• iff KB ⋃ {C(a)} unsatisfiable (a new)

• Class inclusion (Subsumption) C ⊑ D• iff KB ⋃ {(C ⊓ ¬D)(a)} unsatisfiable (a new)

• Class equivalency C ≡ D• iff C ⊑ D und D ⊑ C

Dienstag, 27. November 12

Page 42: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

42

Reduction to Unsatisfiability (2)

• Class disjunctness C ⊓ D = ┴• iff KB ⋃ {(C ⊓ D)(a)} unsatisfiable (a new)

• Class membership C(a)• iff KB ⋃ {¬C(a)} unsatisfiable

• Instance generation (Retrieval) „find all x with C(x)“• Check class membership for all individuals• but: efficiency...?

Dienstag, 27. November 12

Page 43: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

43 3.3 Description Logics3.3.1 Motivation3.3.2 Description Logics Overview3.3.3 ALC - Syntax and Semantic3.3.4 Entailment and Reasoning3.3.5 Tableaux Algorithm

Dienstag, 27. November 12

Page 44: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

44

Tableaux Algorithm for Propositional Logic

•syntactic algorithms to check the consistency of logical assertions•Basic Idea (similar to Resolution):•Proof algorithm to check the consistency of a logical formula by inferring that its negation is a contradiction (proof by refutation).

•Tableaux algorithm is based on disjunctive Normalform representation (Resolution: conjunctive Normalform)

•Construct Tree, where each node is marked with a logical formula. A path from the root to a leaf is the conjunction of all formulas represented within the nodes of the path; a branch of the path represents a disjunction.

•The tree is created by successive application of the Tableaux Extension Rules.

•A path in the Tableau is closed, if along the path as well X as ¬X for a formula X occurs, or if false occurs (X doesn‘t have to be atomic).

Dienstag, 27. November 12

Page 45: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

45

Tableaux Algorithm for Propositional Logic

•Construct a Tree, where each node is marked with a logical formula. A path from the root to a leaf is the conjunction of all formulas represented within the nodes of the path; a branch of the path represents a disjunction.

(q ∧ r) ∨ (p ∧ ¬ r) ∨ r

(q ∧ r) (p ∧ ¬ r) ∨ r

(p ∧ ¬ r) rq

r p

¬ r

Dienstag, 27. November 12

Page 46: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

46

Tableaux Algorithm for Propositional Logic

•Basic Idea (continued):•A tableaux is fully expanded, if no extension rules are possible.

•A tableaux is called closed, if all its paths are closed.•A Tableaux Proof for a formula X is a closed tableaux for ¬X.

•The selection of the extension rules to be applied in the Tableaux is not deterministic.

•There are heuristics for the propositional logic tableaux to select which extension rules to be applied best

Dienstag, 27. November 12

Page 47: (07) Semantic Web Technologies - Description Logics

•für PL:

•für conjunctive Formula (α-Rules):

•für disjunctive formula (β-Rules):

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

47

Tableaux Extension Rules

¬¬XX

¬WF

¬FW

α α1α2

X∧YXY

¬(X∨Y)¬X¬Y

¬(X⇒Y)X

¬Y

β β1 | β2

X∨YX | Y

¬(X∧Y)¬X | ¬Y

(X⇒Y)¬X | Y

Dienstag, 27. November 12

Page 48: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

48

Tableaux Algorithm (PL) Example (1):

proof: ((q ∧ r) ⇒ (¬q ∨ r))

(1) ¬((q ∧ r) ⇒ (¬q ∨ r)) = ¬(¬(q ∧ r) ∨ (¬q ∨ r)) = (q ∧ r) ∧ ¬(¬q ∨ r))

(2) α,1: (q ∧ r)

(3) α,1: ¬(¬q ∨ r) = q ∧ ¬r(4) α,2: q(5) α,2: r(6) α,3: q(7) α,3: ¬r

¬(X⇒Y)X

¬Y

α-Rule

Dienstag, 27. November 12

Page 49: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

49

Tableaux Algorithm (PL) Example (2):

¬(X⇒Y)X

¬Y

α-Rule

proof: (p ⇒ (q ⇒ r)) ⇒ ((p ⇒ q) ⇒ (p ⇒ r))

(10|β from 9) ¬q | (11|β from 9) r(12|β from 4) ¬p | (13|β from 4) q

(1) ¬((p ⇒ (q ⇒ r)) ⇒ ((p ⇒ q) ⇒ (p ⇒ r)))(2|α from 1) (p ⇒ (q ⇒ r))(3|α from 1) ¬((p ⇒ q) ⇒ (p ⇒ r))(4|α from 3) (p ⇒ q)(5|α from 3) ¬(p ⇒ r)(6|α from 5) p(7|α from 5) ¬r(8|β from 2) ¬p | (9|β from 2) (q ⇒ r)

Dienstag, 27. November 12

Page 50: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

50

Tableaux Algorithm Extensions for FOL

• as for propositional logic - X and Y stand for arbitrary (FOL) formulas

• Additional Rules for quantified formulas :

• γ for universally quantified formulas, δ existentially quantified formulas, with:

• t is an arbitrary ground term (i.e. doesn‘t contain variables that are bound in Φ),

• c is a „new“ constant

γ γ[t]

δ δ[c]

γ γ[t]

∀x.Φ Φ[x←t]

¬∃x.Φ ¬Φ[x←t]

δ δ[c]

∃x.Φ Φ[x←c]

¬∀x.Φ ¬Φ[x←c]

Dienstag, 27. November 12

Page 51: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

51Proof: (∀x.P(x)∨Q(x)) ⇒ (∃x.P(x))∨(∀x.Q(x))

(9|β from 8) P(c) | (10|β from 8) Q(c)

(1) ¬((∀x.P(x)∨Q(x)) ⇒ (∃x.P(x))∨(∀x.Q(x)))(2|α from 1) (∀x.P(x)∨Q(x))(3|α from 1) ¬((∃x.P(x))∨(∀x.Q(x)))(4|α from 3) ¬(∃x.P(x))(5|α from 3) ¬(∀x.Q(x))(6|δ from 5) ¬Q(c)(7|γ from 4) ¬P(c)(8|γ from 2) P(c)∨Q(c)

γ γ[t]

∀x.Φ Φ[x←t]

¬∃x.Φ ¬Φ[x←t]

δ δ[c]

∃x.Φ Φ[x←c]

¬∀x.Φ ¬Φ[x←c]

Tableaux Algorithm (FOL) Example(3):

Dienstag, 27. November 12

Page 52: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

52

Tableaux Algorithm for Description Logics

•Transformation to Negation normalform necessary

•Let W be a knowledge base,•Substitute C≡D by C⊑D and D⊑C

•Substitute C⊑D by C⊓¬D.•Apply the NNF Transformations from the next page

•Resulting knowledge base NNF(W)•Negation normalform of W.•Negation is placed directly in front of atomic classes.

Dienstag, 27. November 12

Page 53: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

53

Tableaux Transformation in Negation Normalform• NNF Transformations

• W and NNF(W) are logically equivalent.

NNF(C) = C, falls C atomar istNNF(¬C) = ¬C, falls C atomar istNNF(¬¬C) = NNF(C)NNF(C ⊔ D) = NNF(C) ⊔ NNF(D)NNF(C ⊓ D) = NNF(C) ⊓ NNF(D)NNF(¬(C ⊔ D)) = NNF(¬C) ⊓ NNF(¬D)NNF(¬(C ⊓ D)) = NNF(¬C) ⊔ NNF(¬D)NNF(∀R.C) = ∀ R.NNF(C)NNF(∃R.C) = ∃ R.NNF(C)NNF(¬∀R.C) = ∃R.NNF(¬C)NNF(¬∃R.C) = ∀R.NNF(¬C)

Dienstag, 27. November 12

Page 54: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

54 • Example: P⊑(E⊓U)⊔¬(¬E⊔D)

• In NNF: " P⊓¬((E⊓U)⊔¬(¬E⊔D)) =" " ¬P⊔(E⊓U)⊔(E⊓¬D)

Tableaux Transformation in Negation Normalform

Dienstag, 27. November 12

Page 55: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

55

Tableaux Extension Rules for DL

• If the resulting tableaux is closed, the original knowledge base is unsatisfiable.

• Only select elements that lead to new elements within the tableaux. If this is not possible, then the algorithm terminates and the original knowledge base is satisfiable.

Selection Action

C(a)∈W (ABox) Add C(a)

R(a,b)∈W (ABox) Add R(a,b)

C∈W (TBox) Add C(a) for a known Individual a

(C⊓D)(a)∈A Add C(a) and D(a)

(C⊔D)(a)∈A Split the path. Add (1) C(a) and (2) D(a)

(∃R.C)(a)∈A Add R(a,b) and C(b) for a new Individual b

(∀R.C)(a)∈A if R(a,b)∈A, then add C(b)

Dienstag, 27. November 12

Page 56: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

56

Tableaux Algorithm (DL) Example(4):

• P … Professor• E … Person• U … University Employee• D … PhD student

• Knowledge Base: P⊑(E⊓U)⊔(E⊓¬D)

• Is P⊑E a logical consequence?

• Knowledge Base (with [negated] query) in NNF:{¬P⊔(E⊓U)⊔(E⊓¬D), (P⊓¬E)(a)}

Dienstag, 27. November 12

Page 57: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

57 • Knowledge Base: ¬P⊔(E⊓U)⊔(E⊓¬D) (P⊓¬E)(a)

• Tableaux:(1) (P⊓¬E)(a) (from knowledge base)(2|α from 1) P(a)(3|α from 1) ¬E(a)(4) (¬P⊔(E⊓U)⊔(E⊓¬D))(a) (from knowledge base)(5|β from 4)) ¬P(a) | (6)((E⊓U)⊔(E⊓¬D))(a)

(7|β from 4) (E ⊓ U)(a) | (8) (E ⊓ ¬D)(a) (9|α from 7) E(a) (10|α from 8) E(a) (11|α from 7) U(a) (12|α from 8) ¬D(a)

Tableaux Algorithm (DL) Example(4):

Dienstag, 27. November 12

Page 58: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

58

• Knowledge Base: ¬Person ⊔ ∃hasParent.Person

• infer: ¬Person(Bill)

Person(Bill)

(¬Person ⊔ ∃hasParent.Person)(Bill)

(¬Person ⊔ ∃hasParent.Person)(x1)

(¬Person ⊔ ∃hasParent.Person)(x2)

¬Person(Bill) ⊔∃hasParent.Person(Bill)

hasParent(Bill,x1)

Person(x1)∃

¬Person(x1) ∃hasParent.Person(x1) ⊔

hasParent(x1,x2)

Person(x2)∃

¬Person(x2) ∃hasParent.Person(x2) ⊔

Problem with existentialquantificationalso for OWL:minCardinality

Tableaux Algorithm (DL) Example(5):

no termination possible

Dienstag, 27. November 12

Page 59: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

59

Idea of Blocking

• the following had been constructed in the Tableaux:

• Idea: reuse old nodes

Person∃hasParent.Person

Person∃hasParent.Person

Person∃hasParent.Person

hasParent hasParent hasParent

Person∃hasParent.Person

hasParent

Person∃hasParent.Person

Blocking

Correctness of this short cutmust be proven!hasParent

Dienstag, 27. November 12

Page 60: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

60

Tableaux Algorithm (DL) with Blocking

• Knowledge Base: ¬Person ⊔ ∃hasParent.Person

• infer: ¬Person(Bill)

Person(Bill)

(¬Person ⊔ ∃hasParent.Person)(Bill)

¬Person(Bill)

hasParent(Bill,x1)

Person(x1)

(¬Person ⊔ ∃hasParent.Person)(x1)

¬Person(x1) ∃hasParent.Person(x1)

∃hasParent.Person(Bill)

σ(Βill) = {Person, ¬Person ⊔ ∃hasParent.Person, ∃hasParent.Person}σ(x1) = { Person, ¬Person ⊔ ∃hasParent.Person, ∃hasParent.Person}σ(x1) ⊆ σ(Bill), so Bill blocks x1

Person∃hasParent.Person

hasParent

hasParent

Person∃hasParent.Person

termination

Dienstag, 27. November 12

Page 61: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

61 • The Selection of (∃R.C)(a) in the tableaux path A is blocked, if there is already an individual b with {C|C(a)∈A}⊆{C|C(b)∈A}.

• Two possibilities of termination:

1. Closing the Tableaux.Knowledge Base is unsatisfiable.

2. All non blocked selections from the tableaux don‘t lead to an extension.Knowledge Base is satisfiable.

Tableaux Algorithm (DL) with Blocking

Dienstag, 27. November 12

Page 62: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

62 3.3 Description Logics3.3.1 Motivation3.3.2 Description Logics Overview3.3.3 ALC - Syntax and Semantic3.3.4 Entailment and Reasoning3.3.5 Tableaux Algorithm

3. Knowledge Representation & Logic3.3 Description Logics

Dienstag, 27. November 12

Page 63: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

63 3. Knowledge Representation and LogicsThe Languages of the Semantic Web - Part 2

• Excursion: Ontologies in Philosophy and Computer Science

• Recapitulation: Popositional Logic and First Order Logic

• Description Logics

• RDF(S) Semantics• OWL and OWL-Semantics• OWL 2 and Rules

Semantic Web Technologies Content

Dienstag, 27. November 12

Page 64: (07) Semantic Web Technologies - Description Logics

Lecture: Semantic Web Technologies, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam, WS 2012/13

Formal

Seman

tic

for RD

F(S)

Rembrandt van Rijn, Die Anatomie des Dr. Tulp, 1632

64

next lecture...

Dienstag, 27. November 12