1 owl: ontology web language pierluigi damadio a.a.2003/2004

35
1 OWL: Ontology Web Language Pierluigi D’Amadio a.a.2003/2004

Upload: bonifacio-russo

Post on 02-May-2015

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

1

OWL: Ontology Web Language

Pierluigi D’Amadioa.a.2003/2004

Page 2: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

2

Web Semantico: una visione?

Estensione del WWW: Macchine capaci di processare e di

“capire” il significato dei dati

Linguaggi proposti dal W3C

XML

RDF

RDF(S)

OWL

Syntax

Semantics

Page 3: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

3

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)

Page 4: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

4

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

Page 5: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

5

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/

Page 6: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

6

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)

La risorsa chesi vuole descrivere

[Soggetto]

Una proprietà dellarisorsa

[Predicato]

Il valore della proprietà

[Oggetto]

RiverBodyOfWate

r

emptiesInto

Page 7: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

7

RDF: Esempio

<?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>

RDF fornisce l’attributo ID per identificare la risorsa che viene descritta.

L’attributo ID vive nel namespace RDF.

L’identificatore "fragment” indica la fine del namespace.

1 2

3

Page 8: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

8

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

definire le istanze (non necessariamente ground) con la proprietà type

River BodyOfWateremptiesInto

domain range

Yangtzee Rivertype

Page 9: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

9

OWL: Sommario Origini di OWL Properties

Symmetric, Transitive, Functional, Inverse Functional range, domain, subPropertyOf, inverseOf,

equivalentProperty

Class SubClassOf, intersectionOf, unionOf, complementOf,

Enumeration, Equivalence, Disjoint

Statements sulle istanze ground sameIndividualAs,DIfferentFrom,AllDifferent

3 facce di Owl Lite,DL,Full

Page 10: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

10

Origini di OWL

DAML

DAML+OIL

DAML = DARPA Agent Markup LanguageOIL = Ontology Inference Layer

OIL

OWL

RDF

Tutti influenzati da RDF

Page 11: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

11

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)

Page 12: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

12

Gerarchia delle property classes

rdf:Property

owl:ObjectProperty owl:DatatypeProperty

owl:SymmetricProperty owl:TransitiveProperty

owl:FunctionalProperty

•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

owl:InverseFunctionalProperty

Page 13: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

13

OceanLake

BodyOfWater

River

Stream

Sea

NaturallyOccurringWaterSource

TributaryBrook

Rivulet

Esempio: la tassonomia delle sorgenti d’acqua

Page 14: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

14

Se un sorgente d’acqua A connectsTo una sorgente B, allora la sorgente B connectsTo A.

Symmetric Properties

NaturallyOccurringWaterSource Properties: connectsTo: NaturallyOccurringWaterSource

<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>

connectsToSymmetricProperty

type

Page 15: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

15

Se A è containedIn B, B è containedIn C allora A è containedIn C.

Sea Properties: containedIn: BodyOfWater

<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>

containedIn

TransitiveProperty

type

Transitive Properties

Page 16: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

16

RiverProperties: emptiesInto: BodyOfWater

Per ogni istanza c’è al più un valore per la property

emptiesIntoFunctionalP

ropertytype

<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>

Functional Properties

Page 17: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

17

BodyOfWaterRiver Properties: emptiesInto: BodyOfWater

Properties: feedsFrom: River

Se una proprietà P1 associa la Resource1 alla Resource2, allora la Inverse property associa la Resource2 alla Resource1

<owl:ObjectProperty rdf:ID="feedsFrom"> <owl:inverseOf rdf:resource="#emptiesInto"/> <rdfs:domain rdf:resource="#BodyOfWater"/> <rdfs:range rdf:resource="#River"/> </owl:ObjectProperty

feedsFromemptiesInt

oinverseOf

Inverse Properties

Page 18: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

18

BodyOfWaterRiver

Per un dato valore di range il dominio è unico

Properties: emptiesInto: BodyOfWater

Properties: feedsFrom: River

(functional)

<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>

Inverse Functional Properties

Page 19: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

19

Global vs Local

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.

River

Flueve

Properties: emptiesInto: BodyOfWater

Flueve: a RiveremptiesInto Sea

Page 20: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

20

Due forme di rdfs:subClassOf

<rdfs:subClassOf rdf:resource="#River"/>

Specifica la classe usando l’attributo rdf:resource.

1

<rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#emptiesInto"/> <owl:allValuesFrom rdf:resource="#Sea"/> </owl:Restriction></rdfs:subClassOf> Specifica la risorsa

usando owl:Restriction.Specifica chetutti i valori sonopresi da Sea

2

anonymousclass

Page 21: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

21

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)

Page 22: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

22

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>

<owl:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/></owl:Class>

RDFS OWLrdfs:Class

owl:Class

Page 23: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

23

Classi: Esempio

River

Flueve

Properties: emptiesInto: BodyOfWater

Flueve (French): “un fiume che sfocia nel mare".

RivìereRivìere (French): “un fiume che sfocia in un lago o in un altro fiume”.

Page 24: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

24

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>

Flueve

I membri di questa classe anonima sono istanze che hanno la proprietà emptiesInto in cui tutti i valori sono istanze di Sea.

River

Page 25: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

25

L’ereditarietà multipla

FlueveCi potrebbero essere dei Rivers che sfociano nel mare che non sonoFlueves

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="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>

River

Page 26: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

26

unionOfI membri di questa classe anonima sono istanze che hanno la proprietà emptiesInto in cui tutti i valori sono istanze di Sea.

I membri di questa classe anonima sono istanze che hanno la proprietà emptiesInto in cui tutti i valori sono istanze di River.

Rivìere

River

<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"/> <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></owl:Class>

Page 27: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

27

complementOf

NaturallyOccurringWaterSource

Intersezione delle WaterSource e il complementOf ManMadeWaterSource.

WaterSource

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>

Page 28: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

28

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

Page 29: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

29

equivalentClass

<owl:Class rdf:ID="BodyOfWater"> <rdfs:subClassOf

rdf:resource="#NaturallyOccurringWaterSource"/> <owl:equivalentClass

rdf:resource="http://www.other.org#LakeOceanSea"/></owl:Class>

OceanLake

LakeOceanSea

Sea

Vogliamo affermare che BodyOfWater è equivalente a LakeOceanSea.

Page 30: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

30

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.

Page 31: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

31

Sommario delle proprietà delle classi

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

Properties: onProperty: rdf:Property allValuesFrom: rdfs:Class hasValue: someValuesFrom: rdfs:Class cardinality: xsd:nonNegativeInteger minCardinality: xsd:nonNegativeInteger maxCardinality: xsd:nonNegativeInteger

rdfs:Class

owl:Class

owl:Restriction

Page 32: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

32

OWL statements

owl:sameIndividualAs Applicabile a due istanze Rinforza functionalProperty

owl:differentFrom Applicabile a due istanze Può portare a contraddizioni con

functionalProperty owl:AllDifferent

Applicabile a un set di istanze

Page 33: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

33

Le tre facce di OWL

Non tutti hanno bisogno di tutta l’espressività di OWL:

OWL Full

OWL DL

OWL Lite

Page 34: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

34

ConfrontiOWL Full OWL DL OWL Lite

Tutto quello che è stato presentato è disponibile nella versione Full. E’ inoltrepossibile miscelare ledescrizioni OWL conRDF(S).

Non è possibile usareowl:cardinality con TransitiveProperty.Non è possibile avere classimembro, ad esempio definiremetaclassi.

Non è possibile usare owl:minCardinalityo owl:maxCardinality.I soli valori consentiti sono perowl:cardinality sono 0 e 1.Non sono disponibili owl:hasValue,owl:disjointWith, owl:one of,owl:complementOf, owl:unionOf.

Page 35: 1 OWL: Ontology Web Language Pierluigi DAmadio a.a.2003/2004

35

• 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

OWL Resources