semantic web - sharifce.sharif.edu/courses/95-96/1/ce694-1/resources/root/lecturenotes/... ·...
Post on 31-Jan-2018
215 Views
Preview:
TRANSCRIPT
ه عای
Semantic Web
Morteza Amini
Ontology and OWL
Sharif University of Technology Fall 95-96
Outline
Introduction & Definitions
Ontology Languages
OWL (Ontology Web Language)
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 2
Outline
Introduction & Definitions
Ontology Languages
OWL (Ontology Web Language)
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 3
Where does it come from?
ontology n.
1692; lat. phil. onto- “being” + -logia “study of”
Philosophy The study of what is, what has to be true for something to
exist, the kinds of things that can exist.
AI and computer science Something exists if it can be represented, described, defined (in
a formal, hence, machine-interpretable way).
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 4
Ontologies
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 5
Ontologies (contd.)
Ontologies are about vocabularies and their meanings, with explicit, expressive, and well-defined semantics, possibly machine-interpretable.
“Ontology is a formal specification of a shared conceptualization.” Gruber, 1993
Main elements of an ontology: Concepts Relationships
Hierarchical Logical
Properties Instances (individuals)
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 6
Ontologies in Semantic Web
Although XML DTDs and XML Schemas are sufficient for exchanging data between parties who have agreed to definitions beforehand, their lack of semantics prevent machines from reliably performing this task given new XML vocabularies.
RDF and RDF Schema begin to approach this problem by allowing simple semantics to be associated with identifiers. With RDF Schema, one can define classes that may have multiple subclasses and super classes, and can define properties, which may have sub properties, domains, and ranges.
In this sense, RDF Schema is a simple ontology language. However, in order to achieve interoperation between numerous, autonomously developed and managed schemas, richer semantics are needed.
For example, RDF Schema cannot specify that the Person and Car classes are disjoint, or that a string quartet has exactly four musicians as members.
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 7
For Machines...
The meaning of the document is not defined.
Machines cannot understand it.
We are defining the structure of document by XML, but now the meaning of the structure is not defined.
<Sentence> <Subject> Paper </Subject> <Verb> is made from </Verb> <Object> Wood </Object> </Sentence>
XM
L do
cum
ent
<Σεντενχε> <Συβϕεχτ> Παπερ </Συβϕεχτ> <ςερβ> ισ µαδε φροµ </ςερβ> <Οβϕεχτ> Ωοοδ </Οβϕεχτ> </Σεντενχε>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 8
<Σεντενχε> <Συβϕεχτ> </Συβϕεχτ> <ςερβ> </ςερβ> <Οβϕεχτ> </Οβϕεχτ> </Σεντενχε>
Παπερ
ισ µαδε φροµ
Ωοοδ
Ontology Gives the Meaning...
Document Ontology
Natural Language
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 9
Why Develop Ontologies?
To share common understanding of the structure of information among people or agents and share knowledge E.g., using an ontology for integrating terminologies
To reuse domain knowledge E.g., geography ontology
To make domain assumptions explicit Facilitate knowledge management, easier to validate, to change, … Enable new users to learn about the domain
To support interoperability Terms defined in expressive ontologies allow for mapping precisely how
one term relates to another
….
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 10
Outline
Introduction & Definitions
Ontology Languages
OWL (Ontology Web Language)
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 11
Ontology Languages
Graphical notations Semantic networks Topic maps UML RDF(S)
Logic based Description Logics (e.g., OIL, DAML+OIL, OWL) Rules (e.g., RuleML, LP/Prolog, SWRL) First Order Logic
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 12
Ontology Languages
RDF(S) (Resource Description Framework (Schema))
OIL (Ontology Interchange Language)
DAML+OIL (DARPA Agent Markup Language + OIL)
OWL (Ontology Web Language)
XOL (XML-based Ontology Exchange Language)
SHOE (Simple HTML Ontology Extension)
OML (Ontology Markup Language)
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 13
Object Oriented Model
Many languages use object oriented model:
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 and Concepts in DL
Relations/Properties/Roles Sets of pairs (tuples) of objects Equivalent to binary predicates in FOL and Roles in DL
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 14
Outline
Introduction & Definitions
Ontology Languages
OWL (Ontology Web Language)
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 15
OWL (Ontology Web Language)
OWL is now a W3C Recommendation.
The purpose of OWL is identical to RDFS i.e. to provide an XML vocabulary to define classes, properties and their relationships. RDFS enables us to express very rudimentary relationships and
has limited inferencing capability. OWL enables us to express much richer relationships, thus
yielding a much enhanced inferencing capability.
The benefit of OWL is that it facilitates a much greater degree of inference than you get with RDF Schema.
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 16
Origins of OWL
RDF(S)
DAML+OIL
DARPA Agent Markup Language
A W3C Recommendation
OIL
OWL
All influenced by RDF
Ontology Interchange Language
EU/NSF Joint Ad hoc Committee
DAML
OWL Lite OWL DL OWL Full
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 17
OWL
OWL and RDF Schema enable rich machine-processable semantics.
XML/DTD/XML Schemas
RDF Schema
OWL Semantics
Syntax
<rdfs:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/> </rdfs:Class>
<owl:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/> </owl:Class>
RDFS
OWL
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 18
OWL Design Goals
Shared ontologies
Ontology interoperability
Inconsistency detection
Expressivity vs. scalability
Ease of use
Compatibility with other standards
Internationalization Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 19
Versions of OWL
Depending on the intended usage, OWL provides three increasingly expressive sublanguages.
Full Very expressive, no computation (decidability)
guarantees.
DL (Description Logic) Maximum expressiveness, computationally
complete (decidable).
Lite Simple classification hierarchy with simple
constraints.
OWL Full
OWL DL
OWL Lite
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 20
Comparison of Versions
OWL Lite supports those users primarily needing a classification hierarchy and simple constraints. E.g., while it supports cardinality constraints, it only permits cardinality values of 0 or 1
OWL DL supports those users who want the maximum expressiveness while retaining decidability. OWL DL includes all OWL language constructs, but they can be used only under certain restrictions (e.g., while a class may be a subclass of many classes, a class cannot be an instance of another class). OWL DL is so named due to its correspondence with description logics.
OWL Full is meant for users who want maximum expressiveness and the syntactic freedom of RDF with no computational guarantees. For example, in OWL Full a class can be treated simultaneously as a collection of individuals and as an individual in its own right.
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 21
OWL vs. RDFS
OWL allows greater expressiveness (more meaning) Abstraction mechanism to group resources with similar
characteristics Much more powerful in describing constraints on relations
between classes Property transitivity, equivalence, symmetry, etc. …
Extensive support for reasoning
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 22
OWL vs. RDFS
RDF Schema provides some of predefined 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 predefined properties: owl:cardinality (indicate cardinality) owl:hasValue (at least one of the specified property values) …
OWL provides additional property classes, which allow reasoning and inferencing: owl:FunctionalProperty owl:TransitiveProperty …
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 23
OWL/XML Declaration
Similar to RDF, containing owl name space. <rdf:RDF xmlns:owl=”http://www.w3c.org/2002/07/owl#” xmlns:rdf=“http://www.w3c.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs=“http://www.w3c.org/2000/01/rdf-schema#” xmlns:ex=“…”>
.
.
.
</rdf:RDF>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 24
OWL Ontologies
What’s inside an OWL ontology Classes + class-hierarchy Properties (Slots) / values Relations between classes
(inheritance, disjoints, equivalents) Restrictions on properties (type, cardinality) Characteristics of properties (transitive, …) Individuals ...
Reasoning tasks: classification, consistency checking, …
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 25
Classes
What is a Class?
e.g., person, pet, old
a collection of individuals (object, things, . . . )
a way of describing part of the world
an object in the world (OWL Full)
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 26
OWL Classes
owl:Class Subclass of Class in RDF Better to forget about classes of classes in this course
Top-most class: owl:Thing
Bottom class: owl:Nothing
<owl:Class rdf:ID=“Person"/> <owl:Class rdf:ID=“Man"> <rdfs:subClassOf rdf:resource="#Person" /> </owl:Class>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 27
Describing Classes in OWL
Complex Classes Union of classes (owl:unionOf)
OR (A B)
Intersection of classes (owl:intersectionOf) AND (A B)
Complement (owl:complementOf)
NOT (ØA)
Enumeration (owl:oneOf)
Disjoint Classes (owl:disjointWith)
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 28
Example
<owl:Class rdf:ID=“Parent” /> <owl:Calss rdf:ID=“Man”> <owl:subClassOf rdf:resource=#Person”/> <owl:disjointWith rdf:resource=#Woman”/> </owl:Class> <owl:Class rdf:ID=“Father”> <owl:intersectionOf rdf:parseType=“Collection”> <owl:Class rdf:about=“#Parent”/> <owl:Class rdf:about=“#Man”/> </owl:intersectionOf> </owl:Class> <owl:Class rdf:ID=“Nationality”> <owl:oneOf rdf:parseType=“Collection”> <owl:Thing rdf:about=“#Iranian”/> <owl:Thing rdf:about=“#Japanese”/> . . . </owl:oneOf> </owl:Class>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 29
Example
<owl:Calss rdf:ID=“A”> <owl:intersectionOf rdf:parseType=“Collection”> <owl:Class> <owl:oneOf rdf:parseType=“Collection”> <owl:Thing rdf:about=“#x1”/> <owl:Thing rdf:about=“#x2”/> . . . </owl:oneOf> </owl:Class> <owl:Class> <owl:unionOf rdf:parseType=“Collection”> <owl:Class rdf:about=“#B”/> <owl:Class rdf:about=“#C”/> . . . </owl:unionOf> </owl:Class> <owl:Class> <owl:complementOf rdf:resource=“#D”/> </owl:Class> </owl:intersectionOf> </owl:Class>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 30
A≡x1, x2 (BC) ¬D
Properties
What is a Property?
e.g., has_father, has_pet, service_number
a collection of relationships between individuals (and data)
a way of describing a kind of relationship between individuals
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 31
OWL Properties
Object Properties
Ana owns Cuba
Data type Properties
Ana age 25
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 32
Describing Properties in OWL
OWL Property Classes An ObjectProperty relates one Resource to another
Resource. A DatatypeProperty relates one Resource to a Literal - an
XML Schema data type.
rdf:Property
owl:ObjectProperty owl:DatatypeProperty owl:FunctionalProperty owl:InverseFunctionalProperty
owl:SymmetricProperty owl:TransitiveProperty
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 33
Defining Properties
We have RDFS facilities as well. rdfs:subPropertyOf rdfs:domain rdfs:range
<owl:ObjectProperty rdf:ID="madeFrom"> <rdfs:domain rdf:resource="#Book"/> <rdfs:range rdf:resource="#Paper"/> </owl:ObjectProperty>
<owl:ObjectProperty rdf:ID=“fatherOf"> <rdfs:subPropertyOf rdf:resource="#parentOf"/> </owl:ObjectProperty>
<owl:DatatypeProperty rdf:ID=“hasAge"> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="&xsd;positiveInteger"/> </owl:DatatypeProperty>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 34
Transitive Properties
X p Y
Y p Z
imply X p Z
Transitivity existed already in RDF “rdfs:subClassOf”, “rdfs:subPropertyOf”
Example: locatedIn <owl:TransitiveProperty rdf:ID=“locatedIn"> <rdfs:domain rdf:resource="#Region"/> <rdfs:range rdf:resource="#Region"/> </owl:TransitiveProperty>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 35
Symmetric Properties
X p Y
implies Y p X
Example: colleagueOf <owl:SymmetricProperty rdf:ID=“colleagueOf"> <rdfs:domain rdf:resource="#Person"/> <rdfs:range rdf:resource="#Person"/> </owl:SymmetricProperty>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 36
Functional Properties
X p Y
X p Z
imply Z is the same as Y (describe the same)
Example: hasHusband <owl:FunctionalProperty rdf:ID=“hasHusband"> <rdfs:domain rdf:resource="#Woman"/> <rdfs:range rdf:resource="#Man"/> </owl:FunctionalProperty>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 37
Inverse Functional Properties
Y p X
Z p X
imply Z is the same as Y (describe the same)
Example: isMotherOf
<owl:InverseFunctionalProperty rdf:ID=“isMotherOf"> <rdfs:domain rdf:resource="#Woman"/> <rdfs:range rdf:resource="#Person"/> </owl:InverseFunctionalProperty>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 38
Individuals and Their Properties
Two equivalent declarations: <Person rdf:ID=“ahmadi" />
OR <owl:Thing rdf:ID=“ahmadi" /> <owl:Thing rdf:about="#ahmadi"> <rdf:type rdf:resource="#Person"/> </owl:Thing>
Properties of an individual < Person rdf:ID=“reza" /> <owl:Thing rdf:about="#ahmadi"> <fatherOf rdf:resource="#reza"/> <hasAge rdf:datatype=“&xsd;positiveInteger “>42</hasAge> </owl:Thing>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 39
Individuals
owl:sameAs Links two references to an individual.
owl:differentFrom Indicates two URI references refer to different individuals.
owl:AllDifferent All individuals in the list are all different from each other.
<owl:AllDifferent> <owl:distinctMembers rdf:parseType=“Collection”> <Person rdf:about=“#ali”/> <Person rdf:about=“#reza”/> <Person rdf:about=“#maryam”/> </owl:distinctMembers> </owl:AllDifferent> <Person rdf:ID=“ali"> <owl:differentFrom rdf:resource="#reza"/> <owl:sameAs rdf:resource="#morteza"/> </Person>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 40
OWL Distributed
owl:equivalentClass for describing equivalent classes.
owl:equivalentProperty for describing equivalent properties.
Guitar
Guitarra
Internationalization standards ? Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 41
Example
<owl:Class rdf:ID="DaPonteOperaOfMozart">
<owl:equivalentClass>
<owl:Class>
<owl:oneOf rdf:parseType="Collection">
<Opera rdf:about="#Nozze_di_Figaro"/>
<Opera rdf:about="#Don_Giovanni"/>
<Opera rdf:about="#Cosi_fan_tutte"/>
</owl:oneOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 42
OWL Property Restriction
Property restriction is a kind of class description.
Property Restrictions
Defining a Class by restricting its possible instances via their
property values.
OWL distinguishes between the following two:
Value constraints
Cardinality constraints
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 43
OWL Value Constraints
Puts constraints on the range of the property when applied to this particular class description.
Properties: allValuesFrom: rdfs:Class (lite/DL owl:Class) hasValue: specific Individual someValuesFrom: rdfs:Class (lite/DL owl:Class)
<owl:Restriction> <owl:onProperty rdf:resource=“#hasParent”/> <owl:someValuesFrom rdf:resource=“#Physician”> </owl:Restriction> <owl:Class rdf:ID=“AliChildren”> <rdfs:equivalentClass> <owl:Restriction> <owl:onProperty rdf:resource=“#hasParent”/> <owl:hasValue rdf:resource=“#ali”> </owl:Restriction> </rdfs:equivalentClass> <owl:Class>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 44
Class Description
OWL Cardinality Constraints
Any instance of a class may have an arbitrary number (zero or more) of values for a particular property.
To restrict the cardinality of properties locally with in a class context, the following constructs can be used. owl:minCardinality type: xsd:nonNegativeInteger (in lite 0,1) owl:maxCardinality type: xsd:nonNegativeInteger (in lite 0,1) owl:Cardinality type: xsd:nonNegativeInteger (in lite 0,1)
Example: Fathers have at least two children. <owl:Class rdf:ID=“Father”> <owl:Restriction owl:minCardinality=“2"> <owl:onProperty rdf:resource="#hasChild" /> </owl:Restriction> </owl:Class>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 45
An Example of OWL Ontology
<owl:Class rdf:ID=“Person” /> <owl:Class rdf:ID=“Man”>
<rdfs:subClassOf rdf:resource=“#Person” /> <owl:disjointWith rdf:resource=“#Woman” />
</owl:Class> <owl:Class rdf:ID=“Woman”> <rdfs:subClassOf rdf:resource=“#Person” /> <owl:disjointWith rdf:resource=“#Man” /> </owl:Class> <owl:Class rdf:ID=“Father”> <rdfs:subClassOf rdf:resource=“Man” /> <owl:Restriction owl:minCardinality="1"> <owl:onProperty rdf:resource="#hasChild" /> </owl:Restriction> </owl:Class> <owl:ObjectProperty rdf:ID=“hasChild"> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="#Person" /> </owl:ObjectProperty>
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 46
Introduction to OWL2: Version 2 of OWL
OWL2 has a very similar overall structure to OWL1.
Backwards compatibility with OWL1 is, to all intents and purposes, complete: all OWL1 Ontologies remain valid OWL2 Ontologies, with identical inferences in all practical cases.
OWL2 adds new functionality with respect to OWL1. Some of the new features are syntactic sugar (e.g., disjoint union of
classes) Others offer new expressivity, including:
Keys: a collection of properties can be assigned as a key to a class. Property chains: to define properties as a composition of other properties. Richer datatypes and data ranges: capability of custom datatype definition. Qualified cardinality restrictions: supporting ∃£nR.C and ∃£nR.C and ∃=nR.C Asymmetric, reflexive, and disjoint properties
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 47
OWL2 Profiles (1)
OWL2 also defines three new profiles.
Profiles considered Useful computational properties, e.g., reasoning complexity Implementation possibilities, e.g., using RDBs
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 48
OWL 2 three different tractable profiles:
OWL2 EL: polynomial time reasoning for schema (ontology consistency and subsumption) Useful for ontologies with large conceptual part
OWL2 QL: fast (logspace) query answering using RDBMs via SQL Useful for large datasets already stored in RDBs
OWL2 RL: fast (polynomial) query answering using rule extended DBs Useful for large datasets stored as RDF triples
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 49
OWL2 Profiles (2)
OWL2 EL is particularly useful in applications employing ontologies that contain very large numbers of properties and/or classes. Using this profile the basic reasoning problems (ontology consistency and class expression subsumption) can be performed in time that is polynomial with respect to the size of the ontology. The EL acronym reflects the profile's basis in the EL family of description logics [EL++],
logics that provide only Existential quantification.
OWL2 QL is aimed at applications that use very large volumes of instance data, and where query answering is the most important reasoning task. Using a suitable reasoning technique, sound and complete conjunctive query answering can be performed in LOGSPACE with respect to the size of the data (assertions). The QL acronym reflects the fact that query answering in this profile can be implemented
by rewriting queries into a standard relational Query Language.
OWL2 RL is aimed at applications that require scalable reasoning without sacrificing too much expressive power. OWL2 RL reasoning systems can be implemented using rule-based reasoning engines. The ontology consistency, class expression satisfiability, class expression subsumption, instance checking, and conjunctive query answering problems can be solved in time that is polynomial with respect to the size of the ontology. The RL acronym reflects the fact that reasoning in this profile can be implemented using a
standard Rule Language.
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 50
References
http://www.w3.org/TR/owl-ref/
http://www2.informatik.hu-berlin.de/~wandelt/ SW201213/9OWL2.pdf
Chapter 6 of the book
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 51
Any Question... amini@sharif.edu
Sharif Univ. of Tech. Ontology and OWL - Morteza Amini 52
top related