1 / 23

RDF Tutorial

RDF Tutorial. What is RDF?. RDF stands for Resource Description Framework It is used for describing resources on the web Makes use of URIs to identify web resources and is written in XML RDF is a web standard. Designed to be read by Computers.

haroun
Download Presentation

RDF Tutorial

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 Tutorial

  2. What is RDF? • RDF stands for Resource Description Framework • It is used for describing resources on the web • Makes use of URIs to identify web resources and is written in XML • RDF is a web standard RDF Tutorial

  3. Designed to be read by Computers • RDF was designed to provide a common way to describe information so it can be read (and understood) by computer applications. • RDF descriptions are not designed to be displayed on the web. RDF Tutorial

  4. Makes use of URIs • RDF uses a URI (Uniform Resource Identifier) to identify a web resource, and properties to describe the resource • Unlike URLs, URIs are not limited to identifying things that have a network location • A URI reference (URIref) is a URI, together with an optional fragment identifier at the end. http://www.example.org/index.html#section2 RDF Tutorial

  5. Simple Example <?xml version="1.0"?> <RDF> <Description about="http://www.w3schools.com/default.asp"> <author>Jan Egil Refsnes</author> <created>November 1, 1999</created> <modified>February 1, 2004</modified> </Description> </RDF> RDF Tutorial

  6. Example explained • In the example: • the URI "http://www.w3schools.com/-default.asp" is used to identify a web page, • the property "author" describes the author of the page, • the property value is "Jan Egil Refsnes". • The property "created" tells when the page was created, and the property "modified" when it was last modified. RDF Tutorial

  7. Subject, Predicate & Object • RDF terminology also use the words subject, predicate and object. • The resource http://www.w3schools.com/default.asp is the subject • The property "author" is the predicate • The value "Jan Egil Refsnes" is the object RDF Tutorial

  8. Example 2 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax ns#" xmlns:cd="http://www.recshop.fake/cd"> <rdf:Description rdf:about="http://www.recshop.fake/cd/Empire Burlesque"> <cd:artist>Bob Dylan</cd:artist> <cd:country>USA</cd:country> <cd:company>Columbia</cd:company> <cd:price>10.90</cd:price> <cd:year>1985</cd:year> </rdf:Description> . . . . . . . . . . . . RDF Tutorial

  9. Example 2 (cont) <rdf:Description rdf:about="http://www.recshop.fake/cd/Hide your heart"> <cd:artist>Bonnie Tyler</cd:artist> <cd:country>UK</cd:country> <cd:company>CBS Records</cd:company> <cd:price>9.90</cd:price> <cd:year>1988</cd:year> </rdf:Description> </rdf:RDF> RDF Tutorial

  10. Number Subject Predicate Object 1 http://www.recshop.fake/cd/Empire Burlesque http://www.recshop.fake/cdartist "Bob Dylan" 2 http://www.recshop.fake/cd/Empire Burlesque http://www.recshop.fake/cdcountry "USA" 3 http://www.recshop.fake/cd/Empire Burlesque http://www.recshop.fake/cdcompany "Columbia" 4 http://www.recshop.fake/cd/Empire Burlesque http://www.recshop.fake/cdprice "10.90" 5 http://www.recshop.fake/cd/Empire Burlesque http://www.recshop.fake/cdyear "1985" List of Triples RDF Tutorial

  11. Directed Graph Representation Using RDF Validator: http://www.w3.org/RDF/Validator/ RDF Tutorial

  12. Details of Example 2 • The first line in the XML file is the XML declaration, telling the version of XML. • The rdf:RDF element indicates that the content is RDF. • The xmlns:rdf namespace, specifies that tags with the rdf: prefix are from the namespace defined by "http://www.w3.org/1999/02/22-rdf-syntax-ns#". • The xmlns:cd namespace, specifies that tags with the cd: prefix are from the namespace defined by "http://www.recshop.fake/cd". • The rdf:Description element contains the description of a resource identified by the rdf:about attribute. • The cd:artist element describes a property of the resource, and so does cd:country, etc. RDF Tutorial

  13. Main Elements • The RDF Element <rdf:RDF> • The RDF element is the root of the RDF document. It defines the XML document to be an RDF document and contains a reference to the xmlns:rdf namespace: • <?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> . . Description goes here . </rdf:RDF> • The root element must always have a reference to the RDF namespace: http://www.w3.org/1999/02/22-rdf-syntax-ns# RDF Tutorial

  14. Main Elements (cont) • The Description Element <rdf:Description> • The Description element describes a resource. • The about attribute identifies the resource. • Property elements are used to describe the resource • In example 2: The property elements (artist, country, company, price, and year) are defined in the namespace xmln:cd. RDF Tutorial

  15. RDF Container Elements • The Bag Element <rdf:Bag> • The Bag element contains an unordered list of value elements • The Seq Element <rdf:Seq> • The Seq element contains an ordered list of value elements • The Alt Element <rdf:Alt> • The Alt element contains a list of alternative values for an element RDF Tutorial

  16. rdf:Bag <rdf:Description rdf:about="http://example.org/courses/6.001"> <s:students> <rdf:Bag> <rdf:li rdf:resource="http://example.org/students/Amy"/> <rdf:li rdf:resource="http://example.org/students/Mohamed"/> <rdf:li rdf:resource="http://example.org/students/Johann"/> <rdf:li rdf:resource="http://example.org/students/Maria"/> <rdf:li rdf:resource="http://example.org/students/Phuong"/> </rdf:Bag> </s:students> </rdf:Description> RDF Tutorial

  17. rdf:Bag graph RDF Tutorial

  18. RDF Collections • An RDF collection is a group of things represented as a list structure in the RDF graph. • A list structure constructed using a predefined collection vocabulary consisting of • predefined type rdf:List, • predefined properties rdf:first and rdf:rest, • predefined resource rdf:nil. • In RDF/XML, a collection can be described by a property element that has the attribute rdf:parseType="Collection", and that contains a group of nested elements representing the members of the collection. RDF Tutorial

  19. RDF Collections RDF/XML <rdf:Description rdf:about="http://example.org/courses/6.001"> <s:students rdf:parseType="Collection"> <rdf:Description rdf:about="http://example.org/students/Amy"/> <rdf:Description rdf:about="http://example.org/students/Mohamed"/> <rdf:Description rdf:about="http://example.org/students/Johann"/> </s:students> </rdf:Description> RDF Tutorial

  20. RDF Collections Graph RDF Tutorial

  21. RDF Schema • RDF Schema provides the framework to describe application-specific classes and properties • Classes in RDF Schema are much like classes in object oriented programming languages. This allows resources to be defined as instances of classes, and subclasses of classes RDF Tutorial

  22. RDFS example <?xml version="1.0"?> <rdf:RDF xmlns:rdf= "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base= "http://www.animals.fake/animals"> <rdfs:Class rdf:ID="animal" /> <rdfs:Class rdf:ID="horse"> <rdfs:subClassOf rdf:resource="#animal"/> </rdfs:Class> <rdfs:Class rdf:ID="dog"> <rdfs:subClassOf rdf:resource="#animal"/> </rdfs:Class> </rdf:RDF> RDF Tutorial

  23. Next lectureIntroduction to OWL RDF Tutorial

More Related