370 likes | 487 Views
Modulo3 Linguaggi: OWL. UNIVERSITA’ DI CAMERINO Corso di laurea in Informatica (classe 23/S) Barbara Re barbara.re @unicam.it. Anno Accademico 2007-08. Agenda. Introduzione a OWL Classi OWL Proprietà OWL. Linguaggi.
E N D
Modulo3 Linguaggi: OWL UNIVERSITA’ DI CAMERINO Corso di laurea in Informatica (classe 23/S) Barbara Re barbara.re@unicam.it Anno Accademico 2007-08
Agenda • Introduzione a OWL • Classi OWL • Proprietà OWL
Linguaggi • I linguaggi forniscono meccanismi base che possono essere usati per rappresentare la semantica delle informazioni necessarie per il Semantic Web • XML • RDF • RDF(S) • OWL • OWL 1.1 OWL ANNOTAZIONE INTEGRAZIONE INFERENZA RDF(S) RDF XML
DAML OIL RDF Tutti influenzati da RDF DAML = DARPA Agent Markup Language OIL = Ontology Inference Layer DAML+OIL OWL Origini di OWL
OWL – principi fondamentali • OWL aggiunge ulteriori vocaboli per descrivere proprietà e classi • Relazioni tra classi (es. disjointness) • Cardinalità (es. "exactly one") • Uguaglianza • Tipi di proprietà più ricchi • Caratteristiche delle proprietà (es. symmetry) • Elencazione delle classi
OWL Full OWL DL OWL Lite Le tre facce di OWL • Non tutti hanno bisogno di tutta l’espressività di OWL
OWL Sottolinguaggi • OWL Little supporta gli utenti per necessità di classificazione e gerarchia attraverso vincoli semplici • Attraverso semplici PATH è possibile migrare da thesauri e tassonomie a OWL Little • E’ possibile esprimere 0 e 1 come valori di cardinalità • OWL DL supporta gli utente che vogliono massima espressività mentre conservano completezza (tutte le conclusioni sono garantite essere computabili) e decidibilità (tutte le computazioni finiscono in un tempo finito) computazionale • Sono definite corrispondenze specifiche con la description logics – campo di ricerca che ha studiato la formulazione formale di OWL • OWL Full è inteso per gli utenti che vogliono massima espressività e al tempo stesso la libertà sintattica di RDF senza garanzie computazionali • Non tutti i reasoning sono in grado di processare l’espressività di OWL Full
Relazioni tra l’espressività • Un’ontologia valida in OWL Lite è un’ontologia legale in OWL DL • Un’ontologia valida in OWL DL è un’ontologia legale in OWL Full • Ogni conclusione valida in OWL Lite è una conclusione valida anche in OWL DL • Ogni conclusione valida in OWL DL è una conclusione valida anche in OWL Full
OWL namespace The built-in vocabulary for OWL all comes from the OWL namespace http://www.w3.org/2002/07/owl#
OWL Classes • Le classi forniscono un meccanismo astratto per raggruppare risorse con simili caratteristiche • Ogni classe è implicitamente sottoclassse di owl:Think • Class description • Semplici riferimenti alle classi • Class axioms • Introduce ulteriori componenti che sono necessari o sufficienti per caratterizzare la classe
Tipi di class description • OWL distinguishes six types of class descriptions: • a class identifier (a URI reference) • Descrive la classe introducendo un nome • an exhaustive enumeration of individuals that together form the instances of a class • a property restriction • the intersection of two or more class descriptions • the union of two or more class descriptions • the complement of a class description • Descrivono la classe introducendo vincoli sulla sua estenzione
Class identifier <owl:Class rdf:ID="Human"/> • owl:Class è una sottoclasse di rdfs:Class • "ex:Human rdf:type owl:Class ." è la tripla che esprime
Class enumerate <owl:Class> <owl:oneOf rdf:parseType="Collection"> <owl:Thing rdf:about="#Eurasia"/> <owl:Thing rdf:about="#Africa"/> <owl:Thing rdf:about="#NorthAmerica"/> <owl:Thing rdf:about="#SouthAmerica"/> <owl:Thing rdf:about="#Australia"/> <owl:Thing rdf:about="#Antarctica"/> </owl:oneOf> </owl:Class> • Fa riferimento ad una classe che contiene esattamente gli individui elencati • La classe "enumeration" è definita utilizzando la proprietà owl:oneOf. • I valori associati alla classe deve essere una lista di individui che sono istanze della classe • Questo permette alla classe di descrivere attraverso una enumerazione esaustiva le sue istanze.
Property restriction • Classe di individui che soddisfano una particolare restrizione sulla proprietà • Una restrizione di proprietà è un tipo speciale di descrittore di classe, una classe anonima di tutti gli individui che soddisfano la restrizione <owl:Restriction> <owl:onProperty rdf:resource="(some property)" /> (precisely one value or cardinality constraint, see below) </owl:Restriction> • OWL distingue due tipi di restrizioni • Vincoli sul valore che introduce vincoli sulle proprietà quando vengono applicate a particolari descrittori di classe • Si può far riferimento a quei individui il cui valore della proprietà adjacentTo dovrebbero essere alcune Regioni, ed usare questa come una classe assioma per la regione stessa • ATT: è differente da rdfs:range che deve esse applicata a tutte le situazioni in cui la proprietà è usata • Un vincolo di cardinalità introduce vincoli sul numero di valori che la proprietà può assumere nel contesto di una particolare descrizione di una classe • Si può introdurre una relazione hasPlayer per una squadra di calcio ed una squadra di baseball • Intersection, union and complement Può essere riferito sia a datatype property che a object property
Value Constraints • owl:allValuesFrom <owl:Restriction> <owl:onProperty rdf:resource="#hasParent" /> <owl:allValuesFrom rdf:resource="#Human" /> </owl:Restriction> • Owl:someValuesFrom <owl:Restriction> <owl:onProperty rdf:resource="#hasParent" /> <owl:someValuesFrom rdf:resource="#Physician" /> </owl:Restriction> • Owl:hasValue <owl:Restriction> <owl:onProperty rdf:resource="#hasParent" /> <owl:hasValue rdf:resource="#Clinton" /> </owl:Restriction>
<owl:Class rdf:ID="Wine"> <rdfs:subClassOf rdf:resource="&food;PotableLiquid" /> ... <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasMaker" /> <owl:allValuesFrom rdf:resource="#Winery" /> </owl:Restriction> </rdfs:subClassOf> ...</owl:Class> <owl:Class rdf:ID="Wine"> <rdfs:subClassOf rdf:resource="&food;PotableLiquid" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasMaker" /> <owl:someValuesFrom rdf:resource="#Winery" /> </owl:Restriction> </rdfs:subClassOf> ... </owl:Class> Wine and Winery
Cardinality constraints • owl:maxCardinality <owl:Restriction> <owl:onProperty rdf:resource="#hasParent" /> <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">2</owl:maxCardinality> </owl:Restriction> • owl:minCardinality <owl:Restriction> <owl:onProperty rdf:resource="#hasParent" /> <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">2</owl:minCardinality> </owl:Restriction>
Intersection Descrive la classe la cui estensione vincola precisamente gli individui che sono membri dell’estensione di tutte le classi introdotte nella lista <owl:Class rdf:ID="WhiteWine"> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Wine" /> <owl:Restriction> <owl:onProperty rdf:resource="#hasColor" /> <owl:hasValue rdf:resource="#White" /> </owl:Restriction> </owl:intersectionOf> </owl:Class>
union Descrive la classe la cui estensione vincola precisamente gli individui che sono membri dell’estensione di almeno una delle classi introdotte nella lista <owl:Class rdf:ID="Fruit"> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="#SweetFruit" /> <owl:Class rdf:about="#NonSweetFruit" /> </owl:unionOf> </owl:Class>
Complement • Descrive la classe la cui estensione vincola precisamente gli individui che non sono membri delle classi introdotte nella lista • The expression "not meat" could be written as <owl:Class> <owl:complementOf> <owl:Class rdf:about="#Meat"/> </owl:complementOf> </owl:Class> <owl:Class rdf:ID="ConsumableThing" /> <owl:Class rdf:ID="NonConsumableThing"> <owl:complementOf rdf:resource="#ConsumableThing" /> </owl:Class>
Class axioms • OWL contiene tre costrutti del linguaggio per combinare la class descriptions in class axioms • Fa riferimento ad elementi addizionali che sono necessari e/o sufficienti per descrivere la classe • rdfs:subClassOf allows one to say that the class extension of a class description is a subset of the class extension of another class description <owl:Class rdf:ID="Opera"> <rdfs:subClassOf rdf:resource="#MusicalWork" /> </owl:Class> • owl:equivalentClass allows one to say that a class description has exactly the same class extension as another class description. <owl:Class rdf:about="#US_President"> <owl:equivalentClass rdf:resource="#PrincipalResidentOfWhiteHouse"/> </owl:Class> • owl:disjointWith allows one to say that the class extension of a class description has no members in common with the class extension of another class description <owl:Class rdf:about="#Man"> <owl:disjointWith rdf:resource="#Woman"/> </owl:Class>
Properties • OWL distinguishes between two main categories of properties that an ontology builder may want to define • Object properties link individuals to individuals • Datatype properties link individuals to data values • <owl:ObjectProperty rdf:ID="hasParent"/> • Property axioms define additional characteristics of properties OWL supports the following constructs for property axioms • RDF Schema constructs: rdfs:subPropertyOf, rdfs:domain and rdfs:range • relations to other properties: owl:equivalentProperty and owl:inverseOf • global cardinality constraints: owl:FunctionalProperty and owl:InverseFunctionalProperty • logical property characteristics: owl:SymmetricProperty and owl:TransitiveProperty
RDF Schema constructs • rdfs:subPropertyOf axiom defines that the property is a subproperty of some other property • Formally this means that if P1 is a subproperty of P2, then the property extension of P1 (a set of pairs) should be a subset of the property extension of P2 (also a set of pairs) • rdfs:domain is a built-in property that links a property (some instance of the class rdf:Property) to a class description • An rdfs:domain axiom asserts that the subjects of such property statements must belong to the class extension of the indicated class description • rdfs:range is a built-in property that links a property (some instance of the class rdf:Property) to to either a class description or a data range • An rdfs:range axiom asserts that the values of this property must belong to the class extension of the class description or to data values in the specified data range.
subPropertyOf - esempio <owl:ObjectProperty rdf:ID="hasMother"> <rdfs:subPropertyOf rdf:resource="#hasParent"/> </owl:ObjectProperty>
rdfs:domain - esempio <owl:ObjectProperty rdf:ID="hasBankAccount"> <rdfs:domain> <owl:Class> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Person"/> <owl:Class rdf:about="#Corporation"/> </owl:unionOf> </owl:Class> </rdfs:domain> </owl:ObjectProperty>
Relations to other properties • owl:equivalentProperty construct can be used to state that two properties have the same property extension • owl:inverseOf construct can be used to define such an inverse relation between properties <owl:ObjectProperty rdf:ID="hasChild"> <owl:inverseOf rdf:resource="#hasParent"/> </owl:ObjectProperty>
Global cardinality constraints • A functional property is a property that can have only one (unique) value y for each instance x • There cannot be two distinct values y1 and y2 such that the pairs (x,y1) and (x,y2) are both instances of this property <owl:ObjectProperty rdf:ID="husband"> <rdf:type rdf:resource="&owl;FunctionalProperty" /> <rdfs:domain rdf:resource="#Woman" /> <rdfs:range rdf:resource="#Man" /> </owl:ObjectProperty> • If a property is declared to be inverse-functional, then the object of a property statement uniquely determines the subject (some individual) • If we state that P is an owl:InverseFunctionalProperty, then this asserts that a value y can only be the value of P for a single instance x • There cannot be two distinct instances x1 and x2 such that both pairs (x1,y) and (x2,y) are instances of P. <owl:InverseFunctionalProperty rdf:ID="biologicalMotherOf"> <rdfs:domain rdf:resource="#Woman"/> <rdfs:range rdf:resource="#Human"/> </owl:InverseFunctionalProperty>
Logical property characteristics • owl:TransitiveProperty • When one defines a property P to be a transitive property, this means that if a pair (x,y) is an instance of P, and the pair (y,z) is also instance of P, then we can infer the the pair (x,z) is also an instance of P <owl:ObjectProperty rdf:ID="subRegionOf"> <rdf:type rdf:resource="&owl;TransitiveProperty"/> <rdfs:domain rdf:resource="#Region"/> <rdfs:range rdf:resource="#Region"/> </owl:ObjectProperty> • owl:symmentricalProperty • A symmetric property is a property for which holds that if the pair (x,y) is an instance of P, then the pair (y,x) is also an instance of P <owl:SymmetricProperty rdf:ID="friendOf"> <rdfs:domain rdf:resource="#Human"/> <rdfs:range rdf:resource="#Human"/> </owl:SymmetricProperty>
Individual • Individuals are defined with individual axioms (also called "facts") • We discuss two types of facts • Facts about class membership and property values of individuals • Facts about individual identity • OWL provides three constructs for stating facts about the identity of individuals • owl:sameAs is used to state that two URI references refer to the same individual • owl:differentFrom is used to state that two URI references refer to different individuals • owl:AllDifferent provides an idiom for stating that a list of individuals are all different
Individual istanziazione • Facts about class membership and property values of individuals <Opera rdf:ID="Tosca"> <hasComposer rdf:resource="#Giacomo_Puccini"/> <hasLibrettist rdf:resource="#Victorien_Sardou"/> <hasLibrettist rdf:resource="#Giuseppe_Giacosa"/> <hasLibrettist rdf:resource="#Luigi_Illica"/> <premiereDate rdf:datatype="&xsd;date">1900-01-14</premiereDate> <premierePlace rdf:resource="#Roma"/> <numberOfActs rdf:datatype="&xsd;positiveInteger">3</numberOfActs> </Opera>
Owl:sameAs - esempio <rdf:Description rdf:about="#William_Jefferson_Clinton"> <owl:sameAs rdf:resource="#BillClinton"/> </rdf:Description>
owl:AllDifferent - esempio <owl:AllDifferent> <owl:distinctMembers rdf:parseType="Collection"> <Opera rdf:about="#Don_Giovanni"/> <Opera rdf:about="#Nozze_di_Figaro"/> <Opera rdf:about="#Cosi_fan_tutte"/> <Opera rdf:about="#Tosca"/> <Opera rdf:about="#Turandot"/> <Opera rdf:about="#Salome"/> </owl:distinctMembers> </owl:AllDifferent>
owl:differentFrom - esempio <Opera rdf:ID="Don_Giovanni"/> <Opera rdf:ID="Nozze_di_Figaro"> <owl:differentFrom rdf:resource="#Don_Giovanni"/> </Opera> <Opera rdf:ID="Cosi_fan_tutte"> <owl:differentFrom rdf:resource="#Don_Giovanni"/> <owl:differentFrom rdf:resource="#Nozze_di_Figaro"/> </Opera>
Datatype • Focusing on the notion of a data range for specifying a range of data values • OWL allows three types of data range specifications • A RDF datatype specification • The RDFS class rdfs:Literal • An enumerated datatype, using the owl:oneOf construct (permette di mettere in alternativa i datatype RDF)
Per approfondimenti OWL Web Ontology Language Reference W3C Recommendation 10 February 2004 http://www.w3.org/TR/2004/REC-owl-ref-20040210/
OWL 1.1 • OWL 1.1 extends the W3C OWL Web Ontology Language with a small but useful set of features that have been requested by users, for which effective reasoning algorithms are now available, and that OWL tool developers are willing to support • The new features include • extra syntactic sugar • additional property and qualified cardinality constructors • extended datatype support • simple metamodelling • extended annotations OWL 1.1 Web Ontology LanguageStructural Specification and Functional-Style Syntax Editor's Draft of 23 May 2007 This version: http://www.webont.com/owl/1.1/owl_specification.html