RDF Examples Quick Guide to RDF Syntax Nancy















- Slides: 15
RDF Examples Quick Guide to RDF Syntax Nancy Ide Vassar College Eurolan 2003 The Semantic Web and Language Technology
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. w 3. 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> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
RDF Property Elements Property names must be associated with a schema Qualify property names with a namespace prefix Production property. Elt: <Property. Name> Value </Property. Name> Value = Description element or String <? xml version="1. 0"? > <rdf: RDF xmlns: rdf="http: //www. w 3. 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> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
Using Abbreviated RDF Syntax Property elements converted to attributes <? xml version="1. 0"? > <rdf: RDF xmlns: rdf="http: //www. w 3. 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. w 3. 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> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
Using Abbreviated RDF Syntax New fact: http: //www. cs. vassar. edu/~ide is an instance of a Web. Page 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. w 3. 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. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: dc="http: //purl. org/dc/elements/1. 1/" xmlns: s="http: //www. schemas. org/www/"> <s: Web. Page about="http: //www. cs. vassar. edu/~ide"> <dc: creator>Nancy Ide</dc: creator> </s: Web. Page> </rdf: RDF> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
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 EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
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. w 3. 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> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
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. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: s="http: //www. schemas. org/Course/"> <rdf: Description about="http: //www. cs. vassar. edu/courses/cs 240"> <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> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
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. w 3. 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> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
Making Statements about Containers <? xml version="1. 0"? > <rdf: RDF xmlns: rdf="http: //www. w 3. 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/cs 240"> <s: homeworks> <rdf: Bag ID="pages"> <rdf: li rdf: resource="http: //www. cs. vassar. edu/courses/cs 240/hw 1. html"> <rdf: li rdf: resource="http: //www. cs. vassar. edu/courses/cs 240/hw 2. html"> </rdf: Bag> </s: homeworks> </rdf: Description> <rdf: Description about="#pages"> <dc: creator>Nancy Ide</dc: creator> </rdf: Description> </rdf: RDF> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
Making Statements about the Items in a Container <? xml version="1. 0"? > <rdf: RDF xmlns: rdf="http: //www. w 3. 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/cs 240"> <s: homeworks> <rdf: Bag ID="pages"> <rdf: li rdf: resource="http: //www. cs. vassar. edu/courses/cs 240/hw 1. html"> <rdf: li rdf: resource="http: //www. cs. vassar. edu/courses/cs 240/hw 2. html"> </rdf: Bag> </s: homeworks> </rdf: Description> <rdf: Description about. Each="#pages"> <dc: creator>Nancy Ide</dc: creator> </rdf: Description> </rdf: RDF> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
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. w 3. 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: parse. Type="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 EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
Reification Making statements about statements Classic example: “Dan Tufis says that Dan Cristea made the web page http: //www. infoiasi. ro/~cristea. ” Dan Tufis asserts 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 EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
The parse. Type attribute Use attribute parse. Type="Resource" on an RDF/XML element when there is an rdf: Description (or its equivalent) as a child element <rdf: Description about="urn: ISBN: 0 -201 -00023 -7"> <s: price rdf: parse. Type="Resource"> <rdf: value>45. 00</rdf: value> <s: units rdf: resource="http: //www. schemas. org/Units/USdollar"/> </s: price> </rdf: Description> Use attribute parse. Type=”Literal” on an RDF/XML element when the content is not to be parsed by the RDF parser <dc: title rdf: parse. Type="Literal"> Solving <mrow><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mn>1</mn></mrow> <mo>=</mo><mn>0</mn> </mrow> </dc: title> EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania
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 EUROLAN 2003 THE SEMANTIC WEB AND LANGUAGE TECHNOLOGY July 28 - August 8, Bucharest - Romania