1 / 20

Practical RDF Chapter 3. The Basic Elements Within the RDF/XML Syntax

Practical RDF Chapter 3. The Basic Elements Within the RDF/XML Syntax. Shelley Powers, O’Reilly SNU IDB Lab. Hyewon Kim. Outline. Serializing RDF to XML RDF Blank Nodes URI References Representing Structured Data with rdf:value The rdf:type Property RDF/XML Shortcuts

parker
Download Presentation

Practical RDF Chapter 3. The Basic Elements Within the RDF/XML Syntax

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Practical RDFChapter 3. The Basic Elements Within the RDF/XML Syntax Shelley Powers, O’Reilly SNU IDB Lab. HyewonKim

  2. Outline • Serializing RDF to XML • RDF Blank Nodes • URI References • Representing Structured Data with rdf:value • The rdf:type Property • RDF/XML Shortcuts • More on RDF Data Types

  3. Introduction • Serialization converts an RDF model in a text-based format using XML RDF model http://burningbird.net/postcon/elements/1.0/author http://burningbird.net/articles/monsters3.htm Shelly Powers Serialization Text-based format using XML <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monster3.htm”> <pstcn:author>Shelly Powers</pstcn:author> </rdf:Description> </rdf:RDF>

  4. Serializing RDF to XMLExample (1/5) The article on giant squids, titled “Architeuthis Dux,” at http://burningbird.net/articles/monsters3.htm, written by Shelly Powers, explores the giant’s squid’s mythological representation as the legendary Kraken as well as describing current efforts to capture images of a live specimen. In addition, the article also provides descriptions of a giant squid’s physical characteristics. It is part of a four-part series, described at http://burningbird.net/articles/monsters.htm and entitled “A Tale of Two Monsters.” • Identified by • http://burningbird.net/articles/monster3.htm • Series member • http://burningbird.net/articles/monsters.htm • Written by • Shelley Powers • Title • A tale of Two Monsters Article • Title • Architeuthis Dux • Provides • Physical description of giant squid • Associates • Kraken and giant squid

  5. Serializing RDF to XMLExample (2/5) • RDF • Starting small, we’ll take a look at mapping the article and the author and title, only into RDF • pstcn • Created prefix for the example <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monster3.htm”> <pstcn:author>Shelly Powers</pstcn:author> <pstcn:title> Architeuthis Dux</pstcn:title> </rdf:Description> </rdf:RDF> • Predicate– Author • Object – Shelly Powers Subject http://burningbird.net/articles/monsters3.htm • Predicate – Title • Object – Architeuthis Dux

  6. Serializing RDF to XMLExample (3/5) • Expanded version of the example <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monster3.htm”> <pstcn:author>Shelly Powers</pstcn:author> <pstcn:title> Architeuthis Dux</pstcn:title> <pstcn:seriesrdf:resource=“http://burningbird.net/articles/monsters.htm /”> <pstcn:contains> Physical description of giant squids </pstcn:contains> <pstcn:alsoContains> Tale of the Legendary Kraken </pstcn:alsoContains> </rdf:Description> <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monster.htm”> <pstcn:seriesTitle>A Tale of Two Monsters</pstcn:seriesTitle> </rdf:Description> </rdf:RDF> • Series member • http://burningbird.net/articles/monsters.htm Article • Title • A tale of Two Monsters

  7. Serializing RDF to XMLExample (4/5) • Expanded RDF modified to use nested resources <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monster3.htm”> <pstcn:author>Shelly Powers </pstcn:author> <pstcn:title> Architeuthis Dux</pstcn:title> <pstcn:series > <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monsters.htm”> <pstcn:SeriesTitle>A Tale of Two Monsters </pstcn:seriesTitle> </rdfDescription> <pstcn:series> <pstcn:contains> Physical description of giant squids </pstcn:contains> <pstcn:alsoContains> Tale of the Legendary Kraken </pstcn:alsoContains> </rdf:Description> </rdf:RDF>

  8. Serializing RDF to XMLExample (5/5) • RDF graph http://burningbird.net/postcon/elements/1.0/author Shelley Powers http://burningbird.net/postcon/elements/1.0/title Architeuthis Dux http://burningbird.net/postcon/elements/1.0/series http://burningbird.net/postcon/elements/1.0/seriesTitle <rdfDescriptionxmins.rdf=“http://www.w3.org/199/02/22-rdf-syntax-ns#... http://burningbird.net/articles/monsters.com A Tale of Two Monsters http://burningbird.net/postcon/elements/1.0/contains Physical description of giant squid http://burningbird.net/postcon/elements/1.0/alsoContains Tale of the legendary Kraken

  9. Serializing RDF to XMLPredicates (1/2) • We can mark the type of property using the rdf:parseType attribute • rdf:parseType=“Literal” • Embed XML within an RDF document <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=http://burningbird.net/postcon/elements/1.0/> <rdf:Descriptionrdf:about=http://burningbird.net/articles/monster3.htm> <pstcn:author>Shelly Powers </pstcn:author> <pstcn:title> Architeuthis Dux</pstcn:title> <pstcn:series > <rdf:Descriptionrdf:about=“http://dynamicearth.com/articles/monsters.htm> <pstcn:SeriesTitle>A Tale of Two Monsters </pstcn:seriesTitle> </rdfDescription> <pstcn:series> <pstcn:contains> Physical description of giant squids </pstcn:contains> <pstcn:alsoContainsrdf:parseType=“Literal”> <h1> Tale of the Legendary Kraken </h1> </pstcn:alsoContains> </rdf:Description> </rdf:RDF>

  10. Serializing RDF to XMLPredicates (2/2) • We can mark the type of property using the rdf:parseTypeattribute • rdf:parseType=“Resource” • Identify the element as a resource without having to use rdf:about or rdf:ID <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monster3.htm”> <pstcn:authorrdf:parseType=“Resource” /> </rdf:Description> </rdf:RDF> With no value provided http://burningbird.net/postcon/elements/1.0/author http://burningbird.net/articles/monsters3.htm Genid:ARP107458

  11. Serializing RDF to XMLNamespaces and Qnames(1/2) • The format of namespace • RDF Working Group has allowed some attributes to be non-namespace annotated • ID • bagID • about • resource • parseType • type xmlns:name = “URI of schema” QName XML Local name

  12. Serializing RDF to XMLNamespaces and Qnames(2/2) • Qnames can be used as values for rdf:about or rdf:type <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:bbd=“http://www.burningbird.net/schema#” <rdf:Descriptionrdf:about =“http://www.burningbird.net/identifier/tutorials/xul.htm”> <bbd:bidrdf:resource=“bbd:bio”/> <bbd:relevancyrdf:resource=“bbd:relevancy”/> </rdf:Description> <rdf:Descriptionrdf:about=“bbd:bio”> <bbd:Title> YASD Does Mozilla/Navigator 6.0 </bbd:Title> <bbd:Description> Demonstrations of using XUL for interface development </bbd:Description> <bbd:CreationDate> May 2000 </bbd CreationDate> <bbd:ContentAuthor> Shelly Powers </bbd:ContentAuthor> <bbd:ContentOwner> Shelly Powers </bbd:ContentOwner> <bbd:CurrentLocation> N/A </bbd:CurrentLocation> <rdf:Description> <rdf:Descriptionrdf:about=“bbd:relevancy”> <bbd:CurrentStatus> Inactive </bbd:CurrentStatus> <bbd:RelevancyExpiration> N/A </bbd:RelevancyExpiration> <bbd:Dependencies> None </bbd:Dependencies> </rdf:Description> </rdf:RDF>

  13. RDF Blank Nodes (1/2) • A blank node represents a resource that isn’t currently identified • rdf:nodeID is used to provide a specific identifier • <pstcn:biordf:nodeID=“monsters1”> <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/” xml:base=“http://burningbird.net/articles/”> <rdf:Descriptionrdf:about=“monsters1.htm”> <pstcn:bio> <rdf:Description> <pstcn:title>Tale of Two Monsters :Legends </pstcn:title> <pstcn:descriotion> Part 1 of four-part series on cryptozoology, legends, Nessie the Loch Ness Monster and the giant squid. </pstcn:description> <pstcn:created>1999-08-01T00:00:00-06:00 </pstcn:created> <pstcn:creator> Shelley Powers </pstcn:creator> </rdfDescription> <pstcn:bio> </rdf:Description> </rdf:RDF>

  14. RDF Blank Nodes (2/2) • The RDF Validator has generated a node identifier for the blank node, genid:403 http://burningbird.net/postcon/elements/1.0/title Tale of Two Monsters:Legends http://burningbird.net/postcon/elements/1.0/description Part 1 of four-part series on cryptozoology, legends http://burningbird.net/postcon/elements/1.0/bio monsters1.htm genid:403 http://burningbird.net/postcon/elements/1.0/created 1999-08-01T00:00:00-05:00 Blank node http://burningbird.net/postcon/elements/1.0/creator Shelly Powers

  15. URI ReferencesResolving Relative URIs and xml:base • With xml:base, we can specify a base document that’s used to generate full URIs when given relative URI references <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/” xml:base=“http://burningbird.net/articles/”> <rdf:Descriptionrdf:about=“monsters3.htm”> <pstcn:authorrdf:parseType=“Literal” /> </rdf:Description> </rdf:RDF> A relative URI reference A base document Full URI → http://burningbird.net/articles/monsters3.htm

  16. URI ReferencesResolving References with rdf:ID <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=http://burningbird.net/postcon/elements/1.0/> <rdf:Descriptionrdf:ID=“monsters3.htm”> <pstcn:author>Shelly Powers </pstcn:author> <pstcn:title> Architeuthis Dux</pstcn:title> <pstcn:series > <rdf:Descriptionrdf:ID=“monsters.htm”> <pstcn:SeriesTitle>A Tale of Two Monsters </pstcn:seriesTitle> </rdfDescription> <pstcn:series> <pstcn:contains> Physical description of giant squids </pstcn:contains> <pstcn:alsoContainsrdf:parseType=“Literal”> <h1> Tale of the Legendary Kraken</h1> </pstcn:alsoContains> </rdf:Description> </rdf:RDF> http://burningbird.net/index.htm#monsters3.htm http://burningbird.net/index.htm#monsters.htm • Enclosing document • http://burningbird.net/index.htm

  17. Representing Structured Data with rdf:value • Some data values have both a value and additional information The last modified date : 18 July RDF <pstcn:lastEdited> 18 </pstcn:lastEdited> Ambiguous!Is it 18 days? Months? Hours? <pstcn:lastEdited> 18 days </pstcn:lastEdited> It should be split ! <pstcn:lastEdited> 18 </pstcn:lastEdited> <pstcn:lastEditedUnit> day </pstcn:lastEditedUnit> There is a disconnectbetween the value and the unit <pstcn:lastEditedrdf:parseType=“Resource”> <rdf:value> 18 </rdf:value> <pstcn:lastEditedUnit> day </pstcn:lastEditedUnit> </pstcn:lastEdited> • rdf:value • When dealing with structured data, the rdf:value predicate includes the actual value of the structure

  18. The rdf:type Property • rdf:type • Explicitly define the resource type • Is associated at the same level of granularity as the other properties <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monster3.htm”> <pstcn:Author>Shelly Powers</pstcn:Author> <pstcn:Title>Architeuthis Dux</pstcn:Title> <rdf:typerdf:resource=“http://burningbird.net/postcon/elements/1.0/Article/”> </rdf:Description> </rdf:RDF> Abbreviated syntax <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <pstcn:Articlerdf:about=“http://burningbird.net/articles/monster3.htm”> <pstcn:Author>Shelly Powers</pstcn:Author> <pstcn:Title>Architeuthis Dux</pstcn:Title> </pstcn:Article> </rdf:RDF>

  19. RDF/XML Shortcuts • RDF/XML Shortcut is an abbreviated technique • Separate predicates can be enclosed within the same resource block • Nonrepeating properties can be created as resource attributes • Empty resource properties do not have to be formally defined with description block <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <pstcn:Article pstcn:author = “Shelly Powers” pstcn:title= “Architeuthis Dux” rdf:about=“http://dynamicearth.com/articles/monsters3.htm”> <pstcn:relatedrdf:resource=“http://burningbird.net/articles/monsters1.htm” pstcn:reason=“First in the series” /> </pstcn:Article> </rdf:RDF>

  20. More on RDF Data Types • Within RDF/XML, the data type is specified as an attribute of the element, using the rdf:datatype attribute <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://burningbird.net/postcon/elements/1.0/”> <rdf:Descriptionrdf:about=“http://burningbird.net/articles/monsters3.htm”> <pstcn:authorrdf:datatype = “http://www.w3.org/2001/XMLSchema#string”> Shelley Powers </pstcn:author> <pstcn:titlerdf:datatype = “http://www.w3.org/2001/XMLSchema#string”> Architeuthis Dux </pstcn:title> </rdf:Description> </rdf:RDF>

More Related