Knowledge Representation Part VII Protg / RDFS / OWL / ++ Jan - - PowerPoint PPT Presentation

knowledge representation
SMART_READER_LITE
LIVE PREVIEW

Knowledge Representation Part VII Protg / RDFS / OWL / ++ Jan - - PowerPoint PPT Presentation

Knowledge Representation Part VII Protg / RDFS / OWL / ++ Jan Pettersen Nytun, UiA 1 S O P Outline Protg example RDFS OWL Some W3C documents concerning OWL 2 Jan Pettersen Nytun, UiA, Ontologies, page 2 S O P The


slide-1
SLIDE 1

1

Knowledge Representation Part VII Protégé / RDFS / OWL / ++

Jan Pettersen Nytun, UiA

slide-2
SLIDE 2

S O

P

Outline

  • Protégé example
  • RDFS
  • OWL
  • Some W3C documents concerning OWL 2
Jan Pettersen Nytun, UiA, Ontologies, page 2
slide-3
SLIDE 3

S O

P

Jan Pettersen Nytun, UiA, page 3

The Semantic Web Language Stack

Hierarchy of languages, where each layer exploits and uses capabilities of the layers below.

/ XML Schema

slide-4
SLIDE 4

S O

P

Individuals

Jan Pettersen Nytun, UiA, page 4

[4]

slide-5
SLIDE 5

S O

P

Setting Default Namespace Explicitly

  • I found some problems like double #’s in the stored

file when not explicitly stating the namespace.

Jan Pettersen Nytun, UiA, page 5

Explicitly stating the default namespace

slide-6
SLIDE 6

S O

P

Turle File

@prefix : <http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @base <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#> . <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#> rdf:type

  • wl:Ontology .
Jan Pettersen Nytun, UiA, page 6
slide-7
SLIDE 7

S O

P

Turle File Continues...

######################################################## # # Object Properties # ########################################################

:hasSibling rdf:type

  • wl:ObjectProperty .

:livesIn rdf:type

  • wl:ObjectProperty .
Jan Pettersen Nytun, UiA, page 7
slide-8
SLIDE 8

S O

P

Turle File Continues...

################################################################# # # Individuals # ################################################################# :England rdf:type owl:NamedIndividual ,

  • wl:Thing .

:Gemma rdf:type owl:NamedIndividual ,

  • wl:Thing .

:Matthew rdf:type

  • wl:NamedIndividual ,
  • wl:Thing ;

:livesIn :England ; :hasSibling :Gemma .

Jan Pettersen Nytun, UiA, page 8
slide-9
SLIDE 9

S O

P

Jan Pettersen Nytun, UiA, page 9

Adding Classes

slide-10
SLIDE 10

S O

P

########################################################## # # Classes # ########################################################## :Country rdf:type owl:Class . :Person rdf:type

  • wl:Class .
Jan Pettersen Nytun, UiA, page 10
slide-11
SLIDE 11

S O

P

# Individuals :England rdf:type :Country ,

  • wl:NamedIndividual .

:Gemma rdf:type :Person ,

  • wl:NamedIndividual .

:Matthew rdf:type :Person ,

  • wl:NamedIndividual ;

:livesIn :England ; :hasSibling :Gemma .

Jan Pettersen Nytun, UiA, page 11
slide-12
SLIDE 12

S O

P

[4]: In OWL classes are built up of descriptions that specify the conditions that must be satisfied by an individual for it to be a member of the class.

Jan Pettersen Nytun, UiA, page 12
slide-13
SLIDE 13

S O

P

Which Syntax Does Protégé Uses?

Jan Pettersen Nytun, UiA, Ontologies, page 13
slide-14
SLIDE 14

S O

P

Protégé Uses The Manchester OWL Syntax in Dialog Windows

  • The Manchester syntax [OWL 2 Manchester

Syntax] is an OWL syntax that is designed to be easier for non-logicians to read.

Jan Pettersen Nytun, UiA, Ontologies, page 14
slide-15
SLIDE 15

S O

P

Save Ontology Using The Manchester Syntax

Prefix: : <http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#> Prefix: owl: <http://www.w3.org/2002/07/owl#> Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> Prefix: xml: <http://www.w3.org/XML/1998/namespace> Prefix: xsd: <http://www.w3.org/2001/XMLSchema#> Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#> Ontology: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#> ObjectProperty: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#livesIn> ObjectProperty: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#hasSibling> Class: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#Person> Class: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#Country>

Jan Pettersen Nytun, UiA, Ontologies, page 15
slide-16
SLIDE 16

Individual: Matthew Types: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#Person> Facts: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#livesIn> <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#England>, <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#hasSibling> <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#Gemma> Individual: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#Gemma> Types: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#Person> Individual: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#England> Types: <http://http://www.uia.no/IKT437/janpettersennytun/ontologies/lecture5#Country>

slide-17
SLIDE 17

S O

P

Outline

  • Protégé example
  • RDFS
  • OWL
  • Some W3C documents concerning OWL 2
Jan Pettersen Nytun, UiA, Ontologies, page 17
slide-18
SLIDE 18

S O

P

RDFS

Allows definition of (simple) ontologies. RDFS gives some fundamental concepts, e.g.:

  • subClassOf
  • subPropertyOf
  • Domain and range
Jan Pettersen Nytun, UiA, 18
slide-19
SLIDE 19

S O

P

rdfs:subClassOf

The members of one class (the subclass) are also members of the other (the super class). Tools like reasoners “understands” the semantics of subClassOf.

Jan Pettersen Nytun, UiA, 19

:Female rdf:type owl:Class ; rdfs:subClassOf :Human .

slide-20
SLIDE 20

S O

P

rdfs:subPropertyOf

The pair related by one property (the sub property) are included in the other (the super property).

Jan Pettersen Nytun, UiA, 20

:hasSon rdf:type owl:ObjectProperty ; rdfs:subPropertyOf :isParentTo .

slide-21
SLIDE 21

S O

P

Property Domains and Ranges

  • Properties link individuals from the domain to

individuals from the range (or to “data” if for instance type is String).

  • Pizza ontology example:
  • the property hasTopping links individuals belonging to

class Pizza (domain) to individuals belonging to the class of PizzaTopping (range).

  • It is important to realize that in OWL domains and

ranges should not be viewed as only constraints to be

  • checked. They are used as `axioms' in reasoning.
Jan Pettersen Nytun, UiA, 21
slide-22
SLIDE 22

S O

P

Domain and Range can be used to

describe a property. They determine the class membership of individuals related by the property.

Jan Pettersen Nytun, UiA, 22

Given the 2 triples: :employer rdfs:domain :Person :employer rdfs:range :Organization Then triple: :John :employer :CompanyX Requires that:

  • :John is necessarily a :Person
  • :CompanyX is necessarily a :Organization

From Wikipedia, the free encyclopedia

slide-23
SLIDE 23

S O

P

Multiple Classes As The Range For A Property

This is interpreted as the intersection of the

  • classes. For example, if the range of a property

has the classes Man and Woman, the range of the property is interpreted as Man intersection Woman (this range would then be very small in number of

individuals since not many are man and woman at the same time).

Jan Pettersen Nytun, UiA , 23
slide-24
SLIDE 24

S O

P

Jan Pettersen Nytun, UiA, page 24

Did not work for me!

slide-25
SLIDE 25

S O

P

This Seems to Work Fine!

somePizza and someTopping are individuals stated to be of type Thing

Jan Pettersen Nytun, UiA, page 25
slide-26
SLIDE 26

S O

P

Limitations Of RDFS

[5] …modelers often need even richer and more expressive primitives to specify the formal semantics of Web resources… For example, one cannot state in RDFS that “this class is equivalent to this other class”, and cannot specify cardinality constraints.

Jan Pettersen Nytun, UiA, 26
slide-27
SLIDE 27

S O

P

Outline

  • Protégé example
  • RDFS
  • OWL
  • Some W3C documents concerning OWL 2
Jan Pettersen Nytun, UiA, Ontologies, page 27
slide-28
SLIDE 28

S O

P

OWL

OWL extends the possibilities found in RDFS, e.g.:

  • equivalentClass
  • inverseOf
  • transitiveProperty
  • SymetricProperty
Jan Pettersen Nytun, UiA, 28
slide-29
SLIDE 29

S O

P

Part Of OWL Metamodel [5]

Jan Pettersen Nytun, UiA, Ontologies, page 29
slide-30
SLIDE 30

S O

P

Unique Name Assumption (UNA) in Logic

  • UNA  different names always refer to different

entities in the world.

  • Protégé-OWL is based on UNA.
  • OWL is not based on UNA.

OWL supplies explicit constructs:

– owl:sameAs (property)  two given names or identifiers (e.g., URIs) refer to the same individual or entity. – owl:differentFrom (property)  two given names or identifiers (e.g., URIs) refer to different individuals or entities.

Jan Pettersen Nytun, UiA, page 30
slide-31
SLIDE 31

S O

P

Disjoint Classes

  • OWL Classes are assumed to “overlap”, e.g.,

an individual may be of several classes.

  • It is however possible to specify that two

classes are disjoint.

Knowledge Representation Part III, JPN, UiA

Jan Pettersen Nytun, UiA , 31
slide-32
SLIDE 32

S O

P

OWL Property types

  • There are two main

types of properties:

– Object properties. – Datatype properties.

  • Additionally:

Annotation properties can be used to add metadata (data about data).

Knowledge Representation Part II, JPN, UiA

32
slide-33
SLIDE 33

S O

P

Property Characteristics

OWL allows the meaning of properties to be enriched through the use of property

  • characteristics. E.g., inverse property.

Knowledge Representation Part III, JPN, UiA

33
slide-34
SLIDE 34

S O

P

Inverse Property

  • If some property links individual A to individual B

then its inverse property will link individual B to individual A.

  • For example, Figure 4.16 shows the property

hasParent and its inverse property hasChild. If Matthew hasParent Jean, then because of the inverse property we can infer that Jean hasChild Matthew.

Knowledge Representation Part III, JPN, UiA

34
slide-35
SLIDE 35

S O

P

Functional Properties

  • A functional property connects only one object or

literal to a subject.

Knowledge Representation Part III, JPN, UiA

35

E.g., it is only possible to have one birth mother

slide-36
SLIDE 36

S O

P

Functional Properties Continues …

Mapping functional property to UML: It is possible to define an association as functional by specifying the upper multiplicity of the navigable end as being 0..1

Knowledge Representation Part III, JPN, UiA

36

Person Female

hasBirthMother isBirthMotherTo 0..1 *

slide-37
SLIDE 37

S O

P

Inverse Functional Properties

  • If a property is inverse functional then it means

that the inverse property is functional.

Knowledge Representation Part III, JPN, UiA

37
slide-38
SLIDE 38

S O

P

Functional / Inverse Functional Properties

JPN, UiA

38

Person Female

hasBirthMother isBirthMotherTo 0..1 *

Inverse Functional Property Functional Property

Inverse functional properties are similar, but in the reverse direction.

slide-39
SLIDE 39

S O

P

Functional / Inverse Functional Properties continues …

  • Both object properties and datatype properties can be declared as

"functional“ but not “functional inverse”.

  • [http://stackoverflow.com/questions/21487939/what-is-the-difference-between-

datatypeproperty-objectproperty-functionalpro]:

39

we cannot have the equivalence between the conditions that

p is an inverse functional property

and that p-1 is a functional property because datatype properties cannot have inverses. RDF does not allow literal values as the subjects of triples.

slide-40
SLIDE 40

S O

P

More Property Characteristics

If a property is transitive, and the property relates individual a to individual b, and also individual b to individual c, then we can infer that individual a is related to individual c via property P. E.g., subRegionOf

JPN, UiA

40
slide-41
SLIDE 41

S O

P

More Property Characteristics

If a property P is symmetric, and the property relates individual a to individual b then individual b is also related to individual a via property P. E.g., hasSibling

JPN, UiA

41
slide-42
SLIDE 42

S O

P

More Property Characteristics

If a property P is asymmetric, and the property relates individual a to individual b then individual b cannot be related to individual a via property P. E.g., isMotherTo

JPN, UiA

42
slide-43
SLIDE 43

S O

P

More Property Characteristics

A property P is said to be reflexive when the property must relate individual to itself. E.g., hasRelative (everybody has himself as a relative).

This does not necessarily mean that every two individuals which are related by a reflexive property are identical.

JPN, UiA

43
slide-44
SLIDE 44

S O

P

More Property Characteristics

Irreflexive, meaning that no individual can be related to itself by such a role. E.g., hasParent

Knowledge Representation Part III, JPN, UiA

44 parentOf
slide-45
SLIDE 45

S O

P

OWL Restrictions

  • Three main categories:

– Quantifier Restrictions

  • existential restrictions
  • universal restrictions

– Cardinality Restrictions – hasValue Restrictions

Jan Pettersen Nytun, UiA, Ontologies, page 45
slide-46
SLIDE 46

S O

P

New version of Protégé calls it “Subclass of”

slide-47
SLIDE 47

S O

P

Existential Restrictions

Jan Pettersen Nytun, UiA, Ontologies, page 47

A restriction containing an

  • wl:someValuesFrom constraint

describes a class of all individuals for which at least one value of the property concerned is an instance of the class description or a data value in the data range.

slide-48
SLIDE 48

S O

P

Jan Pettersen Nytun, UiA, Ontologies, page 48

Cardinality in dialog window should be ignored (it is 1..*)

slide-49
SLIDE 49

S O

P

In Turtle Representation

pizza:Pizza rdf:type owl:Class ; rdfs:label "Pizza"@en ; rdfs:subClassOf [ rdf:type owl:Restriction ;

  • wl:onProperty pizza:hasBase ;
  • wl:someValuesFrom pizza:PizzaBase

] ; …

Jan Pettersen Nytun, UiA, page 49

At least one pizza base!

slide-50
SLIDE 50

S O

P

Jan Pettersen Nytun, UiA, Ontologies, page 50
slide-51
SLIDE 51

pizza:Margherita rdf:type owl:Class ; rdfs:label "Margherita"@pt ; rdfs:subClassOf pizza:NamedPizza , [ rdf:type owl:Restriction ;

  • wl:onProperty pizza:hasTopping ;
  • wl:allValuesFrom [ rdf:type owl:Class ;
  • wl:unionOf ( pizza:MozzarellaTopping

pizza:TomatoTopping ) ] ] , … Only = owl:allValuesFrom

slide-52
SLIDE 52

S O

P

Jan Pettersen Nytun, UiA, Ontologies, page 52
slide-53
SLIDE 53

S O

P

Jan Pettersen Nytun, UiA, Ontologies, page 53

There is no “+” for adding; conditions comes from superclass!

slide-54
SLIDE 54

S O

P

Multiple Inheritance from Anonymous Classes

Jan Pettersen Nytun, UiA, Ontologies, page 54

:Pizza rdf:type owl:Class ; rdfs:subClassOf [ rdf:type owl:Restriction ;

  • wl:onProperty :hasTopping ;
  • wl:someValuesFrom :PizzaTopping

] , [ rdf:type owl:Restriction ;

  • wl:onProperty :hasBase ;
  • wl:someValuesFrom :PizzaBase

] .

slide-55
SLIDE 55

S O

P

Reasoner Finding Inconsistency

Jan Pettersen Nytun, UiA, Ontologies, page 55

The actual reason that ProbeInconsistentTopping has been detected to be inconsistent is because its superclasses VegetableTopping and CheeseTopping are disjoint from each

  • ther.
slide-56
SLIDE 56

S O

P

Difference Between subClassOf and equivalentClass

# Red wine is a subclass of all things that have a red color. :RedWine a owl:Class ; rdfs:subClassOf [ a owl:Restriction ;

  • wl:onProperty :color ;
  • wl:hasValue red^^<http://www.w3.org/2001/XMLSchema#string> ].

# The set of red things is exactly the same as the class of things that have the value # "red" for its color property . :RedThing a owl:Class ;

  • wl:equivalentClass

[ a owl:Restriction ;

  • wl:onProperty :color ;
  • wl:hasValue red^^<http://www.w3.org/2001/XMLSchema#string> ]
Jan Pettersen Nytun, UiA, Ontologies, page 56

Necessary Sufficient

slide-57
SLIDE 57

S O

P

Using Necessary AND Sufficient Conditions

Jan Pettersen Nytun, UiA, Ontologies, page 57
slide-58
SLIDE 58

S O

P

Jan Pettersen Nytun, UiA, Ontologies, page 58
slide-59
SLIDE 59

S O

P

Outline

  • Protégé example
  • RDFS
  • OWL
  • Some W3C documents concerning OWL 2
Jan Pettersen Nytun, UiA, Ontologies, page 59
slide-60
SLIDE 60

S O

P

OWL Some Documents From W3C

Where to start: OWL 2 Web Ontology Language Document Overview (Second Edition) (http://www.w3.org/TR/2012/REC-owl2-overview-20121211/)

60
slide-61
SLIDE 61

OWL 2 Syntaxes

[http://www.semantic-web-book.org/w/images/7/75/W2011-08-OWL-Syntax.pdf]:

slide-62
SLIDE 62

62

Name of Syntax Specification Status Purpose RDF/XML Mapping to RDF Graphs, RDF/XML Mandatory Interchange (can be written and read by all conformant OWL 2 software) OWL/XML XML Serialization Optional Easier to process using XML tools Functional Syntax Structural Specification Optional Easier to see the formal structure of

  • ntologies

Manchester Syntax Manchester Syntax Optional Easier to read/write DL Ontologies Turtle Mapping to RDF Graphs, Turtle Optional, Not from OWL-WG Easier to read/write RDF triples

Syntaxes [OWL 2 Web Ontology Language Document Overview ]:

slide-63
SLIDE 63

S O

P

Any OWL 2 ontology can also be viewed as an RDF graph ... The OWL 2 Quick Reference Guide

[http://www.w3.org/TR/2012/REC-owl2-quick-reference-20121211/]

provides a simple overview of these two views

  • f OWL 2, laid out side by side.
63
slide-64
SLIDE 64

S O

P

The OWL 2 Quick Reference Guide - Example

64

8.2.2 Universal Quantification A universal class expression ObjectAllValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE only to individuals that are instances of CE. Provided that OPE is simple according to the definition in Section 11, such a class expression can be seen as a syntactic shortcut for the class expression ObjectMaxCardinality( 0 OPE ObjectComplementOf( CE ) ).

ObjectAllValuesFrom := 'ObjectAllValuesFrom' '(' ObjectPropertyExpression ClassExpression ')'

slide-65
SLIDE 65

Example: Consider the ontology consisting of the following axioms. ObjectPropertyAssertion( a:hasPet a:Peter a:Brian ) Brian is a pet of Peter. ClassAssertion( a:Dog a:Brian ) Brian is a dog. ClassAssertion( ObjectMaxCardinality( 1 a:hasPet ) a:Peter ) Peter has at most one pet.

class assertion ClassAssertion(C a) a rdf:type C. Language Feature Functional Syntax RDF Syntax positive object property assertion ObjectPropertyAssertion( PN a1 a2 ) a1 PN a2. maximum cardinality ObjectMaxCardinality(n P) _:x rdf:type owl:Restriction. _:x owl:onProperty P. _:x owl:maxCardinality n.

The OWL 2 Quick Reference Guide – Example Continues…

slide-66
SLIDE 66

66

Semantics [OWL 2 Web Ontology Language Document Overview ]:

The OWL 2 Structural Specification document defines the abstract structure of OWL 2 ontologies, but it does not define their meaning. The Direct Semantics [OWL 2 Direct Semantics] and the RDF-Based Semantics [OWL 2 RDF-Based Semantics] provide two alternative ways of assigning meaning to OWL 2 ontologies, with a correspondence theorem providing a link between the two. These two semantics are used by reasoners and

  • ther tools, e.g., to answer class consistency,

subsumption and instance retrieval queries.

slide-67
SLIDE 67

67

Semantics [OWL 2 Web Ontology Language Document Overview ]:

The Direct Semantics assigns meaning directly to

  • ntology structures, resulting in a semantics

compatible with the model theoretic semantics of the SROIQ description logic—a fragment of first

  • rder logic with useful computational properties.

The advantage of this close connection is that the extensive description logic literature and implementation experience can be directly exploited by OWL 2 tools. ... Ontologies that satisfy these syntactic conditions are called OWL 2 DL ontologies.

slide-68
SLIDE 68

68

OWL 2 Web Ontology Language Direct Semantics

(http://www.w3.org/TR/owl2-direct-semantics/):

This document provides the direct model-theoretic semantics for OWL 2, which is compatible with the description logic SROIQ. Furthermore, this document defines the most common inference problems for OWL 2.

(Paper about SROIQ: The Even More Irresistible SROIQ. IanHorrocks and OliverKutz and UlrikeSattler , The University of Manchester , http://www.cs.man.ac.uk/~sattler/publications/KR-06-SROIQ.pdf )

slide-69
SLIDE 69

69

ObjectMaxCardinality( n OPE ) { x | #{ y | ( x , y ) ∈ (OPE)OP } ≤ n } (For S a set, #S denotes the number of elements in S.)

Sematic Description – Example

[OWL 2 Web Ontology Language Direct Semantics ]:

slide-70
SLIDE 70

70

The Manchester OWL Syntax

[http://webont.org/owled/2006/acceptedLong/submission_9.pdf] :

slide-71
SLIDE 71

71

The Manchester OWL Syntax Continues…

[http://webont.org/owled/2006/acceptedLong/submission_9.pdf] :

slide-72
SLIDE 72

S O

P

References

Jan Pettersen Nytun, UiA, Propositional Calculus, page 72

[1] Book: David Poole and Alan Mackworth, Artificial Intelligence: Foundations of Computational Agents, Cambridge University Press, 2010, http://artint.info/ [2] http://www.w3.org/TR/swbp-n-aryRelations/ [3] RDF 1.1 Primer, W3C Working Group Note, 24 June 2014 [4] A Practical Guide To Building OWL Ontologies Using Protégé 4 and CO-ODE Tools Edition 1.3, Matthew Horridge [5] http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/