Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The Semantic Web #5 - RDF (2)

893 views

Published on

This is a lecture note #5 for my class of Graduate School of Yonsei University, Korea.
It describes Resource Description Framework (RDF).

  • Be the first to comment

The Semantic Web #5 - RDF (2)

  1. 1. Linked Data & Semantic Web Technology The Semantic WebPart 5. Resource Description Framework (2) Dr. Myungjin Lee
  2. 2. Typed Node • Typed Node – the resources described as instances of specific types or classes – being classified into different kinds or categories – by providing a predefined property, rdf:type 1. <rdf:Description rdf:ID="item10245"> 2. <rdf:type rdf:resource="http://www.example.com/terms/Tent"/> 3. </rdf:Description> rdf:type http://www.example.com/2002/04/products#item10245 http://www.example.com/terms/Tent an instance of that a resource that represents a category or class category or class of things 2Linked Data & Semantic Web Technology
  3. 3. Abbreviation for Describing Typed Nodes • How to describe abbreviation for typed nodes – the rdf:type property and its value are removed – the rdf:Description element is replaced by an element whose name is the QName corresponding to the value of the removed rdf:type property 1. <rdf:Description rdf:ID="item10245"> 2. <rdf:type rdf:resource="http://www.example.com/terms/Tent"/> 3. </rdf:Description> replaced 1. <exterms:Tent rdf:ID="item10245" /> rdf:type http://www.example.com/2002/04/products#item10245 http://www.example.com/terms/Tent 3Linked Data & Semantic Web Technology
  4. 4. How to Describe Groups • a need to describe groups of things – such as, • a book was created by several authors • to list the students in a course • Vocabularies for groups – RDF Containers • groups containing the members • open list – RDF Collections • groups containing only the specified members • closed list 4Linked Data & Semantic Web Technology
  5. 5. RDF Containers • RDF Containers – to describe groups containing the members • Terms – Container • a resource that contains things – Member • the contained things • resources (including blank nodes) or literals • Three types of RDf Containers – rdf:Bag – rdf:Seq – rdf:Alt 5Linked Data & Semantic Web Technology
  6. 6. RDF Containers • Bag – a resource having type rdf:Bag – a group of resources or literals, possibly including duplicate members – no significance in the order of the members • Sequence – a resource having type rdf:Seq – a group of resources or literals, possibly including duplicate members – the order of the members is significant • Alternative – a resource having type rdf:Alt – a group of resources or literals that are alternatives (typically for a single value of a property) 6Linked Data & Semantic Web Technology
  7. 7. How to Describe a Resource of Containers • to give an rdf:type property whose value is one of the predefined resources rdf:Bag, rdf:Seq, or rdf:Alt • to describe each member (item) with the container resource: – in RDF Graph • using a container membership property rdf:_n, where n is a decimal integer greater than one – in RDF/XML • using the rdf:li property 7Linked Data & Semantic Web Technology
  8. 8. Bag Container Description “Course 6.001 has the students Amy, Mohamed, Johann, Maria, and Phuong” <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/students/vocab#"> <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:RDF> 8Linked Data & Semantic Web Technology
  9. 9. Alt Container Description “The source code for X11 may be found at ftp.example.org, ftp1.example.org, or ftp2.example.org” <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/packages/vocab#"> <rdf:Description rdf:about="http://example.org/packages/X11"> <s:DistributionSite> <rdf:Alt> <rdf:li rdf:resource="ftp://ftp.example.org"/> <rdf:li rdf:resource="ftp://ftp1.example.org"/> <rdf:li rdf:resource="ftp://ftp2.example.org"/> </rdf:Alt> </s:DistributionSite> </rdf:Description> </rdf:RDF> 9Linked Data & Semantic Web Technology
  10. 10. Seq Container Description “Schedules of Monday” <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://www.reminders.org#"> <rdf:Description rdf:about="http://www.reminders.org#MondayMeetings"> <s:activities> <rdf:Seq> <rdf:li>Meet with CEO at 10am</rdf:li> <rdf:li>Luncheon at The Eatery</rdf:li> <rdf:li>Flight at 3pm</rdf:li> </rdf:Seq> </s:activities> </rdf:Description> </rdf:RDF> 10Linked Data & Semantic Web Technology
  11. 11. RDF Collections • A limitation of the containers – no way to close resources • such as, "these are all the members of the container“ – no way to exclude the possibility that there is another graph somewhere that describes additional members • RDF Collections – for describing groups containing only the specified members – a group of things represented as a list structure in the RDF graph 11Linked Data & Semantic Web Technology
  12. 12. How to Describe a RDF Collection • to be constructed using a predefined collection vocabulary – the predefined type rdf:List – the predefined properties rdf:first and rdf:rest – and the predefined resource rdf:nil "The students in course 6.001 are Amy, Mohamed, and Johann" 12Linked Data & Semantic Web Technology
  13. 13. How to Describe RDF/XML for a Collection • rdf:parseType attribute – to indicate that the contents of an element are to be interpreted in a special way • rdf:parseType="Collection" attribute – a group of nested elements representing the members of the collection <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/students/vocab#"> <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:RDF> 13Linked Data & Semantic Web Technology
  14. 14. RDF Reification • What is RDF Reifications? – to describe other RDF statements using RDF – such as, • to record information about when statements were made, who made them, or other similar information Obama says Northern Ireland requires urgent work. 14Linked Data & Semantic Web Technology
  15. 15. Reification Quad • description of a statement, reification – the type rdf:Statement – the properties rdf:subject, rdf:predicate, and rdf:object “Obama says Northern Ireland requires urgent work.” ex:triple12345 rdf:type rdf:Statement . ex:triple12345 rdf:subject ex:NorthernIreland . ex:triple12345 rdf:predicate ex:require . ex:triple12345 rdf:object ex:UrgentWork . 15Linked Data & Semantic Web Technology
  16. 16. RDF/XML for RDF Reification • “Obama says Northern Ireland requires urgent work.” <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://www.example.com/"> <rdf:Description rdf:about="http://www.example.com/Obama"> <ex:say> <rdf:Statement> <rdf:subject rdf:resource="http://www.example.com/NorthenIreland"/> <rdf:predicate rdf:resource="http://www.example.com/require"/> <rdf:object rdf:resource="http://www.example.com/UrgentWork"/> </rdf:Statement> </ex:say> </rdf:Description> </rdf:RDF> 16Linked Data & Semantic Web Technology
  17. 17. Notes for RDF Reification • Why we need RDF Reification? – Modeling Data Provenance – Formalizing Statements about Reliability (Trust) – Definition of Metadata about Statements • the conventional use of reification – do not imagine that the vocabulary defines some things that are not actually defined 17Linked Data & Semantic Web Technology
  18. 18. Structured Values This is the decimal value of weight property using typed literal. exproduct:item10245 exterms:weight "2.4"^^xsd:decimal . • rdf:value Property – to describe the main value (if there is one) of a structured value • How to add an indication of the unit of measure (kilograms) exproduct:item10245 exterms:weight _:weight10245 . _:weight10245 rdf:value "2.4"^^xsd:decimal . _:weight10245 exterms:units exunits:kilograms . 18Linked Data & Semantic Web Technology
  19. 19. RDF/XML for Structured Value exproduct:item10245 exterms:weight _:weight10245 . _:weight10245 rdf:value "2.4"^^xsd:decimal . _:weight10245 exterms:units exunits:kilograms . <?xml version="1.0"?> <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:exterms="http://www.example.org/terms/"> <rdf:Description rdf:about="http://www.example.com/2002/04/products#item10245"> <exterms:weight rdf:parseType="Resource"> <rdf:value rdf:datatype="&xsd;decimal">2.4</rdf:value> <exterms:units rdf:resource="http://www.example.org/units/kilograms"/> </exterms:weight> </rdf:Description> </rdf:RDF> • rdf:parseType=“Resource” attribute – to indicate that the contents of an element are to be interpreted as the description of a new (blank node) resource, without a nested rdf:Description element 19Linked Data & Semantic Web Technology
  20. 20. XML Literal • rdf:parseType=“Literal” attribute – to indicate that the contents of the element are to be interpreted as an XML fragment <?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/" xml:base="http://www.example.com/books"> <rdf:Description rdf:ID="book12345"> <dc:title rdf:parseType="Literal"> <span xml:lang="en"> The <em>&lt;br /&gt;</em> Element Considered Harmful. </span> </dc:title> </rdf:Description> </rdf:RDF> 20Linked Data & Semantic Web Technology
  21. 21. RDF Serialization • N-Triples – RDF Test Cases, W3C Recommendation, 10 February 2004 – a line-based, plain text serialization format for storing and transmitting RDF data • Notation 3 (N3) – a shorthand non-XML serialization of RDF models, designed with human- readability in mind – much more compact and readable than XML RDF notation • Turtle (Terse RDF Triple Language) – W3C Candidate Recommendation, 19 February 2013 – a format for expressing data in the Resource Description Framework (RDF) data model – a subset of Notation3 (N3) language, and a superset of the minimal N-Triples format • RDF/XML – W3C Recommendation, 10 February 2004 – an XML syntax for writing down and exchanging RDF graphs 21Linked Data & Semantic Web Technology
  22. 22. N-Triple <http://en.wikipedia.org/wiki/Tony_Benn> <http://purl.org/dc/elements/1.1/title> "Tony Benn" . <http://en.wikipedia.org/wiki/Tony_Benn> <http://purl.org/dc/elements/1.1/publisher> "Wikipedia" . N3 @prefix dc: <http://purl.org/dc/elements/1.1/>. <http://en.wikipedia.org/wiki/Tony_Benn> dc:title "Tony Benn"; dc:publisher "Wikipedia". RDF/XML <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 rdf:about="http://en.wikipedia.org/wiki/Tony_Benn"> <dc:title>Tony Benn</dc:title> <dc:publisher>Wikipedia</dc:publisher> </rdf:Description> </rdf:RDF> Turtle @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix ex: <http://example.org/stuff/1.0/> . <http://www.w3.org/TR/rdf-syntax-grammar> dc:title "RDF/XML Syntax Specification (Revised)" ; ex:editor [ ex:fullname "Dave Beckett", "Dave R. Beckett"; ex:homePage <http://purl.org/net/dajobe/> ] . 22Linked Data & Semantic Web Technology
  23. 23. References • http://www.w3.org/TR/2004/REC-rdf-primer-20040210/ • http://www.slideshare.net/lysander07/openhpi-24 • http://www.slideshare.net/lysander07/openhpi-25 • http://www.slideshare.net/onlyjiny/linkeddata • http://en.wikipedia.org/wiki/N-Triples • http://en.wikipedia.org/wiki/Notation3 • http://en.wikipedia.org/wiki/Turtle_(syntax) 23Linked Data & Semantic Web Technology
  24. 24. Dr. Myungjin Lee e-Mail : mjlee@li-st.com Twitter : http://twitter.com/MyungjinLee Facebook : http://www.facebook.com/mjinlee SlideShare : http://www.slideshare.net/onlyjiny/ 24 24Linked Data & Semantic Web Technology

×