Einführung in RDF Das RDF
Transcrição
Einführung in RDF Das RDF
Einführung in RDF z RDF (Resource Description Framework) - von maschinenlesbar hin zu maschinenverstehbar z RDF vereint ein weites Spektrum von Interessenten aus den Bereichen - Digitale Bibliotheken, Inhaltsbewertung, E-Commerce,... - Signifikante (allerdings weniger als für XML) industrielle Unterstützung unter Leitung des W3C z RDF besteht aus zwei Teilen - RDF Modell (eine Menge von Tripeln) - RDF Syntax (verschiedene XML Serialisierungssyntaxen) z RDF Schema dient zur Definition von Vokabularien (einfache Ontologien) für RDF (und in RDF) 79 Das RDF-Datenmodell z Resourcen - z Eigenschaften (Properties) - z Slots definieren Relationen zu anderen Resourcen oder atomaren Werten Statements - z Eine Resource ist ein Objekt, das man referenzieren kann Resourcen haben URIs RDF-Definitionen sind selbst Resourcen „Werte können Resourcen oder atomare XML-Daten sein“ Ähnlichkeit zu Frame-Sprachen in der KI (FRL) 80 Ein einfaches Beispiel z Statement - z Struktur - z „Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila“ Resource (Subjekt) Property (Prädikat) Value (Objekt) http://www.w3.org/Home/Lassila http://www.schema.org/#Creator “Ora Lassila“ Gerichteter Graph http://www.w3.org/Home/Lasilla s:Creator Ora Lasilla 81 Ein weiteres Beispiel z Um weitere Eigenschaften zu Creator hinzuzufügen, wird eine dazwischenliegende Resource eingefügt. http://www.w3.org/Home/Lasilla s:Creator Person://fi/654654635 Name Ora Lasilla Email [email protected] 82 Behandlung von Kollektionen z Mehrfaches Auftreten desselben Property Types stellt keine Relation zwischen den Werten her - The Millers own a boat, a bike, and a TV set - The Millers need (a car or a truck) - (Sarah and Bob) bought a new car z RDF definiert drei spezielle Resources: - Bag ungeordnete Werte rdf:Bag - Sequence geordnete Werte rdf:Seq - Alternative Einzelwert rdf:Alt z Der Kern von RDF erzwingt keine mengentheoretische Semantik für Werte 83 Beispiel: Bag Die Studenten von Kurs 6.001 sind Amy, Tim, John, Mary und Sue /courses/6.001 Rdf:Bag rdf:type students /Students/Amy rdf:_1 rdf:_2 bagid1 /Students/Tim rdf:_3 /Students/John rdf:_4 rdf:_5 /Students/Mary /Students/Sue 84 Beispiel: Alternative • Den Quellcode für X11 kann man unter ftp.x.org, ftp.cs.purdue.edu, oder ftp.eu.net finden http://x.org/package/X11 rdf:type rdf:Alt rdf:_1 altid ftp.x.org rdf:_2 ftp.cs.purdue.edu rdf:_3 ftp.eu.net 85 Statements über Statements • Um statements über statements zu machen, ist deren Transformation in Resourcen notwendig – subject der ursprüngliche Referent – predicate der ursprüngliche Property Type – object der ursprüngliche Wert – type rdf:Statement 86 Beispiel: Reifikation • Ralph Swick glaubt, daß der Kreator der Resource http://www.w3.org/Home/Lassila Ora Lassila ist. http://www.w3.org/Home/Lassila s:Creator rdf:predicate s:Creator rdf:subject genid1 rdf:object rdf:type b:believedBy rdf:Statement Ora Lassila Ralph Swick 87 Ein formales Modell von RDF • RDF ist mathematisch sehr einfach: – Grundlegende Definitionen • Resources. • Properties ⊂ Resources • Literals • Statements = Properties × Resources ×{Resources ∪ Literals} – Typisierung • rdf:type ∈ Properties • {RDF:type, sub, obj} ∈ Statements ⇒ obj ∈Resources 88 Ein formales Modell von RDF Reifikation z rdf:Statement ∈ Resource-Properties z{rdf:predicate, rdf:subject, rdf:object } ⊂ Properties z Reifikation eines Tripels { pred, sub, obj } von Statements ist ein Element r von Resourcen, die das refizierte Tripel und die Elemente s1, s2, s3, und s4 von Statements repräsentieren, so daß gilt: -s1: {RDF:predicate, r, pred} -s2: {RDF:subject, r, subj} -s3: {RDF:object, r, obj} -s4: {RDF:type, r, [RDF:Statement]} Kollektionen z{ RDF:Seq, RDF:Bag, and RDF:Alt } ⊂ Resources-Properties z Es gibt eine Teilmenge von Properties, die den Ordinalzahlen entspricht (1, 2, 3, ...) und Ord genannt wird. Wir bezeichnen Elemente von Ord als: RDF:_1, RDF:_2, RDF:_3, ... 89 RDF Syntax I • Das Datenmodell erzwingt keine spezielle Syntax • Die Spezifikation schlägt viele verschiedene Syntaxen auf XMLBasis vor • Allgemeine Form: Anfang einer RDF-Beschreibung Subjekt (OID) <rdf:RDF> <rdf:Description about="http://www.w3.org/Home/Lassila"> <s:Creator>Ora Lassila</s:Creator> <s:createdWith rdf:resource=“http://www.w3c.org/amaya”/> </rdf:Description> </rdf:RDF> Literal Properties Resource (möglicherweise eine andere RDF-Beschreibung) 90 Ergebnisgraph http://www.w3.org/Home/Lassila s:createdWith s:Creator http://www.w3c.org/amaya Ora Lassila <rdf:RDF> <rdf:Description about="http://www.w3.org/Home/Lassila"> <s:Creator>Ora Lassila</s:Creator> <s:createdWith rdf:resource=“http://www.w3c.org/amaya”/> </rdf:Description> </rdf:RDF> 91 Syntaktische Variationen Typinformation Subject (OID) Property <s:Homepage rdf:about="http://www.w3.org/Home/Lassila” s:Creator=“Ora Lassila”/> <s:createdWith> <s:HTMLEditor rdf:about=“http://www.w3c.org/amaya”/> </s:createdWith> </s:Homepage> Property http://www.w3.org/Home/Lassila s:Creator Ora Lassila rdf:type s:Homepage s:createdWith http://www.w3c.org/amaya rdf:type HTMLEditor 92 RDF Schema (RDFS) • RDF definiert lediglich das Datenmodell • Es besteht also Bedarf für die Definition von Vokabularien für ein solches Datenmodell • RDF Schemata sind Web Resourcen (und haben URIs). Sie können mit Hilfe von RDF beschrieben werden. 93 Die wichtigsten Modellierungsprimitive • Kernklassen – Root-Class rdfs:Resource – MetaClass rdfs:Class – Literals rdfs:Literal • rdfs:subclassOf-property • von RDF übernommen: properties (slots) • rdfs:domain & rdfs:range • rdfs:label, rdfs:comment, etc. • von RDF übernommen: InstanceOf (rdf:type) 94 RDF-Schema: Ein Beispiel s = rdfs:subClassOf t = rdf:type rdfs:Resource t s rdfs:Class t xyz:MotorVehicle t t s t t s s s xyz:Van xyz:Truck t s xyz:PassengerVehicle xyz:MiniVan s 95 Beispiel: RDF-Schema in RDF-Schema • Namespace-URL: http://www.w3.org/2000/01/rdf-schema# <rdfs:Class rdf:ID="Resource"> <rdfs:label xml:lang="en">Resource</rdfs:label> <rdfs:label xml:lang="fr">Ressource</rdfs:label> <rdfs:comment>The most general class</rdfs:comment> </rdfs:Class> <rdfs:Class rdf:ID="Class"> <rdfs:label xml:lang="en">Class</rdfs:label> <rdfs:label xml:lang="fr">Classe</rdfs:label> <rdfs:comment>The concept of Class</rdfs:comment> <rdfs:subClassOf rdf:resource="#Resource"/> </rdfs:Class> <rdf:Property ID="subClassOf"> <rdfs:label xml:lang="en">subClassOf</rdfs:label> <rdfs:label xml:lang="fr">sousClasseDe</rdfs:label> <rdfs:comment>Indicates membership of a class</rdfs:comment> <rdfs:range rdf:resource="#Class"/> <rdfs:domain rdf:resource="#Class"/> </rdf:Property> 96 Erweiterbarkeit von RDF • Definiere eine Ontologie einer Sprache mit RDF Schemata • Beschreibe Dateninstanzen unter Verwendung des neuen Vokabulars • Vorteil: alle Sprachen verwenden das gleiche Datenmodell (vereinfacht die Interoperabilität) 97 Das Prinzip von Ontologie-Sprachen auf RDF-Basis Instanzen Legende Definition nutzt RDF-Datenmodell Definiert mit Erweiterung von OntologieSprache RDF Schema RDF 98 OML (Ontology Markup Language) z OML ist eine Weiterentwicklung von SHOE z OML basiert auf den Conceptual Graphs von John Sowa, einer Wissens- repräsentationssprache in der Tradition der Semantischen Netze z OML unterstützt u.a. Lambda-Ausdrücke Beispiel: "A cat is on a mat." Lineare Form eines Conceptual Graph: [Cat]<-(On)->[Mat] KIF (Knowledge Interchange Format): (exists ((?x cat) (?y mat)) (On ?x ?y)) <OML> <Ontology id="Example" version="1.0"> <comment>A simple example ontology.</comment> <extends ontology="http://www.oml.org/ontology/" prefix="OML"/> <Object type="Cat"/> <Object type="Mat"/> <Relation type="on"> <comment>The preposition "On"</comment> <Function type="agent" tgtType="Cat"/> <Function type="object" tgtType="Mat"/> </Relation> <Collection type="Object.Collection" genus="OML:Object"/> <Collection type="Relation.Collection" genus="OML:Relation"/> <Collection type="Framed.Collection" genus="OML:Collection"/> </Ontology> </OML> 99 OML (Ontology Markup Language) Beispiel: "A cat is on a mat." <OML> <Ontology id="Example" version="1.0"> <comment>A simple example ontology.</comment> <extends ontology="http://www.oml.org/ontology/" prefix="OML"/> <Object type="Cat"/> <Object type="Mat"/> <Relation type="on"> <comment>The preposition "On"</comment> <Function type="agent" tgtType="Cat"/> <Function type="object" tgtType="Mat"/> </Relation> <Collection type="Object.Collection" genus="OML:Object"/> <Collection type="Relation.Collection" genus="OML:Relation"/> <Collection type="Framed.Collection" genus="OML:Collection"/> </Ontology> </OML> 100 OML (Ontology Markup Language) Beispiel: "A cat is on a mat." Kurzversion mit Inline-Definitionen: <OML> <Relation.Collection id="on" ontology="http://www.cg.org/example/"> <On> <agent><Cat/></agent> <object><Mat/></object> </On> </Relation.Collection> </OML> Langversion mit getrennten Definitionen: <OML> <Framed.Collection id="cat-on-mat" ontology="http://www.cg.org/example/"> <Object.Collection> <Cat id="x"/> <Mat id="y"/> </Object.Collection> <Relation.Collection> <On> <agent tgt="x"/> <object tgt="y"/> </On> </Relation.Collection> </Framed.Collection> </OML> 101 OML (Ontology Markup Language) Beipiel: "John is going to Boston by bus." Lineare CG-Form: [Go](Agnt)->[Person: John] (Dest)->[City: Boston] (Inst)->[Bus] KIF (Knowledge Interchange Format) (exists ((?x Go) (?y Person) (?z City) (?w Bus)) (and (Name ?y John) (Name ?z Boston) (Agnt ?x ?y) (Dest ?x ?z) (Inst ?x ?w))) OML (Ontology Markup Language) (ontology) <OML> <Ontology id="GoJohnBostonBus" version="1.0"> <extends ontology="http://www.oml.org/ontology/" prefix="OML"/> <Object type="Person"/> <Object type="City"/> <Object type="Bus"/> <Relation type="go"> <Function type="agent" tgtType="Person"/> <Function type="destination" tgtType="City"/> <Function type="instrument" tgtType="Bus"/> </Relation> </Ontology> </OML> 102 OML (Ontology Markup Language) Beipiel: "John is going to Boston by bus." Kurzversion: <go> <agent><Person text="John"/></agent> <destination><City text="Boston"/></destination> <instrument><Bus/></instrument> </go> Langversion: <Person id="y" text="John"/> <City id="z" text="Boston"/> <Bus id="w"/> <go> <agent tgt="y"/> <destination tgt="z"/> <instrument tgt="w"/> </go> 103 OML-Definition des CEO von Intel (Teil1) "Andrew S. Grove is chairman of Intel Corporation. He was born in Budapest, Hungary, in 1936. He graduated from the City College of New York in 1960 with a Bachelor of Chemical Engineering degree and received his Ph.D. from the University of California, Berkeley in 1963. Upon graduation, he joined the Research and Development Laboratory of Fairchild Semiconductor and became Assistant Director of Research and Development in 1967. In 1979 he was named its President of Intel Corporation, in 1987 he was named Chief Executive Officer, and in May 1997, he was named Chairman and CEO. His latest book, `Only the Paranoid Survive,' was published by Doubleday in September of 1996. In December, 1997, Dr. Grove was named Time Magazine’s `Man of the Year.' " OML (Ontology Markup Language) (ontology located a WAVE/Ontologies/Intel/Intelontology.html) <OML> <Ontology id="Intel Corporation" version="1.0"> <comment>The ontology for Intel Corporation.</comment> <extends ontology="http://www.oml.org/ontology/" prefix="OML"/> <extends ontology="http://www.bibtex.org/ontology/" prefix="BibTeX"/> <extends ontology="http://www.univ.org/ontology/" prefix="UNIV"/> 104 OML-Definition des CEO von Intel (Teil 2) <Object type="ExecutiveOfficer"> <Function type="position" tgtType="data.String"/> <Function type="birth.date" tgtType="data.Date"/> <Function type="birth.city" tgtType="City"/> </Object> ... <Relation type="award"> <Function type="person" tgtType="Employee"/> <Function type="organization" tgtType="Corporation"/> <Function type="title" tgtType="data.String"/> <Function type="date" tgtType="data.Date"/> </Relation> ... <Collection type="Object.Collection" genus="OML:Object"/> <Collection type="Relation.Collection" genus="OML:Relation"/> <Collection type="Framed.Collection" genus="OML:Collection"/> ... </Ontology> </OML> 105 OML-Definition des CEO von Intel (Teil 3) (collections: object & relation) <OML> <Framed.Collection id="companyDescription1998" ontology="http://WAVE/Ontologies/Commerce&Industry/ontology/"> <Object.Collection> ... <ExecutiveOfficer id="grove" about="http://www.intel.com/pressroom/kits/bios/grove.htm" text="Andrew S. Grove" picture="http://www.intel.com/pressroom/images/bios/grove.gif"> <comment>Andrew S. Grove is chairman of Intel Corporation. </comment> <position>Chairman</position> <birth.year tgt="data.Year#1936"/> <birth.city tgt="City#Budapest"/> </ExecutiveOfficer> ... </Object.Collection> <Relation.Collection> ... <birth> <person tgt="ExecutiveOfficer#grove"/> <date tgt="data.Date#//1936"/> <city tgt="City#Budapest"/> <country tgt="Country#Hungary"/> </birth>) 106 OML-Definition des CEO von Intel (Teil 4) <degree> <person tgt="ExecutiveOfficer#grove"/> <level tgt="UNIV:Bachelor"/> <school tgt="UNIV:University#CUNY"/> <major>Chemical Engineering</major> <date tgt="data.Year#1960"/> </degree> <degree> <person tgt="ExecutiveOfficer#grove"/> <level tgt="UNIV:Doctorate"/> <school tgt="UNIV:University#UC.Berkeley"/> <date tgt="data.Year#1963"/> </degree> <BibTeX#author> <person tgt="ExecutiveOfficer#grove"/> <document> <BibTeX:book> <key tgt="BibTeX:ISBN#0-553-47783-8"/> <author tgt="ExecutiveOfficer#grove"/> <title>Only the Paranoid Survive</title> <publisher tgt="Corporation#Doubleday"/> <year tgt="1996"/> </BibTeX:book> </document> </BibTeX:author> <award> <person tgt="ExecutiveOfficer#grove"/> <organization tgt="Corporation#Time_Magazine"/> <title>Man of the Year</title> <date tgt="data.Year#1997"/> </award> ... </Relation.Collection> </Framed.Collection> </OML> 107