61
RDF: Resource Description Framework Jianguo Lu University of Windsor

RDF: Resource Description Framework

  • Upload
    talmai

  • View
    78

  • Download
    5

Embed Size (px)

DESCRIPTION

RDF: Resource Description Framework. Jianguo Lu University of Windsor. Contents. Ontology Syntax of RDF and RDFS Axiomatic Semantics for RDF and RDFS Applications of RDF and RDFS Querying of RDF/RDFS Documents using RQL. Web Today. [Hendler & Miller 02]. The semantic web. Ontology. - PowerPoint PPT Presentation

Citation preview

Page 1: RDF: Resource Description Framework

RDF: Resource Description Framework

Jianguo Lu University of Windsor

Page 2: RDF: Resource Description Framework

2

Contents

• Ontology• Syntax of RDF and RDFS• Axiomatic Semantics for RDF and RDFS• Applications of RDF and RDFS

– Querying of RDF/RDFS Documents using RQL

Page 3: RDF: Resource Description Framework

3

Web Today

[Hendler & Miller 02]

Page 4: RDF: Resource Description Framework

4

The semantic web

Page 5: RDF: Resource Description Framework

5

Ontology

• Long history coming from Philosophy, introduced by Aristotle

– “a branch of metaphysics concerned with the nature and relations of being” --Webster

• Picked up by the Artificial Intelligence– “For AI systems, what ‘exists’ is that which can be represented”

– “a shared and common understanding of some domain that can be communicated between people and application systems” – Gruber

Page 6: RDF: Resource Description Framework

6

What is Ontology

• An ontology is a formal, explicit specification of a shared conceptualization - Gruber– Conceptualization refers to an abstract model of phenomena.– Explicit means that the type of concepts used, and the

constraints on their use are explicitly defined. – Formal refers to the fact that the ontology should be machine

readable. – Shared reflects that ontology should capture consensual

knowledge accepted by the communities.

Page 7: RDF: Resource Description Framework

7

Main components of an Ontology

• Classes: concepts of the domain or tasks, which are usually organized in taxonomies– in a university ontology, student and professor are two classes

• Relations: a type of interaction between concepts of the domain– such as: subclass-of, is-a

• Axioms: model sentences that are always true– such as: if the student attends both A and B course, then he or she must be

a second year student

• Instances: to represent specific elements– such as: a student called Peter is the instance of Student class

Page 8: RDF: Resource Description Framework

8

Contents• Ontology• Syntax of RDF and RDFS• Semantics• Applications

Page 9: RDF: Resource Description Framework

9

RDF is a Web Standard

• RDF Model and Syntax Specification became a W3C (World Wide Web Consortium) Recommendation in February 1999.– It has a long history, considering that XML became W3C

Recommendation in 1998.

• The purpose of RDF (Resource Description Framework) is to give a standard way of specifying data "about" something.

Page 10: RDF: Resource Description Framework

10

XML vs. RDF<company>

<treatmentOffered>Physiotherapy</treatmentOffered><companyName>Agilitas Physiotherapy Centre </companyName><staff>

<therapist>Lisa Davenport</therapist><therapist>Steve Matthews</therapist><secretary>Kelly Townsend</secretary>

</staff> … …</company>

• How to answer the query “give me the list of staff members in this company”?

• XML provides semantic information as a by-product of defining the structure of the document

• XML prescribes a tree structure for documents and the different leaves of the tree have a well-defined tag and context the information can be understood with.

• That is, structure and semantics of documents are interwoven– there is no intended meaning associated with the nesting of tags– It is up to each application to interpret the nesting.

Page 11: RDF: Resource Description Framework

11

RDF and RDF Schema

Lisa therapistisA

staff

therapist

subClassOf

secretary

subClassOf

How to encode the rule that “a person can not be a secretary and therapist at the same time”?

• RDF

• RDF Schema

Page 12: RDF: Resource Description Framework

12

OWL (Web Ontology Language)

Lisa therapistisA

secretaryisA

staff

therapist

subClassOf

secretary

Disjoint (therapist, secretary)

RDF

OWL

RDFS

Page 13: RDF: Resource Description Framework

13

Basic Ideas of RDF• David Billington is a lecturer of Discrete Maths

<course name="Discrete Maths"><lecturer>David Billington</lecturer>

</course>

<lecturer name="David Billington"><teaches>Discrete Maths</teaches>

</lecturer>– Opposite nesting, same information!

• Basic building block of rdf: subject-predicate-object triple– It is called a statement;– Sentence about Billington is such a statement;

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mydomain="http://www.mydomain.org/my-rdf-ns#">

<rdf:Description rdf:about="http://www.cit.gu.edu.au/DiscreteMath"> <mydomain:taughtBy> David Billington </mydomain:taughtBy>

</rdf:Description></rdf:RDF>

Page 14: RDF: Resource Description Framework

14

Statements

• Statements assert the properties of resources• A statement is an resource-property-value triple

– Sometimes also called subject, predicate, and value

• Values can be resources or literals – Literals are atomic values (strings)

Subject Objectpredicate

Resource Valueproperty

Equivalent!

Page 15: RDF: Resource Description Framework

15

Resource in a statement• We can think of a resource as a “thing” we want to talk

about– E.g. authors, books, publishers, places, people, hotels;– Every resource has a URI, a Universal Resource Identifier;– A URI can be

• a URL (Web address), or • some other kind of unique identifier.

– In the following example, “http://www.cit.gu.edu.au/DiscreteMath” is a resource that we want to talk about.

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mydomain="http://www.mydomain.org/my-rdf-ns#">

<rdf:Description rdf:about="http://www.cit.gu.edu.au/DiscreteMath"> <mydomain:taughtBy> David Billington

</mydomain:taughtBy></rdf:Description>

</rdf:RDF>

Page 16: RDF: Resource Description Framework

16

Properties

• Properties are a special kind of resources• They describe relations between resources

– E.g. “taught by”, “written by”, “age”, “title”, etc.;– Properties are also identified by URIs.

• Advantages of using URIs:– Α global, worldwide, unique naming scheme;– Reduces the homonym problem of distributed data

representation.

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mydomain="http://www.mydomain.org/my-rdf-ns#"> <rdf:Description rdf:about="http://www.cit.gu.edu.au/DiscreteMath"> <mydomain:taughtBy> David Billington </mydomain:taughtBy> </rdf:Description></rdf:RDF>

Page 17: RDF: Resource Description Framework

17

Three Views of a Statement

• A triple• A piece of a graph• A piece of XML code

• Thus an RDF document can be viewed as:– A set of triples;– A graph (semantic net);– An XML document.

Page 18: RDF: Resource Description Framework

18

RDF Example

• The statement:http://www.example.org/index.html has a creation-date whose value is August 16, 1999

<?xml version="1.0"?> <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.org/index.html"> <exterms:creation-date>August 16, 1999</exterms:creation-date>

</rdf:Description> </rdf:RDF>

Page 19: RDF: Resource Description Framework

19

Several statements about the same resource

Page 20: RDF: Resource Description Framework

20

Its XML representation

• A complete representation<rdf:Description rdf:about="http://www.example.org/index.html">

<exterms:creation-date>August 16, 1999</exterms:creation-date>

</rdf:Description>

<rdf:Description rdf:about="http://www.example.org/index.html"> <dc:language>en</dc:language>

</rdf:Description>

<rdf:Description rdf:about="http://www.example.org/index.html"> <dc:creator rdf:resource="http://www.example.org/staffid/85740"/>

</rdf:Description>

• An abbreviation<rdf:Description rdf:about="http://www.example.org/index.html">

<exterms:creation-date> August 16, 1999 </exterms:creation-date>

<dc:language> en </dc:language>

<dc:creator rdf:resource="http://www.example.org/staffid/85740"/>

</rdf:Description>

Page 21: RDF: Resource Description Framework

21

Two different kinds of nodes

• Nodes that are URIrefs are shown as ellipses • Nodes that are literals are shown as boxes

• Using URIref to identify resource and property

Page 22: RDF: Resource Description Framework

22

Structured Property Values and Blank Nodes

Problem with this approach: may generate many intermediate URIRefs.

Page 23: RDF: Resource Description Framework

23

Blank Node

Page 24: RDF: Resource Description Framework

24

Blank node or anonymous resource

Page 25: RDF: Resource Description Framework

25

Corresponding RDF/XML

<?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/”xmlns:exterms="http://example.org/stuff/1.0/">

<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"> <dc:title>RDF/XML Syntax Specification (Revised)</dc:title> <exterms:editor rdf:nodeID="abc"/> </rdf:Description>

<rdf:Description rdf:nodeID="abc"> <exterms:fullName>Dave Beckett</exterms:fullName><exterms:homePage rdf:resource="http://purl.org/net/dajobe/"/>

</rdf:Description>

</rdf:RDF>

Page 26: RDF: Resource Description Framework

26

Typed literals

• 27 is an integer or a string?

Page 27: RDF: Resource Description Framework

27

A Typed Literal for a Web Page's Creation Date

<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.org/index.html"> <exterms:creation-date rdf:datatype="&xsd;date">1999-08-16 </exterms:creation-date> </rdf:Description>

</rdf:RDF>

Page 28: RDF: Resource Description Framework

28

An Invalid Typed Literal for John Smith's Age

Page 29: RDF: Resource Description Framework

29

RDF Containers

• Container is a resource to contain things• RDF defines three types of containers:

– Bag: contains an unordered list of value elements– Seq: contains an ordered list of value elements– Alt: contains a list of alternative values for an element:

Page 30: RDF: Resource Description Framework

30

Bag

Page 31: RDF: Resource Description Framework

31

Bag (cont.)

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

Page 32: RDF: Resource Description Framework

32

Alt container

Page 33: RDF: Resource Description Framework

33

Alt container (cont.)

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

Page 34: RDF: Resource Description Framework

34

RDF Collection

• A container only says that certain resources are members

• Id does not say that other members do not exist

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

Page 35: RDF: Resource Description Framework

35

RDF Reification

• In RDF it is possible to make statements about statements– Grigoris believes that David Billington is the creator of

http://www.cit.gu.edu.au/~db

• Such statements can be used to describe belief or trust in other statements

• The solution is to assign a unique identifier to each statement– It can be used to refer to the statement

• Introduce an auxiliary object (e.g. belief1) • relate it to each of the 3 parts of the original statement

through the properties subject, predicate and object• In the preceding example

– subject of belief1 is David Billington

– predicate of belief1 is creator

– object of belief1 is http://www.cit.gu.edu.au/~db

Page 36: RDF: Resource Description Framework

36

Reification example

Page 37: RDF: Resource Description Framework

37

Reification in XML<?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:dc=“http://purl.org/dc/elements/1.1/” xmlns:exterms=“http://www.example.com/terms/” xml:base="http://www.example.com/2002/04/products">

<rdf:Description rdf:ID="item10245"> <exterms:weight rdf:datatype="&xsd;decimal">2.4</exterms:weight>

</rdf:Description>

<rdf:Statement rdf:about="#triple12345"> <rdf:subject rdf:resource="http://www.example.com/2002/04/products#item10245"/><rdf:predicate rdf:resource="http://www.example.com/terms/weight"/><rdf:object rdf:datatype="&xsd;decimal">2.4</rdf:object> <dc:creator rdf:resource="http://www.example.com/staffid/85740"/>

</rdf:Statement> </rdf:RDF>

Page 38: RDF: Resource Description Framework

38

rdf:about vs rdf:ID

• An element rdf:Description has– an rdf:about attribute indicating that the resource has been

“defined” elsewhere– An rdf:ID attribute indicating that the resource is defined

• Formally, there is no such thing as “defining” an object in one place and referring to it elsewhere – Sometimes it is useful (for human readability) to have a defining

location, while other locations state “additional” properties.

Page 39: RDF: Resource Description Framework

39

Connecting two resources

<rdf:Description rdf:about="CIT1111">

<uni:courseName>Discrete Mathematics</uni:courseName>

<uni:isTaughtBy rdf:resource="949318"/>

</rdf:Description>

<rdf:Description rdf:about="949318">

<uni:name>David Billington</uni:name>

<uni:title>Associate Professor</uni:title>

</rdf:Description>

Page 40: RDF: Resource Description Framework

40

Nested description

<rdf:Description rdf:about="CIT1111"><uni:courseName>Discrete Maths</uni:courseName><uni:isTaughtBy>

<rdf:Description rdf:ID="949318"><uni:name>David Billington</uni:name><uni:title>Associate Professor</uni:title>

</rdf:Description></uni:isTaughtBy>

</rdf:Description> <?xml version="1.0"?><Resource-A> <property-A> <Resource-B> <property-B> <Resource-C> <property-C> Value-C </property-C> </Resource-C> </property-B> </Resource-B> </property-A></Resource-A>

value of property-A

value of property-B

Page 41: RDF: Resource Description Framework

41

Introducing some Structure to RDF Documents using the rdf:type Element• What does the following RDF describe? Not very

straightforward. <rdf:Description rdf:ID="CIT1111">

<uni:courseName>Discrete Maths</uni:courseName><uni:isTaughtBy rdf:resource="#949318"/>

</rdf:Description>

• Add type declaration<rdf:Description rdf:ID="CIT1111">

<rdf:type rdf:resource="http://www.mydomain.org/uni-ns#course"/><uni:courseName>Discrete Maths</uni:courseName><uni:isTaughtBy rdf:resource="#949318"/>

</rdf:Description>

• An equivalent, more concise notation<uni:course rdf:ID="CIT1111">

<uni:courseName>Discrete Maths</uni:courseName><uni:isTaughtBy rdf:resource="#949318"/>

</rdf:Description>

Page 42: RDF: Resource Description Framework

42

Equivalent Representations<River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#" xml:base="http://www.china.org/geography/rivers"> <length>6300 kilometers</length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

<River rdf:about="http://www.china.org/geography/rivers#Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#"> <length>6300 kilometers</length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

<rdf:Description rdf:about="http://www.china.org/geography/rivers#Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#"> <rdf:type rdf:resource="http://www.geodesy.org/river#River"/> <length>6300 kilometers</length> <startingLocation>western China's Qinghai-Tibet Plateau </startingLocation> <endingLocation>East China Sea</endingLocation></rdf:Description>

Note: In the RDF literature the examplesare typically shown in this form.

From Costello

Page 43: RDF: Resource Description Framework

43

Resource URI

= concatenation(xml:base, '#', rdf:ID)

= concatenation(http://www.china.org/geography/rivers, '#', "Yangtze")

= http://www.china.org/geography/rivers#Yangtze

Page 44: RDF: Resource Description Framework

44

<?xml version="1.0"?><River id="Yangtze" xmlns="http://www.geodesy.org/river" xmlns:uom="http://www.measurements.org/units-of-measure#"> <length uom:units="kilometers">6300</length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

RDF does not allow attributes on the properties (except for special RDFattributes such as rdf:resource). So we need to make the uom:units attributea child element.Your first instinct might be to modify length to have two child elements:

<?xml version="1.0"?><River id="Yangtze" xmlns="http://www.geodesy.org/river" xmlns:uom="http://www.measurements.org/units-of-measure#"> <length> <value>6300</value> <uom:units>kilometers</uom:units> </length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

However, nowthe lengthproperty hasas its value twovalues.RDF allows only binary relationsi.e., a single value for aproperty.

Describe a property that has more than one value

From Costello

Page 45: RDF: Resource Description Framework

45

Rdf:value

• length has two values - 6300 and kilometers.• RDF provides a special property, rdf:value, to be used for

specifying the "primary" value.– 6300 is the primary value– kilometers is a value which provides additional information about the

primary value.

length6300

kilometers

From Costello

Page 46: RDF: Resource Description Framework

46

Anonymous resource

<?xml version="1.0"?><River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#" xmlns:uom="http://www.measurements.org/units-of-measure#"> <length> <rdf:Description> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units> </rdf:Description> </length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

An anonymousresource

From Costello

Page 47: RDF: Resource Description Framework

47

rdf:parseType="Resource"

<?xml version="1.0"?><River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#" xmlns:uom="http://www.measurements.org/units-of-measure#"> <length rdf:parseType="Resource"> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units> </length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

If the value of a property is comprised of several values then one option is to create an anonymous resource, as we saw. RDF provides a shorthand,so that you don't need to create an rdf:Description element, by using rdf:parseType="Resource", as shown here:

From Costello

Page 48: RDF: Resource Description Framework

48

Equivalent

<length> <rdf:Description> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units> </rdf:Description></length>

<length rdf:parseType="Resource"> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units></length>

Page 49: RDF: Resource Description Framework

49

Exercise

Modify the following XML document so that it is also a valid RDF document:

<?xml version="1.0"?><River id="Yangtze" xmlns="http://www.geodesy.org/river" xmlns:uom="http://www.measurements.org/units-of-measure#"> <length uom:units="kilometers">6300</length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation> <Dam id="ThreeGorges" xmlns="http://www.geodesy.org/dam"> <name>The Three Gorges Dam</name> <width>1.5 miles</width> <height>610 feet</height> <cost>$30 billion</cost> </Dam></River>

Page 50: RDF: Resource Description Framework

50

Answer<?xml version="1.0"?><River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#" xmlns:uom="http://www.measurements.org/units-of-measure#" xml:base="http://www.china.org/geography/rivers"> <length rdf:parseType="Resource"> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units> </length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation> <obstacle> <Dam rdf:ID="ThreeGorges" xmlns="http://www.geodesy.org/dam#"> <name>The Three Gorges Dam</name> <width>1.5 miles</width> <height>610 feet</height> <cost>$30 billion</cost> </Dam> </obstacle></River>

Page 51: RDF: Resource Description Framework

51

Exercise 2

<?xml version="1.0"?><Meeting id="XML-Design-Patterns" xmlns="http://www.business.org"> <attendees> <name>John Smith</name> <name>Sally Jones</name> </attendees></Meeting>

Modify the following XML document so that it is also a valid RDF document:

rdf:Bag makes it clear that this is an unorderedcollection of names.

<?xml version="1.0"?><Meeting rdf:ID="XML-Design-Pattern" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.business.org#"> <attendees> <rdf:Bag> <name>John Smith</name> <name>Sally Jones</name> </rdf:Bag> </attendees></Meeting>

Page 52: RDF: Resource Description Framework

52

Exercise 3

Modify the following XML document so that it is also a valid RDF document:

<?xml version="1.0"?><Catalogue xmlns="http://www.publishing.org#" xmlns:dc="http://pur1.org/metadata/dublin-core#"> <Book> <dc:Title>Lateral Thinking</dc:Title> <dc:Creator>Edward de Bono</dc:Creator> <dc:Date>1973</dc:Date> <ISBN>0-06-099325-2</ISBN> <dc:Publisher>Harper &amp; Row</dc:Publisher> </Book> <Book> <dc:Title>Illusions: The Adventures of a Reluctant Messiah</dc:Title> <dc:Creator>Richard Bach</dc:Creator> <dc:Date>1977</dc:Date> <ISBN>0-440-34319-4</ISBN> <dc:Publisher>Dell Publishing Co.</dc:Publisher> </Book> <Book> <dc:Title>The First and Last Freedom</dc:Title> <dc:Creator>J. Krishnamurti</dc:Creator> <dc:Date>1954</dc:Date> <ISBN>0-06-064831-7</ISBN> <dc:Publisher>Harper &amp; Row</dc:Publisher> </Book></Catalogue>

Page 53: RDF: Resource Description Framework

53

Modification 1: identifiers are added<?xml version="1.0"?><Catalogue id="BookCatalogue" xmlns="http://www.publishing.org#" xmlns:dc="http://pur1.org/metadata/dublin-core#"> <Book id="_0-06-099325-2"> <dc:Title>Lateral Thinking</dc:Title> <dc:Creator>Edward de Bono</dc:Creator> <dc:Date>1973</dc:Date> <dc:Publisher>Harper &amp; Row</dc:Publisher> </Book> <Book id="_0-440-34319-4"> <dc:Title>Illusions: The Adventures of a Reluctant Messiah</dc:Title> <dc:Creator>Richard Bach</dc:Creator> <dc:Date>1977</dc:Date> <dc:Publisher>Dell Publishing Co.</dc:Publisher> </Book> <Book id="_0-06-064831-7"> <dc:Title>The First and Last Freedom</dc:Title> <dc:Creator>J. Krishnamurti</dc:Creator> <dc:Date>1954</dc:Date> <dc:Publisher>Harper &amp; Row</dc:Publisher> </Book></Catalogue>

Notice that the ISBN elements were deleted and their values used as identifiers.

Why was an underscoreplaced in front of theISBN?Answer: The ID datatypedoes not allow an identifier to begin witha digit. So, we (arbitrarily) decided touse an underscore.

Page 54: RDF: Resource Description Framework

54

The RDF document<?xml version="1.0"?><Catalogue rdf:ID="BookCatalogue" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.publishing.org#" xmlns:dc="http://pur1.org/metadata/dublin-core#" xml:base="http://www.bn.com"> <item> <Book rdf:ID="_0-06-099325-2" xml:base="http://www.publishing.org/book"> <dc:Title>Lateral Thinking</dc:Title> <dc:Creator>Edward de Bono</dc:Creator> <dc:Date>1973</dc:Date> <dc:Publisher>Harper &amp; Row</dc:Publisher> </Book> </item> <item> <Book rdf:ID="_0-440-34319-4" xml:base="http://www.publishing.org/book"> <dc:Title>Illusions: The Adventures of a Reluctant Messiah</dc:Title> <dc:Creator>Richard Bach</dc:Creator> <dc:Date>1977</dc:Date> <dc:Publisher>Dell Publishing Co.</dc:Publisher> </Book> </item> ...</Catalogue>

Page 55: RDF: Resource Description Framework

55

Exercise 4: Draw the graph representation of the following rdf

<?xml version="1.0"?><River rdf:about="http://www.china.org/geography/rivers#Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#"> <length>6300 kilometers</length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

Page 56: RDF: Resource Description Framework

56

RDF and relational database

Title Artist Country Company Price Year

Empire Burlesque Bob Dylan USA Columbia 10.90 1985

Hide your heart Bonnie Tyler UK CBS Records 9.90 1988

...

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

Page 57: RDF: Resource Description Framework

57

Properties as Attributes

• Properties can also be expressed as attributes (instead of elements):

<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:country="USA"

cd:company="Columbia" cd:price="10.90"

cd:year="1985" />

</rdf:RDF>

• In the example above, the properties (artist, country, company, price, and year) are expressed as attributes instead of elements.

Page 58: RDF: Resource Description Framework

58

A Critical View of RDF

• RDF uses only binary properties– This is a restriction because often we use predicates with more than 2

arguments

– But binary predicates can simulate these

• Example: referee(X,Y,Z) – X is the referee in a chess game between players Y and Z

• We introduce:– a new auxiliary resource chessGame

– the binary predicates ref, player1, and player2

• We can represent referee(X,Y,Z) as:

Page 59: RDF: Resource Description Framework

59

RDF Parser

• There is a nice RDF parser at the W3 Web site:– http://www.w3.org/RDF/Validator

• This RDF parser will tell you if your XML is in the proper RDF format.

• Altova semanticworks support RDF, RDFS, and OWL.

Page 60: RDF: Resource Description Framework

60

<River rdf:about="http://www.china.org/geography/rivers#Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#"> <length>6300 kilometers</length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

<River rdf:about="http://www.china.org/geography/rivers#Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#"> <name>Dri Chu - Female Yak River</name> <name>Tongtian He, Travelling-Through-the-Heavens River</name> <name>Jinsha Jiang, River of Golden Sand</name> </River>

<River rdf:about="http://www.china.org/geography/rivers#Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#"> <length>6300 kilometers</length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation> <name>Dri Chu - Female Yak River</name> <name>Tongtian He, Travelling-Through-the-Heavens River</name> <name>Jinsha Jiang, River of Golden Sand</name> </River>

Aggregated Data!

Aggregator tool collectsdata about the Yangtze

A distributed network of data!

http://www.china.org/geography/rivers/yangtze.rdf

http://www.encyclopedia.org/yangtze-alternate-names.rdf

Page 61: RDF: Resource Description Framework

61

Anonymous resources can’t be aggregated<?xml version="1.0"?><River xmlns="http://www.geodesy.org/river#"> <name>Yangtze</name> <length>6300 kilometers</length> <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation> <endingLocation>East China Sea</endingLocation></River>

http://www.china.org/geography/rivers/yangtze.rdf

<?xml version="1.0"?><River xmlns="http://www.geodesy.org/river#"> <name>Yangtze</name> <name>Dri Chu - Female Yak River</name> <name>Tongtian He, Travelling-Through-the-Heavens River</name> <name>Jinsha Jiang, River of Golden Sand</name> </River>

http://www.encyclopedia.org/yangtze-alternate-names.rdf

An aggregator tool will not be able to determine if these documents are talking about the same resource.

Aggregate