1 / 8

Comparing Turtle and RDF/XML for Semantic Web Data Representation

This document explores the differences between Turtle and RDF/XML as serialization formats for RDF data on the Semantic Web. It illustrates how to define resources using both formats with examples featuring the FOAF vocabulary. The advantages of Turtle's readability and compact syntax are contrasted with RDF/XML's verbosity. The content also shows how to use XML entities, define typed nodes, and nest descriptions, making it a practical guide for developers and researchers working with RDF in semantic applications.

vielka-diaz
Download Presentation

Comparing Turtle and RDF/XML for Semantic Web Data Representation

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. CSE 428Semantic Web TopicsRDF Jeff Heflin Lehigh University

  2. Turtle vs. RDF/XML Turtle: @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix foaf: <http://xmlns.com/foaf/0.1/> .<http://www.yahoo.com/~jdoe#jane> foaf:name "Jane Doe" ;foaf:knows http://www.yahoo.com/~jsmith#john . RDF/XML: <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"> <rdf:Descriptionrdf:about="http://www.yahoo.com/~jdoe#jane"> <foaf:knowsrdf:resource="http://www.yahoo.com/~jsmith#john" /> <foaf:name>Jane Doe</foaf:name> </rdf:Description> </rdf:RDF>

  3. Default Namespaces • <rdf:RDFxmlns="http://xmlns.com/foaf/0.1/"xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Descriptionrdf:about="http://www.yahoo.com/~jdoe#jane"> <knowsrdf:resource="http://www.yahoo.com/~jsmith#john" /> <name>Jane Doe</name> </rdf:Description> </rdf:RDF>

  4. Using XML Entities • <!DOCTYPE rdf:RDF [ • <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">] > • <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" • xmlns:foaf="http://xmlns.com/foaf/0.1/" > • <rdf:Descriptionrdf:about="http://www.aol.com/~jdoe"> • <foaf:agerdf:datatype="&xsd;integer">30</foaf:age> • </rdf:Description> • </rdf:RDF> Resolves to:http://www.w3.org/2001/XMLSchema#integer

  5. Nesting Descriptions • <rdf:RDFxmlns="http://xmlns.com/foaf/0.1/"xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Descriptionrdf:about="http://www.aol.com/~jdoe"> • <foaf:name>Jane Doe</foaf:name> • <foaf:knows> • <rdf:Descriptionrdf:about="http://www.aol.com/~jsmith"> • <foaf:name>John Smith</foaf:name> • </rdf:Description> • </foaf:knows> • </rdf:Description> • </rdf:RDF>

  6. Typed Nodes in RDF/XML • <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" • xmlns:foaf="http://xmlns.com/foaf/0.1/"> • <rdf:Descriptionrdf:about="http://www.yahoo.com/~jdoe#jane"> • <rdf:typerdf:resource="http://xmlns.com/foaf/0.1/Person" /> • <foaf::name>Jane Doe</foaf:name> • </rdf:Description> • </rdf:RDF> Jane is an instance of Person • <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" • xmlns:foaf="http://xmlns.com/foaf/0.1/"> • <foaf:Personrdf:about="http://www.yahoo.com/~jdoe#jane"> • <foaf::name>Jane Doe</foaf:name> • </foaf:Person> • </rdf:RDF> Shorthand for the same thing

  7. RDFa • <html xmlns="http://www.w3.org/1999/xhtml" • prefix="bibo: http://purl.org/ontology/bibo/ • dc: http://purl.org/dc/terms/"> • <head> • <title>Books by Marco Pierre White</title> • </head> • <body> • I think White's book • '<span about="urn:ISBN:0091808189" typeof="bibo:Book" • property="dc:title">Canteen Cuisine</span>' • is well worth getting since although it's quite advanced stuff, he • makes it pretty easy to follow. You might also like • <span • about="urn:ISBN:1596913614" • typeof="bibo:Book" • property="dc:description" • >White's autobiography</span>. • </body> • </html> Declare namespace prefixes This item is of type Book, and has title “Canteen Cuisine” This item is of type Book, and has description “White’s autobiography” Example from http://www.w3.org/TR/rdfa-syntax/

  8. RDF Schema Example <rdf:RDFxml:base="http://example.org/univ-ont#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"xmlns:univ="http://example.org/univ-ont#"> <rdf:Propertyrdf:about="#teaches"> <rdfs:domainrdf:resource="#Professor" /> <rdfs:rangerdf:resource="#Course" /> </rdf:Property> <univ:Personrdf:about="#heflin" > <univ:teachesrdf:resource="#cse428" /> </univ:Person> </rdf:RDF> rdf:Property rdf:type rdfs:domain Professor teaches heflin cse428 teaches Course rdfs:range

More Related