1 / 15

RDF Examples

A quick guide to RDF syntax, including examples and guidelines for using RDF Property Elements, Abbreviated RDF Syntax, and RDF Containers.

ashej
Download Presentation

RDF Examples

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. RDF Examples • Quick Guide to RDF Syntax • Nancy Ide • Vassar College • Eurolan 2003 The Semantic Web and Language Technology

  2. The RDF Description Element • Attributes • about • refers to a URI of an existing resource • ID • signals the creation of a new resource <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description about="http://www.cs.vassar.edu/~ide/"> . . . </rdf:Description> <rdf:Description rdf:ID="Nancy Ide"> . . . </rdf:Description> </rdf:RDF>

  3. RDF Property Elements • Property names must be associated with a schema • Qualify property names with a namespace prefix • Production propertyElt: <PropertyName> Value </PropertyName> • Value = Description element or String <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description about="http://www.cs.vassar.edu/~ide/rdf/"> <dc:creator>Nancy Ide</dc:creator> </rdf:Description> </rdf:RDF>

  4. Using Abbreviated RDF Syntax Property elements converted to attributes <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description about="http://www.cs.vassar.edu/~ide/ESA.pdf"> <dc:creator>Nancy Ide</dc:creator> <dc:title>Encoding Syntactic Annotation</dc:title> <dc:date>2001-04-10</dc:date> </rdf:Description> </rdf:RDF> <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description about="http://www.cs.vassar.edu/~ide/ESA.pdf" dc:creator="Nancy Ide" dc:title="Encoding Syntactic Annotation" dc:date="2001-04-10"/> </rdf:RDF>

  5. Using Abbreviated RDF Syntax • New fact:   http://www.cs.vassar.edu/~ide is an instance of a WebPage • rdf:type element adds this new fact • value of the rdf:type can be used directly as element name <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description about="http://www.cs.vassar.edu/~ide"> <rdf:type rdf:resource="http://www.schemas.org/www/Webpage"/> <dc:creator>Nancy Ide</dc:creator> </rdf:Description> </rdf:RDF> <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:s="http://www.schemas.org/www/"> <s:WebPage about="http://www.cs.vassar.edu/~ide"> <dc:creator>Nancy Ide</dc:creator> </s:WebPage> </rdf:RDF>

  6. RDF Containers • Bag • An unordered list of resources or literals • Sequence • An ordered list of resources or literals • Alternative • A list of resources or literals that represent alternatives for the value of a property

  7. Using the Bag Container • Statement: • The authors of the book 0201000237 are Alfred, John and Jeffrey <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description about="urn:ISBN:0-201-00023-7"> <dc:creator> <rdf:Bag> <rdf:li>Alfred</rdf:li> <rdf:li>John</rdf:li> <rdf:li>Jeffrey</rdf:li> </rdf:Bag> </dc:creator> </rdf:Description> </rdf:RDF>

  8. Using the Seq Container • Statement: • The students of the course csci-2962 in alphabetical order are • Elizabeth, George and John <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://www.schemas.org/Course/"> <rdf:Description about="http://www.cs.vassar.edu/courses/cs240"> <s:students> <rdf:Seq> <rdf:li rdf:resource="http://www.cs.vassar.edu/students/er"/> <rdf:li rdf:resource="http://www.cs.vassar.edu/students/gl"/> <rdf:li rdf:resource="http://www.cs.vassar.edu/students/js"/> </rdf:Seq> </s:students> </rdf:Description> </rdf:RDF>

  9. Using the Alt Container • Statement:   • The formats of the book 0201000237 are plain text, html • and postscript <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description about="urn:ISBN:0-201-00023-7"> <dc:format> <rdf:Alt> <rdf:li>text/html</rdf:li> <rdf:li>text/plain</rdf:li> <rdf:li>application/postscript</rdf:li> </rdf:Alt> </dc:format> </rdf:Description> </rdf:RDF>

  10. Making Statements about Containers <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://www.schemas.org/Course/" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description about="http://www.cs.vassar.edu/courses/cs240"> <s:homeworks> <rdf:Bag ID="pages"> <rdf:li rdf:resource="http://www.cs. vassar.edu/courses/cs240/hw1.html"> <rdf:li rdf:resource="http://www.cs. vassar.edu/courses/cs240/hw2.html"> </rdf:Bag> </s:homeworks> </rdf:Description> <rdf:Description about="#pages"> <dc:creator>Nancy Ide</dc:creator> </rdf:Description> </rdf:RDF>

  11. Making Statements about the Items in a Container <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://www.schemas.org/Course/" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description about="http://www.cs.vassar.edu/courses/cs240"> <s:homeworks> <rdf:Bag ID="pages"> <rdf:li rdf:resource="http://www.cs. vassar.edu/courses/cs240/hw1.html"> <rdf:li rdf:resource="http://www.cs. vassar.edu/courses/cs240/hw2.html"> </rdf:Bag> </s:homeworks> </rdf:Description> <rdf:Description aboutEach="#pages"> <dc:creator>Nancy Ide</dc:creator> </rdf:Description> </rdf:RDF>

  12. Non-Binary Relations • The RDF data model only supports binary relations (relations between two resources) • Solution: Use an intermediate resource with additional properties <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://www.schemas.org/Units/"> <rdf:Description about="urn:ISBN:0-201-00023-7"> <s:price rdf:parseType="Resource"> <rdf:value>45.00</rdf:value> <s:units rdf:resource="http://www.schemas.org/Units/USdollar"/> </s:price> </rdf:Description> </rdf:RDF> Statement: The cost of the book 0201000237 is $45.00

  13. Reification • Making statements about statements • Classic example: “Dan Tufis says that Dan Cristea made the web page http://www.infoiasi.ro/~cristea.” asserts Dan Tufis Dan Cristea made http://www.infoiasi.ro/~cristea Simple solution: Put an rdf:ID attribute on the property element. By default, anything with an rdf:ID is an instance of RDF:Statement

  14. The parseType attribute • Use attribute parseType="Resource"on an RDF/XML element when there is an rdf:Description (or its equivalent) as a child element • Use attribute parseType=”Literal” on an RDF/XML element when the content is not to be parsed by the RDF parser <rdf:Description about="urn:ISBN:0-201-00023-7"> <s:price rdf:parseType="Resource"> <rdf:value>45.00</rdf:value> <s:units rdf:resource="http://www.schemas.org/Units/USdollar"/> </s:price> </rdf:Description> <dc:title rdf:parseType="Literal"> Solving <mrow> <mrow><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mn>1</mn></mrow> <mo>=</mo><mn>0</mn> </mrow> </dc:title>

  15. Exercise • Get your hands dirty with some real RDF... • Create an RDF schema for EAGLES morpho-syntactic categories • Extend to your own language, using the EAGLES specifications • Tag some text? • Use Protoge, a simple RDF editor, or a plain text editor

More Related