the semantic web #5 - rdf (2)

24
Linked Data & Semantic Web Technology The Semantic Web Part 5. Resource Description Framework (2) Dr. Myungjin Lee

Upload: myungjin-lee

Post on 17-Nov-2014

747 views

Category:

Documents


0 download

DESCRIPTION

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

TRANSCRIPT

Page 1: The Semantic Web #5 - RDF (2)

Linked Data &Semantic WebTechnology

The Semantic WebPart 5. Resource Description Framework (2)

Dr. Myungjin Lee

Page 2: The Semantic Web #5 - RDF (2)

2Linked Data & Semantic Web Technology

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>

http://www.example.com/2002/04/products#item10245rdf:type

http://www.example.com/terms/Tent

a resource that represents a category or class of things

an instance of that category or class

Page 3: The Semantic Web #5 - RDF (2)

3Linked Data & Semantic Web Technology

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>

1. <exterms:Tent rdf:ID="item10245" />

replaced

http://www.example.com/2002/04/products#item10245rdf:type

http://www.example.com/terms/Tent

Page 4: The Semantic Web #5 - RDF (2)

4Linked Data & Semantic Web Technology

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

Page 5: The Semantic Web #5 - RDF (2)

5Linked Data & Semantic Web Technology

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

Page 6: The Semantic Web #5 - RDF (2)

6Linked Data & Semantic Web Technology

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)

Page 7: The Semantic Web #5 - RDF (2)

7Linked Data & Semantic Web Technology

How to Describe a Resource of Contain-ers• to give an rdf:type property whose value is one of the prede-

fined 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 inte-ger greater than one

– in RDF/XML• using the rdf:li property

Page 8: The Semantic Web #5 - RDF (2)

8Linked Data & Semantic Web Technology

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>

Page 9: The Semantic Web #5 - RDF (2)

9Linked Data & Semantic Web Technology

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>

Page 10: The Semantic Web #5 - RDF (2)

10Linked Data & Semantic Web Technology

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>

Page 11: The Semantic Web #5 - RDF (2)

11Linked Data & Semantic Web Technology

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

Page 12: The Semantic Web #5 - RDF (2)

12Linked Data & Semantic Web Technology

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"

Page 13: The Semantic Web #5 - RDF (2)

13Linked Data & Semantic Web Technology

How to Describe RDF/XML for a Collec-tion• 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>

Page 14: The Semantic Web #5 - RDF (2)

14Linked Data & Semantic Web Technology

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 saysNorthern Ireland requires urgent work.

Page 15: The Semantic Web #5 - RDF (2)

15Linked Data & Semantic Web Technology

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 .

Page 16: The Semantic Web #5 - RDF (2)

16Linked Data & Semantic Web Technology

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>

Page 17: The Semantic Web #5 - RDF (2)

17Linked Data & Semantic Web Technology

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 actu-

ally defined

Page 18: The Semantic Web #5 - RDF (2)

18Linked Data & Semantic Web Technology

Structured Values

• 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 "2.4"^^xsd:decimal .

This is the decimal value of weight property using typed literal.

exproduct:item10245 exterms:weight _:weight10245 ._:weight10245 rdf:value "2.4"^^xsd:decimal ._:weight10245 exterms:units exunits:kilograms .

Page 19: The Semantic Web #5 - RDF (2)

19Linked Data & Semantic Web Technology

RDF/XML for Structured Value

• rdf:parseType=“Resource” attribute– to indicate that the contents of an element are to be interpreted as the descrip-

tion of a new (blank node) resource, without a nested rdf:Description el-ement

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>

Page 20: The Semantic Web #5 - RDF (2)

20Linked Data & Semantic Web Technology

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>

Page 21: The Semantic Web #5 - RDF (2)

21Linked Data & Semantic Web Technology

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

Page 22: The Semantic Web #5 - RDF (2)

22Linked Data & Semantic Web Technology

<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" .

<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>

@prefix dc: <http://purl.org/dc/elements/1.1/>.

<http://en.wikipedia.org/wiki/Tony_Benn> dc:title "Tony Benn"; dc:publisher "Wikipedia".

@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/> ] .

N-Triple

RDF/XML

N3

Turtle

Page 23: The Semantic Web #5 - RDF (2)

23Linked Data & Semantic Web Technology

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)

Page 24: The Semantic Web #5 - RDF (2)

24Linked Data & Semantic Web Technology

24

Dr. Myungjin Lee

e-Mail : [email protected] : http://twitter.com/MyungjinLee

Facebook : http://www.facebook.com/mjinlee

SlideShare : http://www.slideshare.net/onlyjiny/

Thanks foryour attention.