foundations of the semantic web: ontology engineering

92
1 Foundations of the Semantic Web: Ontology Engineering Building Ontologies 1 Alan Rector & colleagues

Upload: sadah

Post on 03-Feb-2016

34 views

Category:

Documents


0 download

DESCRIPTION

Foundations of the Semantic Web: Ontology Engineering. Building Ontologies 1 Alan Rector & colleagues. Goals for this module. Be able to implement an ontology representation in OWL-DL Be able to elicit a conceptualisation Be able to formulate an ontology representation - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Foundations of the Semantic Web: Ontology Engineering

1

Foundations of the Semantic Web:Ontology Engineering

Building Ontologies 1

Alan Rector & colleagues

Page 2: Foundations of the Semantic Web: Ontology Engineering

2

Goals for this module

• Be able to implement an ontology representation in OWL-DL– Be able to elicit a conceptualisation– Be able to formulate an ontology representation– Be able to implement the ontology representationin OWL-DL

• Or be able to say you can’t

• To understand the limits of OWL-DL ontologies– Be ready to apply ontology representations in any of several use cases

• In one week, we can’t build the applications……but to build an ontology is only a means to building applications

– Without applications ontologies are pointless

Page 3: Foundations of the Semantic Web: Ontology Engineering

3

Ontologies and Ontology Representations

• “Ontology” – a word borrowed from philosophy– But we are necessarily building logical systems

• “Physical symbol systems”– Simon, H. A. (1969, 1981). The Sciences of the Artificial, MIT Press

• “Concepts” and “Ontologies”/ “conceptualisations” in their original sense are psychosocial phenomena– We don’t really understand them

• “Concept representations” and “Ontology representations” are engineering artefacts– At best approximations of our real concepts and conceptualisations

(ontologies)• And we don’t even quite understand what we are approximating

Page 4: Foundations of the Semantic Web: Ontology Engineering

4

Ontologies and Ontology Representations (cont)

• Most of the time we will just say “concept” and “ontology” but whenever anybody starts getting religious, remember…– It is only a representation!

• We are doing engineering, not philosophy – although philosophy is an important guide

• There is no one way!– But there are consequences to different ways

• and there are wrong ways– and better or worse ways for a given purposes

– The test of an engineering artefact is whether it is fit for purpose• Ontology representations are engineering artefacts

Page 5: Foundations of the Semantic Web: Ontology Engineering

5

Approach• Design patterns

– Analogous to Java design patterns• Standard ways to do things

– Someday they will be supported by tools, buttoday you have to do it yourself

• Elephant traps– Common errors & misconceptions

• Especially those that seem to work at first

• Foundations of knowledge representation– 200 to 2000 years of experience you need not repeat

• Common dilemmas & tradeoffs– Things for which we don’t have a perfect answer

Page 6: Foundations of the Semantic Web: Ontology Engineering

6

Why it’s hard (1)

• Clash of intuitions– Subject Matter Experts motivated by custom & practice

• Prototypes & Generalities

– Logicians motivated by logic & computational tractability • Definitions and Universals

• Transparency & predictability vs Rigour & Completeness

• Neophytes (you?) caught in the muddled middle

Page 7: Foundations of the Semantic Web: Ontology Engineering

7

Why it’s hard (2)

• Conflation of Models– Meaning: Correctness of Classification & retrieval– Retrieval: Task of discovery, search, or finding– Use: Task of data entry, decision support, …– Acquisition: Task of capturing knowledge– Quality assurance: Criteria for whether it is ‘correct’

Page 8: Foundations of the Semantic Web: Ontology Engineering

8

Beware

• DLs/OWL are not all of Knowledge Representation

• Knowledge Representation is not all of the Semantic Web

• The Semantic Web is not all of Knowledge Management

• The field is still full of controversies

• … This module is to teach you about implementation in OWL-DL

Page 9: Foundations of the Semantic Web: Ontology Engineering

9

Steps in developing an Ontology

1. Establish the purpose– Without purpose, no scope, requirements, evaluation,

2. Informal/Semiformal knowledge elicitation– Collect the terms– Organise terms informally– Paraphrase and clarify terms to produce informal

concept definitions– Diagram informally

3. Refine requirements & tests

Page 10: Foundations of the Semantic Web: Ontology Engineering

10

Steps in implementing an Ontology

4. Implementation– Develop normalised schema and skeleton– Implement prototype recording intention

• Keep track of what you meant to do so you can compare with what happens– Implementing logic-based ontologies is programming

– Scale up a bit• Check performance

– Populate• Possibly with help of text mining and language technology

5. Evaluate & quality assure – Against – Include tests for evolution and change management

6. Monitor use and evolve– Process not product!

Page 11: Foundations of the Semantic Web: Ontology Engineering

11

If this were three modules…

1. Knowledge elicitation and analysis– A quick overview

2. Implementation– A solid introduction

3. Evolution, ontology alignment, and management– Left for another module

• But a major motivation for the methods taught in this module– Normalisation and documentation of intentions

Page 12: Foundations of the Semantic Web: Ontology Engineering

12

Vocabulary

• “Class” “Concept” “Category” “Type”

• “Instance” “Individual”

• “Property” “Slot” “Relation” “relationtype” “Attribute” Semantic link type” “Role” – but be careful about “role”

• Means “property” in DL-speak

• Means “role played” in most ontologies– E.g. “doctor_role”, “student role” …

Page 13: Foundations of the Semantic Web: Ontology Engineering

13

Related ideas• Object Oriented Programming

– Java,a C++, Smalltalk, etc.• But OO programming is not knowledge representation

• Object Oriented Design (DB world)– But data models are not ontologies either

• Although UML is often a good starting point– Additional a-logical issues

» Difference between attributes and relations» Issues of life cycle and handling of aggregation$» Notion of an instance» Implicitly “closed world”

• Frame based systems, Semantic Nets,… Traditional AI– Where it all started but real differences

• RDF(S), Topic Maps and other node-and-arc symbolisms– “What’s in a link?”– The battles in standards committees continue

Page 14: Foundations of the Semantic Web: Ontology Engineering

14

Maintaining large Ontologies: Conceptual Lego

“SNPolymorphism of CFTRGene causing Defect in MembraneTransport of ChlorideIon causing Increase in Viscosity of Mucus in CysticFibrosis…”

“Hand which isanatomicallynormal”

OpenGALEN & OWL

Page 15: Foundations of the Semantic Web: Ontology Engineering

15

The benefits:Modularisation

Bridging Scales and context with Ontologies

GenesSpecies

Protein

Function

Disease

Protein coded bygene in humans

Function ofProtein coded bygene in humans

Disease caused by abnormality inFunction ofProtein coded bygene in humans

Gene in humans

Page 16: Foundations of the Semantic Web: Ontology Engineering

16

Student Ed_inst

Logic Based OntologiesIndividuals, Classes & Properties

$anI1

$anI5

$anI6

$anI4$anS1

$anS2$anS3

$anI7

$John $I0_U_Manattends

$Lindsey_music_soc

attends

$anIndividualClassproperty

Page 17: Foundations of the Semantic Web: Ontology Engineering

17

Student Ed_inst

Logic Based Ontologiesrestrictions

$anI1

$anI5

$anI6

$anI4$anS1

$anS2$anS3

$anI7

(every) attends someValuesFrom

$John $I0_U_Manattends

$Lindsey_music_soc

attends

Page 18: Foundations of the Semantic Web: Ontology Engineering

18

Existential RestrictionsThe basic unit of ontology development

• class (Student partial Person restriction attends someValuesFrom Ed_inst)

• “All students attend some educational institution”.

x. Student(x) y. Ed_inst(y) & attends(x,y)

Student attends . Ed_inst

Page 19: Foundations of the Semantic Web: Ontology Engineering

19

Summary: Concepts in OWL(The “T-Box”)

• Statements about classes/concepts/types– Summarise statements about all individuals in a given class

• Interpreted as defining and describing concepts

• Existential Graphs– The simplest default form

Page 20: Foundations of the Semantic Web: Ontology Engineering

20

Elephant Trap 1: Restrictgions using allValuesFor instead of someValuesFor

• When in doubt, use “SomeValuesFrom”– The existential graph outlines the ontology representation

• Use allValuesFrom only when you are sure what you are doing– Using AllValuesFor wrongly often works for a time

• but comes back to bite you later– See supplementary exercise:

“Existentials & Universals – All & Only”– http://www.cs.man.ac.uk/~rector/CS646/Existentials-and-Universals.ppt– http://www.cs.man.ac.uk/~rector/CS646/existentials-and-universals.daml

“universal” “existential”

Page 21: Foundations of the Semantic Web: Ontology Engineering

21

Definitions

$M1_CS622

$M5

$M6

$M4$S1

$S2$S3

$M7

$John $M0_CS646attends

$Lindsey_music_soc

attends

(every)Student Moduleattends someValuesFrom

CS_student student & attends someValuesFromCS_Module

CS_student is “defined”

Page 22: Foundations of the Semantic Web: Ontology Engineering

22

Definitions & Primitives (1)

• CS_student is “defined”– The definition is sufficient to recognise a CS student. – The words tell us what it means

• “A computer science student not taking computer science” doesn’t make sense

Class( CS_student complete Student & restriction attends someValuesFrom CS_Module)

x. CS_student(x) y. CS_module(y) & attends(x,y) Student attends . CS_module

Page 23: Foundations of the Semantic Web: Ontology Engineering

23

Definitions & Primitives (2)

• Person is a “primitive class” undefined parent of student

Class (Person partial Being restriction hasPart cardinality=2 Leg)

– Having two legs is an interesting fact about all persons, but it doesn’t define person

Page 24: Foundations of the Semantic Web: Ontology Engineering

24

Definitions &Primitives (3)

• In this representation, we have also represented Student as primitive (marked by keyword partial) – although some would argue we could have defined the concept

• What should be primitive?– No absolute rules– Must start from some primitives someplace– Often evolve from primitives to definitions

• E.g. we might decide to evolve the ontology to define a “student” as “a person who attends an educational institution”

class (Student sameClass-as Person and restriction attends someValuesFrom Ed_inst)

Page 25: Foundations of the Semantic Web: Ontology Engineering

25

Definitions &Primitives: Summary

• Primitive classes– Only necessary conditions– i.e. use only ‘’

• OWL class( … partial …) or subclass-of

• Defined classes– Necessary and jointly sufficient conditions– i.e. use ‘’

• OWL classs(…complete…) equivalent-classes(…)

Page 26: Foundations of the Semantic Web: Ontology Engineering

26

Elephant Trap 2:Forgetting to set “complete” instead of “partial”

• In the text or XML version

• in OilEd

Page 27: Foundations of the Semantic Web: Ontology Engineering

27

Let’s start at the beginning

• You now have all you need to implement simple existential ontologies, so let’s go back to the beginning

• The goal build an ontology for the CS department

Page 28: Foundations of the Semantic Web: Ontology Engineering

28

Purpose and Scope

• Describe CS department to allow – annotation of pages on semantic web

If this works– Express rules for equal opportunities for personnel and

rules about the format of modules and courses

Page 29: Foundations of the Semantic Web: Ontology Engineering

29

What concepts do we need?

Student

Computer_Science_Department

LecturerExam

Lab Computer

Seat

Lecture

Professor

Faculty_of_science Handout

Slides

Resource_centre

Department

Alan_Rector

Course

CS646

Page 30: Foundations of the Semantic Web: Ontology Engineering

30

How to group them

StudentProfessor

Lecturer

Faculty_of_science

Department

Computer_Science_Department

LabExam

Lecture

HandoutSlides

Resource_centre

Computer

CourseModule

Lab

Alan_Rector

CS646

Page 31: Foundations of the Semantic Web: Ontology Engineering

31

Make some sense of groups

StudentProfessor

Lecturer

Faculty_of_science

Department

Computer_Science_Department

LabExam

Lecture

HandoutSlides

Resource_centre

Computer

CourseModule

Lab

$Alan_Rector

$CS646

Page 32: Foundations of the Semantic Web: Ontology Engineering

32

Disambiguate

StudentProfessor

Lecturer

Faculty_of_scienceDepartment

$VUM_Computer_Science_Department

Lab_session

ExamLecture

HandoutSlides

Resource_centre

Computer

CourseModule

Lab_room

$Alan_Rector

$CS646

Page 33: Foundations of the Semantic Web: Ontology Engineering

33

Try it again and again

Page 34: Foundations of the Semantic Web: Ontology Engineering

34

Abstract & Label

StudentProfessor

Lecturer

Faculty_of_scienceDepartment

$VUM_Computer_Science_Department

Lab_session

ExamLecture

HandoutSlides

Resource_centre

Computer

CourseModule

Lab_room

$Alan_Rector

$CS646

PeopleEducational_activities

Teaching_units

University_divisions

?Things?

Page 35: Foundations of the Semantic Web: Ontology Engineering

35

Link them up

StudentProfessor

Lecturer

Faculty_of_scienceDepartment

$VUM_Computer_Science_Department

Lab_session

ExamLecture

HandoutSlides

Resource_centre

Computer

CourseModule

Lab_room

$Alan_Rector

$CS646

PeopleEducational_activities

Teaching_units

University_divisions

?Things?

teac

h

atte

nd

Page 36: Foundations of the Semantic Web: Ontology Engineering

36

More Links

StudentProfessor

Lecturer

Faculty_of_scienceDepartment

$VUM_Computer_Science_Department

Lab_session

ExamLecture

HandoutSlides

Resource_centre

Computer

CourseModule

Lab_room

$Alan_Rector

$CS646

PeopleEducational_activities

Teaching_units

University_divisions

?Things?

Page 37: Foundations of the Semantic Web: Ontology Engineering

37

Fill in and ladder up

StudentProfessor

Lecturer

Faculty_of_scienceDepartment

$VUM_Computer_Science_Department

Lab_session

ExamLecture

HandoutSlides

Resource_centre

Computer

CourseModule

Lab_room

$Alan_Rector

$CS646

PeopleTeaching_activities

Teaching_units

University_divisions

?Things?

man

woman

caucasianBlack

Englishstudy

boy

girl

elderly

childadult

Page 38: Foundations of the Semantic Web: Ontology Engineering

38

Build from the middle outPick some links & taxonomies

Academic_staff Professor Lecturer

Teaching_unit Module Course

teaches

is_taught_byTeaching_activities Lecture Lab_session Exam

belongs_to

includes

gives

is_given_by

1..* 0..*

1..*

0..*

1..* ?..*

QUESTIONS:• Is every Teaching_unit taught by a member of academic staff? vice versa?• Is every Teaching_unit given by a member of academic_staff? vice versa?• Does every Teaching_activity belong to a Teaching_unit? vice versa?

Page 39: Foundations of the Semantic Web: Ontology Engineering

39

Part of the Simplest OilEd Version

Page 40: Foundations of the Semantic Web: Ontology Engineering

40

Some general rules

• Several kinds of modules– For now we will consider ACS_modules and

Third_yr_modules

• All ACS modules include labs and exams

• Third year modules include lectures exams

• Form the defined class of modules that include exams? modules than include lectures? modules that include labs?

Page 41: Foundations of the Semantic Web: Ontology Engineering

41

Before Classificationcomplete button set

makes this a defined class

Click here to classify

Must have clicked here to start reasoner

note “inherited” restriction

Page 42: Foundations of the Semantic Web: Ontology Engineering

42

After Classification green symbol never to be clicked

red symbol always click before saving

Classifier has inferred whichkinds of modules are subsumed by defined (pink)classes

Page 43: Foundations of the Semantic Web: Ontology Engineering

43

Another Question

• All ACS modules are short-fat modules– What is “short-fat”– What is the opposite of “short-fat”

• “Long-thin”– Nothing can be both “short-fat” and “long-thin”

» They are “disjoint”

– Let’s call this a Format and make it a kind of ValueType

• Modules are “independent” or “self-standing” concepts

• ValueTypes are “dependent” or “refining” or “non-self-standing” concepts– Usually get a property to go with them

• “unique” – can have only a single value– Sometimes called “functional”

Page 44: Foundations of the Semantic Web: Ontology Engineering

44

Axioms for University Rules

• class (ACS_module restriction hasFormat someValuesFrom Short_fat)

• class (Third_year_module restriction hasFormat someValuesFrom Long_thin)

• class(Short_fat_module complete (Module & hasFormat someValuesFrom Short_fat)

• …

Page 45: Foundations of the Semantic Web: Ontology Engineering

45

It’s already getting complicated

Page 46: Foundations of the Semantic Web: Ontology Engineering

46

But if we clear out the defined bits, it is just a set of trees

Trees of primitives are the basic modules of a normalised ontology

Page 47: Foundations of the Semantic Web: Ontology Engineering

47

Check to see if we are right

• It should not be possible to have – a course which is both short_fat and long_thin– a short_fat third_year_course– a long_thing ACS_course

• So define them and see if they turn red(are unsatisfiable)– Convenient to name them “Probe_…”

Page 48: Foundations of the Semantic Web: Ontology Engineering

48

Probes_… (correctly) unsatisfiable

Page 49: Foundations of the Semantic Web: Ontology Engineering

49

Apply the same techniques to a more complicated tangle

• University policy requires that all departments have both women and men as academic staff

• So we need to sort out the tangle of kinds of people

Page 50: Foundations of the Semantic Web: Ontology Engineering

50

People from our first analysis plus a few extra the University is worried about for

Equal Opportunities compliance

StudentProfessor

Lecturer

$Alan_Rector

People

man

woman

caucasianBlack

English

boy

girl

elderly

childadultWoman_professor

Woman_lecturer

Black_lecturerNonblack_lecturer

Young_lecturer

Page 51: Foundations of the Semantic Web: Ontology Engineering

51

We’ve hardly started and…

already tangled &wrong

(see Black_woman_Professor)

Page 52: Foundations of the Semantic Web: Ontology Engineering

52

Normalisation (Untangling)

• Build the ontology out of simple trees of primitives (“Taxonomies”)– No primitive has more than one primitive parent– All multiple classification done by classifier– (NB only works for “Domain ontology”

• but that’s the part we are interested in most of the time)

Page 53: Foundations of the Semantic Web: Ontology Engineering

53

Kinds of Taxonomies - 1

• Disjoint - nothing can be of both kinds– As far as possible, all primitive taxonomies should be disjoint.– When not disjoint, make artificially disjoint and use a multi-valued

(non-functional) property• In example: make “ethnicity” disjoint

“having an ethnicity” potentially multivalued

• Covering – Exhausts all possibilities

• True for qualitative & formal/legal partitions (‘fiat partitions’)– Almost never true of natural kinds

Page 54: Foundations of the Semantic Web: Ontology Engineering

54

Kinds of Taxonomies (2)

• Intrinsic– Characteristics inherent in the individual described

• Opposite is “accidental”• Don’t change (or do so only in odd circumstances)

– Sex is “intrinsic”– Academic status is “accidental”– Having a fever, or not, is accidental

• Temporal– Value depends on time

• child-adult• Academic rank

Page 55: Foundations of the Semantic Web: Ontology Engineering

55

Untangle & identify characerisitics of taxonomies

Person Sex

Male Female

Emp_Role

Ac_staff Professor Lecturer

Age_group

Adult Child

Ethnicity (admin) White Non_white Black Indian West_indian Oriental

has_sex functional:y

has_emp_role functional:y (University rule)

has_age_group functional:y

has_ethnicity functional: ?y (admin y)

natural kind

Self Standing: Y

disjoint:ycovering: yintrinsic: ytemporal: n Self Standing: N

disjoint: ycovering: nintrinsic: ntemporal: y Self Standing: Y

disjoint: ycovering: y (view)

intrinsic: ytemporal: y Self Standing: N

disjoint: y (fiat)covering: nintrinsic: ytemporal: n Self Standing: N

Page 56: Foundations of the Semantic Web: Ontology Engineering

56

Ontologies are Dependent on Views

• Decisions on previous slide depend on administrative rules as well as “the world”

• “fiat” – a rule– Used by Barry Smith to cover both

• Administrative distinctions

• Arbitrary linguistic dinstictions– e.g. “child” “adult”

Page 57: Foundations of the Semantic Web: Ontology Engineering

57

Disjoint Axiom in OilEd

Page 58: Foundations of the Semantic Web: Ontology Engineering

58

A disjoint covering axiom in OilEdfemale | male “covers”Sex_value_type

Sex_value_type female male

Sex_value_type subclass_of female male

Sex_value_type female male

BUT

female Sex_value_typemale Sex_value_type

therefore

equivalent_classes( Sex_value_type (female male ) ) disjoint box ticked

Page 59: Foundations of the Semantic Web: Ontology Engineering

59

Revised & Properties

functional (aka unique/single-valued)

Page 60: Foundations of the Semantic Web: Ontology Engineering

60

Disjointness axiom

Page 61: Foundations of the Semantic Web: Ontology Engineering

61

Negation (Complement)

• If my intention really is negation, then it is probably better to represent it that way– Rather than with a disjointness Axiom– Non_white_ethnicity Ethnicity_Value_Type & ¬ White_ethnicity

Page 62: Foundations of the Semantic Web: Ontology Engineering

62

Result of definition by relative negation in OilEd

Page 63: Foundations of the Semantic Web: Ontology Engineering

63

Person before classificationMostly flat - & could be flatter

(Black_professor has deliberately been left in original form)

Page 64: Foundations of the Semantic Web: Ontology Engineering

64

Person After Classification(The ‘tangle’ is all in the pink (defined) classes

Page 65: Foundations of the Semantic Web: Ontology Engineering

65

The tangle is

pink(defined)

Page 66: Foundations of the Semantic Web: Ontology Engineering

66

The Primitives (yellow) form clean modular Trees

Page 67: Foundations of the Semantic Web: Ontology Engineering

67

Exercise – Finish Untangling Child-Adult

• File is “Teaching-5-people-untangled.daml”

Page 68: Foundations of the Semantic Web: Ontology Engineering

68

Elephant Trap 3OWL is Open World

“All & Only” “And and Or”

• So far, all knowledge bases have used only – “SomeValuesFrom” ~ ~ “existential qualifiers”– “instersection-of” ~ ~ ~ & ~ “and”

• Almost entirely implicit in the software

• Open World– Everything is possible until we say it is impossible

• “Negation as unsatisfiability”

• Closed world– Nothing is true unless we say it is

• “Negation as failure”– Almost all other software uses “closed world reasoning”

• Databases, logic programming, query languages, …

Page 69: Foundations of the Semantic Web: Ontology Engineering

69

Lab-free courses

• Define a module without labs– Easiest way is to define a module with labs and then

negate it• class(Module_with_labs complete

restriction includes someValuesFrom Lab)– Already in the KB

• class(Module_without_labs complete (not Module_with_labs))

– Module_without_labs ought to subsume Third_year_module

• Because third year modules have no labs

Page 70: Foundations of the Semantic Web: Ontology Engineering

70

Try 1 doesn’t work? Why?What have we not told the reasoner?

Page 71: Foundations of the Semantic Web: Ontology Engineering

71

Try 1 Situation

$Lab5$Lec2

$Lab3$Lab1

$m_ac_1

$m_ac_2

$m_y3_1

$Lec4

$m_y3_2$Exam4includes

(every)Module Teaching_activityincludes allValuesFrom

Teaching_ActivityModule

$Lec3

Exam2

Note: not necessarily every module includes some teaching activity

Page 72: Foundations of the Semantic Web: Ontology Engineering

72

Try 2

• No disjointness axioms between lectures, labs and exams.– Classes in OWL are non-disjoint by default

• Must add disjointness axioms explicitly

• all-disjoint(Lecture Lab Exam)

Page 73: Foundations of the Semantic Web: Ontology Engineering

73

Try 2: Add disjointness

$Lab5

$Lec2

$Lab3$Lab1

$m_ac_1

$m_ac_2

$m_y3_1

$Lec4

$m_y3_2$Exam4includes

(every)Module Teaching_activityincludes allValuesFrom

Module

$Lec3

Exam2

Labs are separate from lectures and exams

(only)

Page 74: Foundations of the Semantic Web: Ontology Engineering

74

Try 2 – no change

• What the reasoner knows:– Third_year_module

restriction includes someValuesFor Exam restriction includes someValuesFor Lecture disjoint(Lecture, Exam, Lab)

• Would it be consistent with these axioms to have a Third_year_module with Labs?– Try it and see if it turns red

Page 75: Foundations of the Semantic Web: Ontology Engineering

75

Try 2 plus probe

• Satisfiable– Does not turn red

Probe not red

Page 76: Foundations of the Semantic Web: Ontology Engineering

76

… but it would still be consistent to add

$Lab5

$Lec2

$Lab3$Lab1

$m_ac_1

$m_ac_2

$m_y3_1

$Lec4

$m_y3_2$Exam4includes

(every)Module Teaching_activityincludes allValuesFrom

Module

$Lec3

Exam2

Wrong but not yet ruled out by axioms

(only)

Page 77: Foundations of the Semantic Web: Ontology Engineering

77

Try 3:What else to add

• OWL is “Open World”– The definitions mean “at least this much” and anything else– Must add explicit ‘closure restrictions’

• Must say either:– Third year modules may have only lectures & exams

» Third_year_module restriction (includes allValuesFrom (Lecture or Exam)) * Why have we said ‘or’ rather than ‘and’?

– Third year modules may not have labs» Third_year module subclass-of

not (restriction includes someValuesFrom Lab) * Why is the ‘not’ outside the parentheses?

• Are these definitions equivalent?– Let’s find out

typo in handout

Page 78: Foundations of the Semantic Web: Ontology Engineering

78

Add closure axiom

$Lab5

$Lec2

$Lab3$Lab1

$m_ac_1

$m_ac_2

$m_y3_1

$Lec4

$m_y3_2$Exam4includes

(every)Module Teaching_activityincludes allValuesFrom

Module

$Lec3

Exam2

Ruled out by closure axiom

(every)Y3_Module Lec or Examincludes allValuesFrom

(only)

Page 79: Foundations of the Semantic Web: Ontology Engineering

79

Both work but try1 & try2 are not equivalent – why?

Page 80: Foundations of the Semantic Web: Ontology Engineering

83

There are many ways to represent the same thing

• Consider if:– Every person has some sex

• Person hasSex someValuesFrom Sex_VT– male, female are kinds of sex

• male Sex_VT; female Sex_VT– male, female covers sex – i.e are the only kinds of sex

• Sex_VT (male female)Sex_VT (male female)

• Or consider (in this case where hasSex is functional): – Woman_1 Person hasSex someValuesFrom female– Woman_2 Person hasSex allValuesFrom female– Woman_3 Person hasSex someValuesFrom (not male)– Woman_4 Person hasSex allValuesFrom (not male)

Page 81: Foundations of the Semantic Web: Ontology Engineering

84

Which to choose: Style

• Choose the form least dependent on global axioms– If possible use someValuesFrom

• Choose the simpler expression– Avoid negation except where needed

• Do not try to show how clever you are– Makes for unreadable, hard to maintain ontologies

• Just as “clever” code makes for unreadable, hard to maintain programs

• Make all primitives disjoint trees– Joint them with definitions

• “Conceptual Lego”

Page 82: Foundations of the Semantic Web: Ontology Engineering

85

Elephant Trap 4Domain & Range Constraints are Restrictions

Other ways to say ‘only’:Domain & Range Constraints

• In OWL, domain & range constraints are equivalent to allValuesFrom restrictions– teaches domain: Academic_staff range: Module

• Thing teaches allValuesFrom ModuleThing isTaughtBy allValuesFrom Academic_staff

• Violating domain/range constraints can– Cause the thing to be classified (coerced) to the specified class

• This is often the wrong behaviour– If other axioms make this inconsistent, then the class in question will

be unsatisfiable• And possible much of the rest of the ontology

Page 83: Foundations of the Semantic Web: Ontology Engineering

86

Domain / Range Constraints

• Reclassification / Coercion– Bad style

• Hard to debug

• Likely to lead to problems in interpretation later– One person thinks “Hamlet” represents Module about the play

Hamlet, the other that “Hamlet” represents the play “Hamlet”

– One person thinks “Red” is a nick-name for somebody, the other a colour.

Page 84: Foundations of the Semantic Web: Ontology Engineering

87

Example of reclassi-fication likely tolead to confusion

Also likely to de-normalise ontologyby giving one primitive more than one primitiveparent

Page 85: Foundations of the Semantic Web: Ontology Engineering

88

If Ontology Properly Normalised,All (domain) primitives are Disjoint

• Easy to do by making all primitive branches of each tree disjoint.– Although OilEd/OWL often returns these as huge lists

of pairwise disjoint axioms after saving • a “round-tripping” problem to be fixed in the next generation

of tools

• If this is done, then most domain/range errors result in unsatisfiable (inconsistent) models.

Page 86: Foundations of the Semantic Web: Ontology Engineering

89

But don’t getmuch helpfinding errorand notdoubly classifiedin OilEd

Page 87: Foundations of the Semantic Web: Ontology Engineering

90

Domain & Range Constraints

• Despite problems, domain/range constraints are important to avoid errors– e.g.

has_academic_rank someValuesFrom Professorinstead of has_academic_rank someValuesFrom Professor_rank

– However, likely to make much of ontology turn red• Look for base cause

– Make small incremental changes

– Arguments about how to implement in future.d

Page 88: Foundations of the Semantic Web: Ontology Engineering

91

Elephant Trap 5Confusing kind-of & part-of

• Many systems deal in in parts and wholes– Anatomy– Computer aided design

• Airbus UK, Boeing, etc

– Stock control– Organisational charts– Document maps

• XML is essential about documents & their parts

– Web pages– …

Page 89: Foundations of the Semantic Web: Ontology Engineering

92

Library systems often mix the two (and others)

• Librarians / thesauri speak of– “is broader than” / “is narrower than”

• Precisely to avoid implying which logical relation applies• Formal representations must make the distinction

• Typical thesaurus– Computer

Microcomputer Mother_board CPU Pentium Transistor

isKindOfisPartOf

isPartOfisKindOf

isPartOf

Page 90: Foundations of the Semantic Web: Ontology Engineering

93

Logic based systems must unscramble

• Kinds– Computer

MicroComputer

– Parts of Computer CPU Pentium

– Circuit ComponentsTransistor

• Parts– Microcomputer

Mother_board CPU Transistor

Page 91: Foundations of the Semantic Web: Ontology Engineering

94

… but note – we can rebuild with“Conceptual Lego”

• restriction isPartOf someValuesFrom Computer restriction isPartOf someValuesFrom Microcomputer restriction isPartOf someValuesFrom Mother_board restriction isPartOf someValuesFrom CPU restriction isPartOf someValuesFrom Pentium restriction isPartOf someValuesFrom transistor

• The restrictions reconstruct the original hierarchy– but make context explicit

• Would not work for isColourOf or isDesignedBy

• The new ontology is re-usable– The old was not.

Page 92: Foundations of the Semantic Web: Ontology Engineering

95

Part-whole relations

• A major field in their own right– “Merology” “Merotopology”

• Subject of a major part of later lectures on “patterns”