1 ontologies in semantic web based on tutorials and presentations: d. lee, f. harmelen, m. arumugam,...
TRANSCRIPT
1
Ontologiesin Semantic Web
Based on tutorials and presentations:D. Lee, F. Harmelen, M. Arumugam, C. Goble, I. Horrocks, N. F. Noy, D.L. McGuinness, J. Broekstra, M. Klein, S. Decker, D. Fensel, DERI Group, H.
Knublauch,N. Drummond, M. Horridge
www.ontoknowledge.org/oil
2
Communication between people
3
The More or Less Global Agreement about Standard Terminology and Conceptual Hierarchy for a Domain Description is Necessary for the Interoperability in the Intelligent Web
4
Contents
Introduction to OntologiesOntology EngineeringOWL: Web Ontology Language
5
6
What are ontologies?
Ontologies are content theories about the sorts of objects, properties of objects, and relations between objects that are possible in a specified domain of knowledge.
7
Studer(98): Formal, explicit specification of a shared conceptualization
Machine readable
Concepts, properties,functions, axiomsare explicitly defined
Consensualknowledge
Abstract model of some phenomenain the world
What are ontologies? (3)
9
10
What Is “Ontology Engineering”?
Ontology Engineering: Defining terms in the domain and relations among them Defining concepts in the domain (classes) Arranging the concepts in a hierarchy (subclass-
superclass hierarchy) Defining which attributes and properties (slots)
classes can have and constraints on their values Defining individuals and filling in slot values
11
Tool for Ontology Engineering
Screenshots in further examples are from Protégé-2000, which: is a graphical ontology-development tool supports a rich knowledge model is open-source and freely available
(http://protege.stanford.edu/index.shtml)
12
Determine Domain and Scope
What is the domain that the ontology will cover?
For what we are going to use the ontology?For what types of questions the information in
the ontology should provide answers (competency questions)?
Answers to these questions may change during the lifecycle
13
Example Ontology
French winesand
wine regions
California wines and
wine regions
Which wine should
I serve with seafood today? A sharedA shared
ONTOLOGYONTOLOGYof of
wine and foodwine and food
A sharedA sharedONTOLOGYONTOLOGY
of of wine and foodwine and food
14
Competency Questions
Which wine characteristics should I consider when choosing a wine?
Is Bordeaux a red or white wine? Does Cabernet Sauvignon go well with seafood? What is the best choice of wine for grilled meat? Which characteristics of a wine affect its appropriateness
for a dish? Does a flavor or body of a specific wine change with
vintage year?
15
Enumerating Terms - The Wine Ontology
wine, grape, winery, location,...
wine color, wine body, wine flavor, sugar content,...
white wine, red wine, Bordeaux wine,...
food, seafood, fish, meat, vegetables, cheese,...
16
Define Classes and the Class Hierarchy
A class is a concept in the domain a class of wines a class of wineries a class of red wines …
A class is a collection of elements (instances of classes) with similar properties
17
Class Inheritance
Classes usually constitute a taxonomic hierarchy (a subclass-superclass hierarchy)
A class hierarchy is usually an IS-A hierarchy:
an instance of a subclass is an instance of a superclass
If you think of a class as a set of elements, a subclass is a subset
18
Class Inheritance - Example
Apple is a subclass of FruitEvery apple is a fruit
Red wines is a subclass of WineEvery red wine is a wine
Chianti wine is a subclass of Red wineEvery Chianti wine is a red wine
19
Modes of Development
top-down – define the most general concepts first and then specialize them
bottom-up – define the most specific concepts and then organize them in more general classes
combination – define the more salient concepts first and then generalize and specialize them
20
Documentation
Classes (and slots) usually have documentation Describing the class in natural language Listing domain assumptions relevant to the
class definition Listing synonyms
Documenting classes and slots is as important as documenting computer code!
21
Define Properties of Classes – Slots
Slots in a class definition describe attributes of instances of the class and relations to other instances
Each wine will have color, sugar content, producer, etc
22
Properties (Slots)
Types of properties “intrinsic” properties: flavor and color of wine “extrinsic” properties: name and price of wine parts: ingredients in a dish relations to other objects: producer of wine (winery)
Simple and complex properties simple properties (attributes): contain primitive values
(strings, numbers) complex properties: contain (or point to) other objects
(e.g., a winery instance)
23
Slots for the Class Wine
(in Protégé-2000)
24
Slot and Class Inheritance
A subclass inherits all the slots from the superclassIf a wine has a name and flavor, a red wine also has a name
and flavor
If a class has multiple superclasses, it inherits slots from all of themPort is both a dessert wine and a red wine. It inherits “sugar
content: high” from the former and “color:red” from the latter
25
Property Constraints
Property constraints (facets) describe or limit the set of possible values for a slotThe name of a wine is a string
The wine producer is an instance of Winery
A winery has exactly one location
26
Common Facets
Slot cardinality – the number of values a slot hasSlot value type – the type of values a slot hasMinimum and maximum value – a range of
values for a numeric slotDefault value – the value a slot has unless
explicitly specified otherwise
27
Common Facets: Slot CardinalityMinimum cardinality
Minimum cardinality 1 means that the slot must have a value (required)
Minimum cardinality 0 means that the slot value is optional
Maximum cardinality Maximum cardinality 1 means that the slot can have at most
one value (single-valued slot) Maximum cardinality greater than 1 means that the slot can
have more than one value (multiple-valued slot)
28
Common Facets: Value Type
String: a string of characters (“Château Lafite”)Number: an integer or a float (15, 4.5)Boolean: a true/false flagEnumerated type: a list of allowed values (high,
medium, low)Complex type: an instance of another class
Specify the class to which the instances belong
The Wine class is the value type for the slot “produces” at the Winery class
29
Domain and Range of Slot
Domain of a slot – the class (or classes) that have the slot More precisely: class (or classes) instances of
which can have the slot
Range of a slot – the class (or classes) to which slot values belong
30
Facets and Class Inheritance
A subclass inherits all the slots from the superclassA subclass can override the facets to “narrow” the
list of allowed values Make the cardinality range smaller Replace a class in the range with a subclass
Wine
Frenchwine
Winery
Frenchwinery
is-a is-a
producer
producer
31
Create Instances
Create an instance of a class The class becomes a direct type of the instance Any superclass of the direct type is a type of the
instance
Assign slot values for the instance frame Slot values should conform to the facet constraints Knowledge-acquisition tools often check that
32
Creating an Instance: Example
33
Multiple Inheritance
A class can have more than one superclass
A subclass inherits slots and facet restrictions from all the parents
Different systems resolve conflicts differently
34
Disjoint Classes Classes are disjoint if they cannot have common instances Disjoint classes cannot have any common subclasses either
Red wine, White wine,Rosé wine are disjoint
Dessert wine and Redwine are not disjoint
Wine
Redwine
Roséwine
Whitewine
Dessertwine
Port
35
The Perfect Family Size (1)
If a class has only one child, there may be a modeling problem
If the only Red Burgundy we have is Côtes d’Or, why introduce the subhierarchy?
Compare to bullets in a bulleted list
36
The Perfect Family Size (2)
If a class has more than a dozen children, additional subcategories may be necessary
However, if no natural classification exists, the long list may be more natural
37
Single and Plural Class Names
A “wine” is not a kind-of “wines”
A wine is an instance of the class Wines
Class
Instance
instance-of
38
Classes and Their Names
Classes represent concepts in the domain, not their names
The class name can change, but it will still refer to the same concept
Synonym names for the same concept are not different classes
Many systems allow listing synonyms as part of the class definition
39
A Completed Hierarchy of Wines
40
Inverse Slots
Maker and
Producer
are inverse slots
41
42
Data Exchange
Semantics+inference
Relational Data
???
Reasoning
???
OWL
Semantic Web “Layered Cake” (2001)
43
Semantic Web “Layered Cake” (refreshed)
44
Both use the same data model:
OWL extends vocabulary and adds axioms
OWL-RDFS Relationship
page.html “Dieter Fensel“hasAuthor
Resource
(subject)
Property
(predicate)
Value
(object)
45
Description Logic Family DLs are a family of logic based KR formalisms Particular languages mainly characterized by:
Set of constructors for building complex concepts and roles from simpler ones
Set of axioms for asserting facts about concepts, roles and individuals
Examples: “Female persons”
• Person ⊓ Female “Non-female persons”
• Person ⊓ Female “Persons that have a child”
• Person ⊓ hasChild.Person “Persons all of whose children are female”
• Person ⊓ hasChild.Female “Persons that are employed or self-eployed”
• Person ⊓ (Employee ⊔ SelfEmployed) “Persons that have at most one father“
• Person ⊓ ≤1.hasFather
46
Description Logic Family
Necessary and sufficient conditions
Inclusion axioms provide necessary conditions: concept ⊑ definition
Equivalence axioms provide necessary and sufficient conditions:
concept ≡ definition{ concept ⊑ definition anddefinition ⊑ concept
47
Complex Classes
Union of Classes
<owl:Class rdf:ID=“Person"> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Woman" /> <owl:Class rdf:about="#Man" /> </owl:unionOf> </owl:Class>
Instances of the Union of two Classes are either the instance of one or both classes
Person ≡ Man ⊔ Woman
48
Complex Classes
Intersection of Classes
<owl:Class rdf:ID=“Man"> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Person" /> <owl:Class rdf:about="#Male" /> </owl:intersectionOf> </owl:Class>
Instances of the Intersection of two Classes are simultaneously instances of both class
Man ≡ Person ⊓ Male
49
one of: Enumerated Classes
Specify a class via a direct enumeration of its members:
<owl:Class rdf:ID="WineColor"> <rdfs:subClassOf rdf:resource="#WineDescriptor"/> <owl:oneOf rdf:parseType="Collection"> <owl:Thing rdf:about="#White"/> <owl:Thing rdf:about="#Rose"/> <owl:Thing rdf:about="#Red"/> </owl:oneOf> </owl:Class>
WhineColor ≡ {White, Rose, Red}
50
Defining a Class by restricting its possible instances via their property values
OWL distinguishes between the following two: Value constraint
• (Mother ≡ Woman ⊓ hasChild.Person) Cardinality constraint
• (MotherWithManyChildren ≡ Mother ⊓ ≥3hasChild)
Property restrictions are local remember RDFS allows only global properties
Complex Classes Property Restrictions
51
Complex Classes - Property Restrictions someValuesFrom
<owl:Class rdf:ID=“Mother"> <rdfs:subClassOf rdf:resource="#Woman" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasChild" /> <owl:someValuesFrom rdf:resource="#Person" /> </owl:Restriction> </rdfs:subClassOf></owl:Class>
A Mother is a Woman that has a child (some Person)
Mother ⊑ Woman ⊓ hasChild.Person
52
Complex Classes - Property Restrictions allValuesFrom
<owl:Class rdf:ID=“ParentsWithOnlyDaughters"> <rdfs:subClassOf rdf:resource="#Person" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasChild" /> <owl:allValuesFrom rdf:resource="#Woman" /> </owl:Restriction> </rdfs:subClassOf> ... </owl:Class>
To express the set of parents that only have female children (daughters) you would write:
ParentsWithOnlyDaughters ⊑ Person ⊓ hasChild.Woman
53
hasValue allows to define classes based on the existence of particular property values, their must be at least one matching property value
The set of all childs of the woman MARY would be expressed like following:
Complex Classes - Property Restrictions hasValue
<owl:Class rdf:ID=“MarysChildren">
<rdfs:subClassOf rdf:resource="#Person" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasParent" /> <owl:hasValue rdf:resource="#MARRY" /> </owl:Restriction> </rdfs:subClassOf> </rdfs:subClassOf> ... </owl:Class>
MarysChildren ⊑ Person П hasParent.{MARY}
54
Definition of cardinality: the number of occurrences, either maximum (maxCardinality) or minimum (minCardinality) or exact (cardinality) based upon the context (class) in which it is used
To define a half-orphan (Halbwaise) you would write the following:
Complex Classes - Property Restrictions cardinality
<owl:Class rdf:ID=“HalfOrphan">
<rdfs:subClassOf rdf:resource="#Person" /> <rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasParent"/>
<owl:cardinality rdf:datatype="&xsd;NonNegativeInteger">1</owl:cardinality>
</owl:Restriction>
</rdfs:subClassOf>
</rdfs:subClassOf>
…
</owl:Class>
HalfOrphan ⊑ Person П =1hasParent.Person
55
RDF Schema provides a couple of pre defined properties: rdfs:range used to indicate the range of values for a property. rdfs:domain used to associate a property with a class. rdfs:subPropertyOf used to specialize a property.
OWL provides additional poperty classes, which allow reasoning and inferencing, i.e.
owl:functionalProperty owl:transitiveProperty owl:symetricProperty
Properties OWL vs. RDF
56
OWL (DL and Lite) distinguishes between data type ptoperties and object properties (RDFS does not)
Properties OWL vs. RDF
ResourceObjectProperty
Resource
DatatypePropertyResource Value
An ObjectProperty relates one Resource to another Resource:
A DatatypeProperty relates a Resource to a Literal or an XML Schema data type:
58
Example: If person A is a ancestor of person B and B of C then A is also an ancestor of C.
Properties in OWL
Transitive Property
<owl:ObjectProperty rdf:ID=“ancesotor">
<rdf:type rdf:resource="&owl;TransitiveProperty" />
<rdfs:domain rdf:resource="#Person" />
<rdfs:range rdf:resource="#Person" />
</owl:ObjectProperty>
ancestor+ ancestor
59
Example: If Mary is relative to John then John is also relative to Mary
Properties in OWL
Symmetric Property
<owl:ObjectProperty rdf:ID=“relative">
<rdf:type rdf:resource="&owl;SymmetricProperty" />
<rdfs:domain rdf:resource="#Person" />
<rdfs:range rdf:resource="#Person" />
</owl:ObjectProperty>
relative- relative and relative relative-
60
Example: If Mary is a child of John then John is the parent of Mary
Properties in OWL
Inverse Property
<owl:ObjectProperty rdf:ID=“hasChild">
<owl:inverseOf rdf:resource="hasParent" />
</owl:ObjectProperty>
hasChild hasParent-
61
A functional property states that the value of range for a certain object in the domain is always the same:
Example: A child has always the same Father (biological)
Properties in OWL
Functional Properties
<owl:ObjectProperty rdf:ID=“hasFather">
<rdf:tyoe rdf:resource="&owl;FunctionalProperty"/></owl:ObjectProperty>
Person 1hasFather
62
OWL Property Classes
rdf:Property
owl:ObjectProperty owl:DatatypeProperty
owl:SymmetricProperty owl:TransitiveProperty
owl:FunctionalProperty owl:InverseFunctionalProperty
The symmetric and transitive property may only used for connecting two resources:
63
OWL as DL: Axioms
Description Logic
First Order Logic
64
OWL as DL: Axioms
Social Security Number
65
Accessing the Reasoner (“Racer”) in Protégé
Classify taxonomy
(and check consistency)
Just check consistency
(for efficiency)
Compute inferred types
(for individuals)
66
Subsumption
The presented examples contain a number of classes and properties intended to illustrate particular aspects of reasoning in OWL.
We can make inferences about relationships between classes, in particular subsumption between classes
Recall that A subsumes B when it is the case that any instance of B must necessarily be an instance of A.
AB
67
Subsumption
An Example Woman ≡ Person ⊓ Female Man ≡ Person ⊓ Woman Mother ≡ Woman ⊓ hasChild.Person Father ≡ Man ⊓ hasChild.Person Parent ≡ Father ⊔ Mother Grandmother ≡ Mother ⊓ hasChild.Parent
We can further infer (though not explicitly stated):
Grandmother Person⊑ Grandmother Man ⊑ ⊔ Woman
etc.
68
Subsumption
Example in Protégé
69
Subsumption
Inferred Hierarchy in Protégé
70
Inconsistency
You may define Classes were no individual can fulfill its definition. Via reasoning engines such a definition can be found also in big ontologies.
71
Inconsistency
Example
Cow ≡ Animal ⊓ VegetarianSheep ⊑ Animal Vegetarian ≡ eats AnimalMadCow ≡ Cow ⊓ eats.Sheep
72
Inconsistency
Example in Protégé
73
Inconsistency
Detected Inconsistency in Protégé
74
Symmetric: if P(x, y) then P(y, x) Transitive: if P(x,y) and P(y,z) then P(x, z) Functional: if P(x,y) and P(x,z) then y=z InverseOf: if P1(x,y) then P2(y,x) InverseFunctional: if P(y,x) and P(z,x) then y=z allValuesFrom: P(x,y) and y=allValuesFrom(C) someValuesFrom: P(x,y) and y=someValuesFrom(C) hasValue: P(x,y) and y=hasValue(v) cardinality: cardinality(P) = N minCardinality: minCardinality(P) = N maxCardinality: maxCardinality(P) = N equivalentProperty: P1 = P2 intersectionOf: C = intersectionOf(C1, C2, …) unionOf: C = unionOf(C1, C2, …) complementOf: C = complementOf(C1) oneOf: C = one of(v1, v2, …) equivalentClass: C1 = C2 disjointWith: C1 != C2 sameIndividualAs: I1 = I2 differentFrom: I1 != I2 AllDifferent: I1 != I2, I1 != I3, I2 != I3, … Thing: I1, I2, …
OWL on one Slide
Legend:Properties are indicated by: P, P1, P2, etcSpecific classes are indicated by: x, y, zGeneric classes are indicated by: C, C1, C2Values are indicated by: v, v1, v2Instance documents are indicated by: I1, I2, I3, etc.A number is indicated by: NP(x,y) is read as: “property P relates x to y”
75
Full
DL
Lite
OWL Full Allow meta-classes etc
OWL DLNegation (disjointWith, complementOf)
unionOf Full CardinalityEnumerated types (oneOf)
OWL Lite(sub)classes, individuals(sub)properties, domain, rangeintersection(in)equalitycardinality 0/1datatypesinverse, transitive, symmetrichasValuesomeValuesFromallValuesFrom
RDF Schema
Back to the OWL Layers (Lite, DL, Full)
76
Summary
Compared with RDF/RDFS, OWL provides a more formal language which allows expressing more axioms, but also adds some restrictions
We can do inferences such as classify instances, detect inconsistencies, etc.
Last version Feb. 2004, but still under progresshttp://www.w3.org/2004/OWL/
77
W3C Documents Guide: http://www.w3.org/TR/owl-guide/ Reference: http://www.w3.org/TR/owl-ref/ Semantics and Abstract Syntax:
http://www.w3.org/TR/owl-semantics/OWL Tutorials
Ian Horrocks, Sean Bechhofer:http://www.cs.man.ac.uk/~horrocks/Slides/Innsbruck-tutorial/
Roger L. Costello, David B. Jacobs: http://www.xfront.com/owl/
Example Ontologies, e.g. here:http://www.daml.org/ontologies/
Resources
78
Tutorial: Designing Ontologies with Protégé
http://www.cs.man.ac.uk/~horrocks/Teaching/cs646/
http://www.co-ode.org/resources/tutorials/ProtegeOWLTutorial.pdf
Protégé is an ontology editor and a knowledge-base editor (download from http://protege.stanford.edu ).
Protégé is also an open-source, Java tool that provides an extensible architecture for the creation of customized knowledge-based applications.
Protégé's OWL Plug-in now provides support for editing Semantic Web ontologies.
79
RDF/OWL in Protégé
Example
80
Protégé Screenshot: Classes
81
Creating Properties
- New Datatype Property (String, int etc)
New Object Property:
Associates an individual to another individual
Delete Property
- New Annotation Properties for metadata
- New SubProperty – ie create “under” the current selection
82
Naming Properties
We often create properties using 2 standard naming patterns: has… (eg. hasColour); is…Of (eg. isTeacherOf) or other suffixes (eg. …In …To).
This has several advantages: It is easier to find properties; It is easier for tools to generate a more readable form; Inverses properties typically follow this pattern
eg. hasPart, isPartOf .
83
Protégé Screenshot: Datatype properties
84
Protégé Screenshot: Object Properties
85
Protégé Screenshot: Instances (1)
86
Protégé Screenshot: Instances (2)
87
Protégé Screenshot: Instances (3)
88
Protégé Screenshot: Forms
89
Protégé Screenshot: Ontologies
90
Protégé Screenshot: Code-1 (OWL/RDF)
91
Protégé Screenshot: Code-2 (OWL/RDF)
92
Some issues on Editing OWL Ontologies with Protégé
From Holger KnublauchStanford University
July 06, 2004
http://protege.stanford.edu/doc/tutorial/get_started/
http://www.co-ode.org/resources/tutorials/ProtegeOWLTutorial.pdf
93
Restrictions (Overview)
Define a condition for property values allValuesFrom someValuesFrom hasValue minCardinality maxCardinality cardinality
An anonymous class consisting of all individuals that fulfill the condition
94
Cardinality Restrictions
Meaning: The property must have at least/at most/exactly x values
is the shortcut for andExample: A FamilyDestination is a Destination
that has at least one Accomodation and at least 2 Activities
95
(Create defined class FamilyDestination)
96
allValuesFrom Restrictions
Meaning: All values of the property must be of a certain type
Warning: Also individuals with no values fulfill this condition (trivial satisfaction)
Example: Hiking is a Sport that is only possible in NationalParks
97
someValuesFrom Restrictions
Meaning: At least one value of the property must be of a certain type
Others may exist as wellExample: A NationalPark is a RuralArea
that has at least one Campground and offers at least one Hiking opportunity
98
hasValue Restrictions
Meaning: At least one of the values of the property is a certain value
Similar to someValuesFrom but with Individuals and primitive values
Example: A PartOfSydney is a Destination where one of the values of the isPartOf property is Sydney
99
Enumerated Classes
Consist of exactly the listed individuals
OneStarRating
TwoStarRatingThreeStarRating
BudgetAccomodation
100
Logical Class Definitions
Define classes out of other classes unionOf (or) intersectionOf (and) complementOf (not)
Allow arbitrary nesting of class descriptions (A and (B or C) and not D)
101
unionOf
The class of individuals that belong to class A or class B (or both)
Example: Adventure or Sports activities
Adventure Sports
102
intersectionOf
The class of individuals that belong to both class A and class B
Example: A BudgetHotelDestination is a destination with accomodation that is a budget accomodation and a hotel
BudgetAccomodation
Hotel
103
Implicit intersectionOf
When a class is defined by more than one class description, then it consists of the intersection of the descriptions
Example: A luxury hotel is a hotel that is also an accomodation with 3 stars
AccomodationWith3StarsHotel
LuxuryHotel
104
complementOfThe class of all individuals that do not
belong to a certain classExample: A quiet destination is a
destination that is not a family destination
DestinationFamilyDestination
QuietDestination (grayed)
105
Class Conditions
Necessary Conditions:(Primitive / partial classes)“If we know that something is a X,then it must fulfill the conditions...”
Necessary & Sufficient Conditions:(Defined / complete classes)“If something fulfills the conditions...,then it is an X.”
106
Class Conditions (2)
QuietDestination
NationalPark
(not everything that fulfills theseconditions is a NationalPark)
(everything that fulfills theseconditions is a QuietDestination)
107
ClassificationNationalPark
BackpackersDestination
A RuralArea is a Destination
A Campground is BudgetAccomodation
Hiking is a Sport Therefore:
Every NationalPark is a Backpackers-Destiantion
(Other BackpackerDestinations)
108
Classification (2)Input: Asserted class definitionsOutput: Inferred subclass relationships
109
(Create an enumerated class out of individuals)
110
(Create a hasValue restriction)
111
(Create a hasValue restriction)
112
(Create a defined class)
113
(Classify Campground)
114
(Add restrictions to City and Capital)
115
(Create defined class BackpackersDestination)
116
(Create defined class QuietDestination)
117
(Create defined class RetireeDestination)
118
(Classification)
119
Individuals
120
Individuals