OWL: Ontology Web Language

Download Report

Transcript OWL: Ontology Web Language

OWL:
Ontology Web Language
Pierluigi D’Amadio
a.a.2003/2004
1
Web Semantico: una visione?


Estensione del WWW:
 Macchine capaci di processare e di
“capire” il significato dei dati
Linguaggi proposti dal W3C
OWL
RDF(S)
Semantics
RDF
XML
Syntax
2
Ontologie: definizioni a confronto
•
•
•
•
•
“a systematic explanation of being” (Philosophy)
“… defines the basic terms and relations including
the vocabulary of a topic area as well as the rules
for combining terms and relations to define
extensions to the vocabulary.” (Neches)
“… an explicit specification of a
conceptualization.” (Gruber)
“An ontology is a formal and explicit specification
of a shared conceptualization.” (Borst)
“… a logical theory which gives an explicit, partial
account of a conceptualization.” (Guarino)
3
XML
• Vantaggi:
• estendibilità del linguaggio: ciascuno ha la
possibilità di scrivere un proprio schema
• fornisce uno standard per rappresentare le
informazioni tramite alberi etichettati
• Svantaggi:
• La semantica non è specificata formalmente
4
RDF versus XML
• In XML è importante l’ordine con cui sono fatte le
asserzioni, in RDF no.
• La semantica in RDF è specificata formalmente, in XML
è immersa nelle etichette che si associano ai tag e
nella sintassi del DTD.
La specifica formale di RDF è raggiungibile a:
http://www.w3.org/TR/REC-rdf-syntax/
5
RDF: Modello
• Soggetto: La risorsa che si vuole descrivere
• Predicato: Una proprietà della risorsa
• Oggetto: Il valore della proprietà
Una combinazione dei precedenti elementi è detta
statement (o regola)
emptiesInto
River
La risorsa che
si vuole descrivere
[Soggetto]
BodyOfWater
Una proprietà della
risorsa
[Predicato]
Il valore della proprietà
[Oggetto]
6
RDF: Esempio
RDF fornisce l’attributo ID per identificare la risorsa che viene descritta.
1
2 L’attributo ID vive nel namespace RDF.
<?xml version="1.0"?>
<River rdf:ID="Yangtze"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.geodesy.org/river#">
<length>6300 kilometers</length>
<startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
</River>
3 L’identificatore "fragment” indica la fine del
namespace.
7
RDF Schema

RDF Schema fornisce nozioni di modellazione per:
 esprimere classi (Class) e le interrelazioni tra
classi (subClassOf).
 definire proprietà (Property,subPropertyOf) e
associarle alle classi.
 domain, range
River
emptiesInto
range
domain

BodyOfWater
definire le istanze (non necessariamente ground)
con la proprietà type
Yangtzee
type
River
8
OWL: Sommario


Origini di OWL
Properties



Class


SubClassOf, intersectionOf, unionOf, complementOf,
Enumeration, Equivalence, Disjoint
Statements sulle istanze ground


Symmetric, Transitive, Functional, Inverse Functional
range, domain, subPropertyOf, inverseOf, equivalentProperty
sameIndividualAs,DIfferentFrom,AllDifferent
3 facce di Owl

Lite,DL,Full
9
Origini di OWL
DAML
OIL
RDF
Tutti influenzati da RDF
DAML = DARPA Agent Markup Language
OIL = Ontology Inference Layer
DAML+OIL
OWL
10
Definire Property in OWL


OWL usa rdfs:range, rdfs:domain, e
rdfs:subPropertyOf.
OWL introduce due classi di Property:
 owl:ObjectProperty è la classe di proprietà
che hanno come valore un oggetto istanza di
una classe (Resource2Resource)
 owl:DatatypeProperty è la classe di
proprietà che hanno come valore un dato di
tipo semplice o strutturato (rdfs:Literal o
XML Schema built-in datatype)
11
Gerarchia delle property classes
rdf:Property
owl:ObjectProperty
owl:SymmetricProperty
owl:DatatypeProperty owl:FunctionalProperty
owl:InverseFunctionalProperty
owl:TransitiveProperty
•FunctionalProperty e InverseFunctionalProperty possono essere usate per associare
Resources a Resources, oppure Resources a un RDF Schema Literal o a un XML(S) datatype.
•InverseProperty è una proprietà di ObjectProperty
12
Esempio:
la tassonomia delle sorgenti d’acqua
NaturallyOccurringWaterSource
BodyOfWater
Stream
Brook
River
Tributary
Lake
Ocean
Sea
Rivulet
13
Symmetric Properties
Se un sorgente d’acqua A connectsTo una sorgente B,
allora la sorgente B connectsTo A.
NaturallyOccurringWaterSource
connectsTo
type
Properties:
connectsTo: NaturallyOccurringWaterSource
SymmetricProperty
<owl:ObjectProperty rdf:ID="connectsTo">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#SymmetricProperty"/>
<rdfs:domain rdf:resource="#NaturallyOccurringWaterSource"/>
<rdfs:range rdf:resource="#NaturallyOccurringWaterSource"/>
</owl:ObjectProperty>
14
Transitive Properties
Se A è containedIn B, B è containedIn C allora A è
containedIn C.
Sea
Properties:
containedIn: BodyOfWater
containedIn
type
TransitiveProperty
<owl:ObjectProperty rdf:ID=“containedIn">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
<rdfs:domain rdf:resource="#Sea"/>
<rdfs:range rdf:resource="#BodyOfWater"/>
</owl:ObjectProperty>
15
Functional Properties
Per ogni istanza c’è al più un valore per la property
River
emptiesInto
Properties:
emptiesInto: BodyOfWater
type
FunctionalProperty
<owl:ObjectProperty rdf:ID=“containedIn">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
<rdfs:domain rdf:resource="#Sea"/>
<rdfs:range rdf:resource="#BodyOfWater"/>
</owl:ObjectProperty>
16
Inverse Properties
Se una proprietà P1 associa la Resource1 alla Resource2,
allora la Inverse property associa la Resource2 alla Resource1
River
Properties:
emptiesInto: BodyOfWater
feedsFrom
inverseOf
BodyOfWater
Properties:
feedsFrom: River
emptiesInto
<owl:ObjectProperty rdf:ID="feedsFrom">
<owl:inverseOf rdf:resource="#emptiesInto"/>
<rdfs:domain rdf:resource="#BodyOfWater"/>
<rdfs:range rdf:resource="#River"/>
</owl:ObjectProperty
17
Inverse Functional Properties
Per un dato valore di range il dominio è unico
River
Properties:
emptiesInto: BodyOfWater
(functional)
BodyOfWater
Properties:
feedsFrom: River
<owl:ObjectProperty rdf:ID="feedsFrom">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/>
<owl:inverseOf rdf:resource="#emptiesInto"/>
<rdfs:domain rdf:resource="#BodyOfWater"/>
<rdfs:range rdf:resource="#River"/>
</owl:ObjectProperty>
18
Global vs Local
River
Properties:
emptiesInto: BodyOfWater
Flueve: a River
emptiesInto Sea
Flueve


rdfs:range stabilisce una global restriction
su emptiesInto, ossia, rdfs:range value si
applica a River e a tutte le sottoclassi di River.
Nel contesto di Flueve, vogliamo restringere il
range della property emptiesInto alla sola
classe Sea, ossia vogliamo una local
restriction of emptiesInto.
19
Due forme di rdfs:subClassOf
1
<rdfs:subClassOf rdf:resource="#River"/>
Specifica la classe usando l’attributo rdf:resource.
2
anonymous
class
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#emptiesInto"/>
<owl:allValuesFrom rdf:resource="#Sea"/>
</owl:Restriction>
</rdfs:subClassOf>
Specifica che
tutti i valori sono
presi da Sea
Specifica la risorsa
usando owl:Restriction.
20
Restrizioni




Tutti i valori devono appartenere ad una data
classe (allValuesFrom).
Al più un valore deve appartenere ad una certa
classe (someValuesFrom).
La restrizione prescrive un valore specifico
(hasValue).
La restrizione impone un vincolo sulla cardinalità
delle occorrenze dell’attributo
(cardinality,mincardinality,maxcardinality)
21
Definire Classi in OWL

Le classi di OWL sono molto più espressive
delle classi di RDF Schema classes.
<rdfs:Class rdf:ID="River">
<rdfs:subClassOf rdf:resource="#Stream"/>
</rdfs:Class>
RDFS
<owl:Class rdf:ID="River">
<rdfs:subClassOf rdf:resource="#Stream"/>
</owl:Class>
rdfs:Class
OWL
owl:Class
22
Classi: Esempio
River
Properties:
emptiesInto: BodyOfWater
Flueve
Rivìere
Flueve (French): “un fiume che sfocia nel
mare".
Rivìere (French): “un fiume che sfocia in un lago o
in un altro fiume”.
23
intersectionOf
<owl:Class rdf:ID="Flueve">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#River"/>
<owl:Restriction>
<owl:onProperty rdf:resource="#emptiesInto"/>
<owl:allValuesFrom rdf:resource="#Sea"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
I membri di questa classe anonima
sono istanze che hanno la proprietà
emptiesInto in cui tutti i valori sono
istanze di Sea.
River
Flueve
24
L’ereditarietà multipla
<owl:Class rdf:ID="Flueve">
<rdfs:subClassOf rdf:resource="#River"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#emptiesInto"/>
<owl:allValuesFrom rdf:resource="#Sea"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
I membri di questa classe
anonima sono istanze che
hanno la proprietà
emptiesInto in cui tutti i
valori sono istanze di Sea.
River
Flueve
Ci potrebbero essere dei Rivers che sfociano nel mare che non sono
Flueves
25
unionOf
River
I membri di questa classe
anonima sono istanze che
hanno la proprietà
emptiesInto in cui tutti i
valori sono istanze di River.
I membri di questa classe anonima sono
istanze che hanno la proprietà emptiesInto in
cui tutti i valori sono istanze di Sea.
<owl:Class rdf:ID="Rivìere">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#River"/>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty rdf:resource="#emptiesInto"/>
Rivìere
<owl:allValuesFrom rdf:resource="#Sea"/>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource="#emptiesInto"/>
<owl:allValuesFrom rdf:resource="#River"/>
</owl:Restriction>
</owl:unionOf>
</owl:Class>
</owl:intersectionOf>
26
</owl:Class>
complementOf
WaterSource
ManMadeWaterSource
NaturallyOccurringWaterSource
Intersezione delle WaterSource
e il complementOf ManMadeWaterSource.
<owl:Class rdf:ID="NaturallyOccurringWaterSource">
<owl:intersectionOf
rdf:parseType="Collection">
<owl:Class rdf:about="#WaterSource"/>
<owl:Class>
<owl:complementOf
rdf:resource="#ManMadeWaterSource"/>
</owl:Class>
</owl:intersectionOf>
</owl:Class>
27
oneOf: enumerare le istanze di una
classe
<owl:Class rdf:ID="Kyoto-Protected-River">
<rdfs:subClassOf rdf:resource="#River"/>
<owl:oneOf rdf:parseType="Collection">
<geo:River
rdf:about="http://www.china.org/geography/rivers#Yangtze"/>
<geo:River rdf:about="http://www.us.org/rivers#Mississippi"/>
<geo:River rdf:about="http://www.africa.org/rivers#Nile"/>
<geo:River rdf:about="http://www.s-america.org/rivers#Amazon"/>
…
</owl:oneOf>
</owl:Class>
Qui enumeriamo i fiumi che sono protetti dal Trattato di Kyoto
28
equivalentClass
LakeOceanSea
Lake
Ocean
Sea
Vogliamo affermare che BodyOfWater è equivalente a LakeOceanSea.
<owl:Class rdf:ID="BodyOfWater">
<rdfs:subClassOf
rdf:resource="#NaturallyOccurringWaterSource"/>
<owl:equivalentClass
rdf:resource="http://www.other.org#LakeOceanSea"/>
</owl:Class>
29
disjointWith
<owl:Class rdf:ID="River">
<rdfs:subClassOf rdf:resource="#Stream"/>
<owl:disjointWith rdf:resource="#Brook"/>
<owl:disjointWith rdf:resource="#Rivulet"/>
<owl:disjointWith rdf:resource="#Tributary"/>
</owl:Class>
• In questa definizione di River, un’istanza di River non può
essere un’istanza di Brook, Rivulet o Tributary.
• La proprietà disjointWith è una proprietà simmetrica.
30
Sommario delle proprietà delle classi
rdfs:Class
owl:Class
Properties:
onProperty: rdf:Property
allValuesFrom: rdfs:Class
hasValue:
owl:Restriction
someValuesFrom: rdfs:Class
cardinality: xsd:nonNegativeInteger
minCardinality: xsd:nonNegativeInteger
maxCardinality: xsd:nonNegativeInteger
Properties:
subClassOf: rdfs:Class
domain: rdfs:Class
range: rdfs:Class
Properties:
intersectionOf: rdf:List
unionOf: rdf:List
complementOf: owl:Class
oneOf: rdf:List
equivalentClass: owl:Class
disjointWith: owl:Class
31
OWL statements

owl:sameIndividualAs



owl:differentFrom



Applicabile a due istanze
Rinforza functionalProperty
Applicabile a due istanze
Può portare a contraddizioni con
functionalProperty
owl:AllDifferent

Applicabile a un set di istanze
32
Le tre facce di OWL

Non tutti hanno bisogno di tutta l’espressività
di OWL:
OWL Full
OWL DL
OWL Lite
33
Confronti
OWL Full
Tutto quello che è
stato presentato è
disponibile nella
versione Full. E’ inoltre
possibile miscelare le
descrizioni OWL con
RDF(S).
OWL DL
Non è possibile usare
owl:cardinality con
TransitiveProperty.
Non è possibile avere classi
membro, ad esempio definire
metaclassi.
OWL Lite
Non è possibile usare owl:minCardinality
o owl:maxCardinality.
I soli valori consentiti sono per
owl:cardinality sono 0 e 1.
Non sono disponibili owl:hasValue,
owl:disjointWith, owl:one of,
owl:complementOf, owl:unionOf.
34
OWL Resources
• OWL Guide fornisce una buona descrizione di
OWL con molti esempi:
– http://www.w3.org/TR/owl-guide/
• OWL Reference è una guida completa e
dettagliata:
– http://www.w3.org/TR/owl-ref/
• Per tutti gli altri documenti OWL, e
informazioni su Semantic Web:
– http://www.w3.org/2001/sw
35