0% found this document useful (0 votes)
63 views52 pages

Resource Description Framework (RDF)

RDF is a framework for describing resources on the web. It uses triples consisting of a subject, predicate, and object to make statements about resources. Turtle is a syntax and format for expressing RDF data. RDF graphs can visualize the relationships between resources described in RDF through different nodes and edges. SPARQL is a query language for retrieving and manipulating data stored in RDF format.

Uploaded by

Nimish Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views52 pages

Resource Description Framework (RDF)

RDF is a framework for describing resources on the web. It uses triples consisting of a subject, predicate, and object to make statements about resources. Turtle is a syntax and format for expressing RDF data. RDF graphs can visualize the relationships between resources described in RDF through different nodes and edges. SPARQL is a query language for retrieving and manipulating data stored in RDF format.

Uploaded by

Nimish Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 52

Resource Description

Framework (RDF)
RDF
The Resource Description Framework (RDF) was
originally created to describe resources on the World Wide
Web (in particular web pages and other content), hence the
name.
There are two kinds of primitives in RDF:
Resources
Literals
URI (Uniform Resource Identifier)

• Expressions are formed by making statements (triples) of


the form (subject, predicate, object). The subject of a
statement must be a resource , the predicate must be a URI
and the object can be either kind of resource or a literal.
Literals are thus only allowed at the end of a statement
TURTLE
• Terse RDF Triple Language (Turtle) is a syntax and file
format for expressing data in the Resource Description
Framework (RDF) data model.
RDF vocabulary
RDF Schema vocabulary
Graph Visualization of the RDF Document
Statements from the FOAF Ontology

SPARQL: querying RDF sources across the Web


INTERPRETATIONS
RDF Data Model
•Resources
– A resource is a thing you talk about (can reference)
– Resources have URI’s
– RDF definitions are themselves Resources
•Properties
– Slots, define relationships to other resources or
atomic values
•Statements
– “Resource has Property with Value”
– (Values can be resources or atomic XML data)
Terminology
• As you read the RDF literature you may see the following
terminology:
– Subject: this term refers to the item that is playing the role of the
resource.
– predicate: this term refers to the item that is playing the role of
the property.
– Object: this term refers to the item that is playing the role of the
value.

predicate
Subject Object
Equivalent!
property
Resource Value
A Simple Example
A Simple Example
A Simple Example
A Simple Example
A Simple Example
Binary Predicates
TURTLE
• Terse RDF Triple Language (Turtle) is a syntax and file
format for expressing data in the Resource Description
Framework (RDF) data model.
Graph Visualization of the RDF Document
RDF vocabulary
RDF Schema vocabulary
INTERPRETATIONS
What is the Purpose of RDF?
• The purpose of RDF (Resource Description
Framework) is to give a standard way of specifying
data "about" something.
• Here's an example of an XML document that
specifies data about China's Yangtze river:
<?xml version="1.0"?>
<River id="Yangtze"
xmlns="http://www.geodesy.org/river">
<length>6300 kilometers</length>
<startingLocation>western China's Qinghai-Tibet
Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
</River>

"Here is data about the Yangtze River. It has a length of 6300 kilometers.
Its startingLocation is western China's Qinghai-Tibet Plateau. Its endingLocation
is the East China Sea."
XML --> RDF
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">
XML <length>6300 kilometers</length>
<startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
</River>
Yangtze.xml

"convert to"

<?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#">
RDF
<length>6300 kilometers</length>
<startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
</River>
Yangtze.rdf
The RDF Format
1 provides an ID attribute for identifying the resource being described.
RDF

2 ID attribute is in the RDF namespace.


The

<?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#">
<length>6300 kilometers</length>
<startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
</River>

3 the "fragment identifier symbol" to


Add
the namespace.
The RDF Format (cont.)

2
Identifies the resource being described. This
resource is an instance of River.
1Identifies the type <?xml version="1.0"?>
(class) of the <River rdf:ID="Yangtze"
resource being xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.geodesy.org/river#">
described.
<length>6300 kilometers</length>
3These are properties, <startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
or attributes, of the <endingLocation>East China Sea</endingLocation>
</River>
type (class).

4Values of the properties


rdf:ID
• The value of rdf:ID is a "relative URI".
• The "complete URI" is obtained by concatenating the URL of the XML
document with "#" and then the value of rdf:ID, e.g.,

<?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#">
<length>6300 kilometers</length>
<startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
</River>

Yangtze.rdf

Suppose that this RDF/XML document is located at this URL: http://www.china.org/geography/riv


Thus, the complete URI for this resource is:
http://www.china.org/geography/rivers#Yangtze
Namespace Convention
Question: Why was "#" placed onto the end of the namespace? E.g.,
xmlns="http://www.geodesy.org/river#"
Answer: RDF is very concerned about uniquely identifying things -
uniquely identifying the type (class) and uniquely identifying the properties.
If we concatenate the namespace with the type then we get a unique
identifier for the type, e.g.,
http://www.geodesy.org/river#River
If we concatenate the namespace with a property then we get a unique
identifier for the property, e.g.,
http://www.geodesy.org/river#length
http://www.geodesy.org/river#startingLocation

http://www.geodesy.org/river#endingLocation

Thus, the "#" symbol is simply a mechanism for separating the namespace from the type name and the property name.
xml:base
• On the previous slide we showed how the URL of the document provided the base URI.
• Depending on the location of the document is brittle: it will break if the document is
moved, or is copied to another location.
• A more robust solution is to specify the base URI in the document, e.g.,

<?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#"
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>

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


= concatenation(http://www.china.org/geography/rivers, '#', "Yangtze")
= http://www.china.org/geography/rivers#Yangtze
rdf:about
• Instead of identifying a resource with a relative URI (which
then requires a base URI to be prepended), we can give the
complete identity of a resource. However, we use rdf:about,
rather than rdf:ID, e.g.,
<?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>
RDF Model (graph)
rdf:Description + rdf:type
• There is still another way of representing the XML. This way makes it very
clear that you are describing something, and it makes it very clear what
the type (class) is of the thing you are describing:

<?xml version="1.0"?>
<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>

his is read as: "This is a Description about the resource http://www.china.org/geography/rivers#Yang


his resource is an instance of the River type (class). The http://www.china.org/geography/rivers#Yan
source has a length of 6300 kilometers, a startingLocation of western China's Qinghai-Tibet Plateau,
nd an endingLocation of the East China Sea."
Note: this form of describing a resource is called the "long form". The form we have seen
previously is an
abbreviation of this long form. An RDF Parser interprets the abbreviated form as if it were this
Alternative
• Alternatively we can use rdf:ID rather than rdf:about, as shown
here:

<?xml version="1.0"?>
<rdf:Description 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">
<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>
Equivalent Representations!
<?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#"
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>

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

<?xml version="1.0"?>
<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#">
Note: In the RDF literature the examples
<rdf:type rdf:resource="http://www.geodesy.org/river#River"/>
<length>6300 kilometers</length>
are typically shown in this form.
<startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
</rdf:Description>
The RDF Format

<?xml version="1.0"?>
<Class rdf:ID="Resource"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="uri">
<property>value</property>
<property>value</property>
...
</Class>
Note the two types (classes)

River Dam

Instance: Yangtze Instance: ThreeGorges


Properties: Properties:
length name
startingLocation width
endingLocation height
cost
Dam - out of place
<?xml version="1.0"?>
<River id="Yangtze"
xmlns="http://www.geodesy.org/river">
<length>6300 kilometers</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>
Dam

Types (classes) contain properties . Here we see the River type


containing the properties - length, startingLocation, and
endingLocation. It also shows River containing a type - Dam.
Thus, there is a Resource that contains another Resource. This
is inconsistent with RDF design pattern. (We are seeing one of
the benefits of using the RDF format - to identify
inconsistencies in an XML design.)
Property value must be a
Literal or a Resource
<length>6300 kilometers</length>

property
Value is a Literal

property <obstacle>
<Dam id="ThreeGorges"
xmlns="http://www.geodesy.org/dam">
<name>The Three Gorges Dam</name>
Value is a Resource <width>1.5 miles</width>
<height>610 feet</height>
<cost>$30 billion</cost>
</Dam>
</obstacle>
Modified XML (to make it consistent)
<?xml version="1.0"?>
<River id="Yangtze"
xmlns="http://www.geodesy.org/river">
<length>6300 kilometers</length>
<startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
<obstacle>
<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>
</obstacle>
</River>

Yangtze2,v2.xml

"The Yangtze River has an obstacle that is the ThreeGorges Dam. The Dam
has a name - The Three Gorges Dam. It has a width of 1.5 miles, a height of 610 feet,
and a cost of $30 billion."
RDF Format
<?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#"
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>
<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>

Changed id to rdf:ID
Added the '#' symbol

As always, the other representations using rdf:about and rdf:Description are available.
RDF Graph
Statements from the FOAF Ontology

SPARQL: querying RDF sources across the Web


Advantage of using the RDF Format
• You may ask: "Why should I bother designing my XML to be in the RDF
format?"
• Answer: there are numerous benefits:
– The RDF format, if widely used, will help to make XML more
interoperable:
• Tools can instantly characterize the structure, "this element is a type (class),
and here are its properties”.
• RDF promotes the use of standardized vocabularies ... standardized types
(classes) and standardized properties.
– The RDF format gives you a structured approach to designing your XML
documents. The RDF format is a regular, recurring pattern.
– It enables you to quickly identify weaknesses and inconsistencies of non-
RDF-compliant XML designs. It helps you to better understand your data!
– You reap the benefits of both worlds:
• You can use standard XML editors and validators to create, edit, and validate
your XML.
• You can use the RDF tools to apply inferencing to the data.
– It positions your data for the Semantic Web!
Disadvantage of using the
RDF Format
• Constrained: the RDF format constrains you on how
you design your XML (i.e., you can't design your XML
in any arbitrary fashion).
• RDF uses namespaces to uniquely identify types
(classes), properties, and resources. Thus, you must
have a solid understanding of namespaces.
• Another XML vocabulary to learn: to use the RDF
format you must learn the RDF vocabulary.
Equivalent Representations!
<?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#"
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>

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

<?xml version="1.0"?>
<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#">
Note: In the RDF literature the examples
<rdf:type rdf:resource="http://www.geodesy.org/river#River"/>
<length>6300 kilometers</length>
are typically shown in this form.
<startingLocation>western China's Qinghai-Tibet Plateau</startingLocation>
<endingLocation>East China Sea</endingLocation>
</rdf:Description>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy