1
Knowledge Representation Part VII Protégé / RDFS / OWL / ++
Jan Pettersen Nytun, UiA
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
1
Knowledge Representation Part VII Protégé / RDFS / OWL / ++
Jan Pettersen Nytun, UiA
S O
P
S O
P
Jan Pettersen Nytun, UiA, page 3The Semantic Web Language Stack
Hierarchy of languages, where each layer exploits and uses capabilities of the layers below.
/ XML Schema
S O
P
Individuals
Jan Pettersen Nytun, UiA, page 4[4]
S O
P
Setting Default Namespace Explicitly
file when not explicitly stating the namespace.
Jan Pettersen Nytun, UiA, page 5Explicitly stating the default namespace
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
S O
P
Turle File Continues...
######################################################## # # Object Properties # ########################################################
:hasSibling rdf:type
:livesIn rdf:type
S O
P
Turle File Continues...
################################################################# # # Individuals # ################################################################# :England rdf:type owl:NamedIndividual ,
:Gemma rdf:type owl:NamedIndividual ,
:Matthew rdf:type
:livesIn :England ; :hasSibling :Gemma .
Jan Pettersen Nytun, UiA, page 8S O
P
Jan Pettersen Nytun, UiA, page 9S O
P
########################################################## # # Classes # ########################################################## :Country rdf:type owl:Class . :Person rdf:type
S O
P
# Individuals :England rdf:type :Country ,
:Gemma rdf:type :Person ,
:Matthew rdf:type :Person ,
:livesIn :England ; :hasSibling :Gemma .
Jan Pettersen Nytun, UiA, page 11S 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 12S O
P
Which Syntax Does Protégé Uses?
Jan Pettersen Nytun, UiA, Ontologies, page 13S O
P
Protégé Uses The Manchester OWL Syntax in Dialog Windows
Syntax] is an OWL syntax that is designed to be easier for non-logicians to read.
Jan Pettersen Nytun, UiA, Ontologies, page 14S 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 15Individual: 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>
S O
P
S O
P
Allows definition of (simple) ontologies. RDFS gives some fundamental concepts, e.g.:
S O
P
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 .
S O
P
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 .
S O
P
Property Domains and Ranges
individuals from the range (or to “data” if for instance type is String).
class Pizza (domain) to individuals belonging to the class of PizzaTopping (range).
ranges should not be viewed as only constraints to be
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, 22Given the 2 triples: :employer rdfs:domain :Person :employer rdfs:range :Organization Then triple: :John :employer :CompanyX Requires that:
From Wikipedia, the free encyclopedia
S O
P
Multiple Classes As The Range For A Property
This is interpreted as the intersection of the
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 , 23S O
P
Jan Pettersen Nytun, UiA, page 24Did not work for me!
S O
P
This Seems to Work Fine!
somePizza and someTopping are individuals stated to be of type Thing
Jan Pettersen Nytun, UiA, page 25S O
P
[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, 26S O
P
S O
P
OWL extends the possibilities found in RDFS, e.g.:
S O
P
Part Of OWL Metamodel [5]
Jan Pettersen Nytun, UiA, Ontologies, page 29S O
P
Unique Name Assumption (UNA) in Logic
entities in the world.
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 30S O
P
an individual may be of several classes.
classes are disjoint.
Knowledge Representation Part III, JPN, UiA
Jan Pettersen Nytun, UiA , 31S O
P
OWL Property types
types of properties:
– Object properties. – Datatype properties.
Annotation properties can be used to add metadata (data about data).
Knowledge Representation Part II, JPN, UiA
32S O
P
Property Characteristics
OWL allows the meaning of properties to be enriched through the use of property
Knowledge Representation Part III, JPN, UiA
33S O
P
Inverse Property
then its inverse property will link individual B to individual A.
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
34S O
P
Functional Properties
literal to a subject.
Knowledge Representation Part III, JPN, UiA
35E.g., it is only possible to have one birth mother
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
36Person Female
hasBirthMother isBirthMotherTo 0..1 *
S O
P
Inverse Functional Properties
that the inverse property is functional.
Knowledge Representation Part III, JPN, UiA
37S O
P
Functional / Inverse Functional Properties
JPN, UiA
38Person Female
hasBirthMother isBirthMotherTo 0..1 *
Inverse Functional Property Functional Property
Inverse functional properties are similar, but in the reverse direction.
S O
P
Functional / Inverse Functional Properties continues …
"functional“ but not “functional inverse”.
datatypeproperty-objectproperty-functionalpro]:
39we 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.
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
40S 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
41S 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
42S 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
43S 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 parentOfS O
P
OWL Restrictions
– Quantifier Restrictions
– Cardinality Restrictions – hasValue Restrictions
Jan Pettersen Nytun, UiA, Ontologies, page 45S O
P
New version of Protégé calls it “Subclass of”
S O
P
Existential Restrictions
Jan Pettersen Nytun, UiA, Ontologies, page 47A restriction containing an
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.
S O
P
Jan Pettersen Nytun, UiA, Ontologies, page 48Cardinality in dialog window should be ignored (it is 1..*)
S O
P
In Turtle Representation
pizza:Pizza rdf:type owl:Class ; rdfs:label "Pizza"@en ; rdfs:subClassOf [ rdf:type owl:Restriction ;
] ; …
Jan Pettersen Nytun, UiA, page 49At least one pizza base!
S O
P
Jan Pettersen Nytun, UiA, Ontologies, page 50pizza:Margherita rdf:type owl:Class ; rdfs:label "Margherita"@pt ; rdfs:subClassOf pizza:NamedPizza , [ rdf:type owl:Restriction ;
pizza:TomatoTopping ) ] ] , … Only = owl:allValuesFrom
S O
P
Jan Pettersen Nytun, UiA, Ontologies, page 52S O
P
Jan Pettersen Nytun, UiA, Ontologies, page 53There is no “+” for adding; conditions comes from superclass!
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 ;
] , [ rdf:type owl:Restriction ;
] .
S O
P
Reasoner Finding Inconsistency
Jan Pettersen Nytun, UiA, Ontologies, page 55The actual reason that ProbeInconsistentTopping has been detected to be inconsistent is because its superclasses VegetableTopping and CheeseTopping are disjoint from each
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 ;
# 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 ;
[ a owl:Restriction ;
Necessary Sufficient
S O
P
Using Necessary AND Sufficient Conditions
Jan Pettersen Nytun, UiA, Ontologies, page 57S O
P
Jan Pettersen Nytun, UiA, Ontologies, page 58S O
P
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/)
60OWL 2 Syntaxes
[http://www.semantic-web-book.org/w/images/7/75/W2011-08-OWL-Syntax.pdf]:
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
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 ]:
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
S O
P
The OWL 2 Quick Reference Guide - Example
648.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 ')'
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…
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
subsumption and instance retrieval queries.
67
Semantics [OWL 2 Web Ontology Language Document Overview ]:
The Direct Semantics assigns meaning directly to
compatible with the model theoretic semantics of the SROIQ description logic—a fragment of first
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.
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 )
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 ]:
70
The Manchester OWL Syntax
[http://webont.org/owled/2006/acceptedLong/submission_9.pdf] :
71
The Manchester OWL Syntax Continues…
[http://webont.org/owled/2006/acceptedLong/submission_9.pdf] :
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/