RDF: The Building Block of the Semantic Web

Chapter 3: Resource Description Framework

Eng. Dr. Tiroshan Madushanka

What is RDF?

Understanding the Foundation

RDF in the Semantic Web Context

RDF is an XML-based language for describing information contained in a Web resource. It is the special "markup file" that enables smart agents to understand and process Web content.

Key Facts About RDF

  • RDF is the basic building block for supporting the Semantic Web
  • RDF is to the Semantic Web what HTML has been to the Web
  • RDF is a W3C recommended standard for metadata
  • RDF is domain-independent - can describe any fact or resource
  • RDF is machine-understandable - enables automated reasoning
  • RDF enables interoperability among applications on the Web

The Vision

RDF provides a basis for coding, exchanging, and reusing structured metadata, making the vision of the Semantic Web a reality.

Basic Elements: Resource

Everything is a Resource

What is a Resource?

A resource is anything that is being described by RDF expressions:

  • A Web page or part of a Web page
  • An entire Web site
  • A real-world object (book, camera, person, dog)
  • An abstract concept

Rule #1: Global Naming

The name of a resource must be global. If you have a doubt that someone else might use the same name to refer to something else, then you cannot use that name.

Resource URI Example

http://www.yuchen.net/photography/SLR#Nikon-D70

Breakdown:

  • Namespace: http://www.yuchen.net/photography/SLR
  • Fragment identifier: #
  • Local name: Nikon-D70

This URI uniquely identifies a Nikon D70 camera globally.

Basic Elements: Property

Describing Resources

What is a Property?

A property is a resource that has a name and can be used to describe some specific aspect, characteristic, attribute, or relation of another resource.

Property Example

http://www.yuchen.net/photography/SLR#weight

This property describes the weight of a camera.

Properties are Resources Too!

Since properties are also resources, they follow the same naming conventions and must be globally unique using URIs.

Basic Elements: Statement

The RDF Triple

Rule #2: The Statement Structure

Knowledge (or information) is expressed as a statement in the form of subject-predicate-object, and this order should never be changed.

RDF Statement Format

resource (subject) + property (predicate) + property value (object)

Can be interpreted as:

<subject> has a property <predicate>, whose value is <object>

Example Statement

Full form:

http://www.yuchen.net/photography/SLR#Nikon-D70 has a http://www.yuchen.net/photography/SLR#weight whose value is 1.4 lb

Using namespace abbreviation:

mySLR:Nikon-D70 has a mySLR:weight whose value is 1.4 lb

Triple Representation

Subject Predicate Object
mySLR:Nikon-D70 mySLR:weight 1.4 lb

RDF Triples: Knowledge That Machines Can Use

Machine Reasoning with RDF

Example RDF Statements

Subject Predicate Object
mySLR:Nikon-D70 mySLR:weight 1.4 lb
mySLR:Nikon-D70 mySLR:pixel 6.1 M
mySLR:Nikon-D50 mySLR:weight 1.3 lb

Interactive Query Demo

Question: What properties did we define for Nikon D70?

Query Results:

Properties found:

  • mySLR:weight
  • mySLR:pixel

The machine can perform useful work based on the RDF statements!

The Power of Structured Data

Even with simple statements, machines can draw inferences and answer questions without understanding the specific meaning of the content.

RDF Vocabulary

A Small but Powerful Set

The Complete RDF Vocabulary

RDF has an extremely small vocabulary set:

Syntax Names:

RDF Description ID about parseType resource nodeID datatype

Class Names:

Seq Bag Alt Statement Property XMLLiteral List

Property Names:

subject predicate object type value first rest _n

Resource Names:

nil

Key Insight: The small vocabulary size makes RDF easy to learn and implement, while still being powerful enough to express any knowledge.

Basic RDF Syntax

Your First RDF Document

Simple RDF Document

<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.yuchen.net/photography/Camera#"> <SLR rdf:ID="Nikon-D70"> <weight>1.4 lbs</weight> </SLR> </rdf:RDF>

Understanding the Document

  • Line 1: XML declaration
  • Line 2: RDF namespace declaration
  • Line 3: Default namespace (our vocabulary)
  • Line 4: Resource type (SLR) and identifier (Nikon-D70)
  • Line 5: Property (weight) with literal value

Resource URI Construction

The complete URI for the subject is constructed as:

document-location + "#" + rdf:ID value

Result: http://www.yuchen.net/rdf/NikonD70.rdf#Nikon-D70

RDF Syntax: Long Form

Using rdf:Description, rdf:type, and rdf:resource

Short Form (Abbreviated)

<SLR rdf:about="...#Nikon-D70"> <weight>1.4 lbs</weight> </SLR>

Long Form (Full)

<rdf:Description rdf:about="...#Nikon-D70"> <rdf:type rdf:resource="...#SLR"/> <weight>1.4 lbs</weight> </rdf:Description>

Key RDF Keywords

  • rdf:Description - Generic element for describing any resource
  • rdf:about - Specifies the URI of the resource being described
  • rdf:type - Indicates the class/type of the resource
  • rdf:resource - Points to another resource as a property value

Best Practice

Always use rdf:about with absolute URIs to ensure resources are uniquely identified regardless of document location.

Anonymous Resources (Blank Nodes)

When Names Don't Matter

What are Blank Nodes?

Anonymous resources that serve as containers for properties but don't need their own identity. They exist only to provide structure.

Using Blank Nodes for Structured Values

<weight> <rdf:Description> <rdf:value>1.4</rdf:value> <uom:units rdf:resource="...#lbs"/> </rdf:Description> </weight>

The inner <rdf:Description> has no rdf:about - it's a blank node!

Three Ways to Create Blank Nodes

  • Implicit: Nested <rdf:Description> without ID
  • parseType: <weight rdf:parseType="Resource">
  • nodeID: <rdf:Description rdf:nodeID="node1">

Important Note

Anonymous resources cannot be aggregated because there's no way to identify them across different documents.

Typed Literals

Adding Data Type Information

The Problem with Untyped Literals

Without explicit type information, we can't be sure how to interpret values:

<rdf:value>1.4</rdf:value>

Is this a decimal? A string? An integer with a typo?

Using rdf:datatype

<rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal"> 1.4 </rdf:value>

Better with XML entities:

<!DOCTYPE rdf:RDF [ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#"> ]> <rdf:value rdf:datatype="&xsd;decimal">1.4</rdf:value>

XML Schema Data Types

  • RDF borrows data types from XML Schema
  • Common types: xsd:integer, xsd:decimal, xsd:string, xsd:date
  • Ensures interoperability between different systems
  • Enables proper validation and processing

The Three Fundamental Rules of RDF

Principles That Make the Semantic Web Work

Rule #1: Global Naming

The name of a resource must be global. If you have a doubt that someone else might use the same name to refer to something else, then you cannot use that name.

This ensures that the same URI always refers to the same concept everywhere.

Rule #2: Statement Structure

Knowledge is expressed as a statement in the form of subject-predicate-object, and this order should never be changed.

This fixed structure enables machines to process and understand RDF statements.

Rule #3: Open World - Anyone Can Say Anything

I can talk about any resource at my will. If I choose to use an existing URI to identify the resource I am talking about, then:

  • The resource I'm describing and the existing resource represent exactly the same concept
  • Everything I say about this resource is considered additional knowledge

The Power of Rule #3

This rule enables distributed information aggregation - the key feature that makes the Semantic Web possible!

RDF Aggregation in Action

Combining Distributed Information

Scenario: Camera Shopping Decision

You want to compare Nikon D70 vs Canon 20D using information from:

  • 3 Nikon vendors (sales data)
  • 2 Canon vendors (sales data)
  • Online discussion group (reviews)

Step 1: Define Common URIs

http://www.yuchen.net/rdf/NikonD70.rdf#Nikon-D70 http://www.yuchen.net/rdf/Canon20D.rdf#Canon-20D

Share these URIs with all vendors and reviewers

Vendor RDF

<rdf:Description rdf:about="...#Nikon-D70"> <itemSold>12</itemSold> </rdf:Description>

Reviewer RDF

<rdf:Description rdf:about="...#Nikon-D70"> <review>Excellent!</review> </rdf:Description>

Result: Aggregated Knowledge

Your crawler collects all RDF statements and aggregates them by URI, giving you a complete picture with sales data from multiple vendors and multiple reviews - all without a centralized database!

RDF vs XML

Why RDF When We Have XML?

XML Limitations

  • Multiple ways to express the same information
  • No standard meaning for structure
  • Tree-based parsing is complex
  • No built-in support for semantic relationships
  • Difficult to merge from multiple sources

RDF Advantages

  • Single, standardized statement structure
  • Clear subject-predicate-object semantics
  • Simple graph-based model
  • Built for expressing relationships
  • Easy to aggregate from multiple sources

XML Ambiguity Example

<!-- Three different ways in XML --> <author> <firstName>Liyang</firstName> <lastName>Yu</lastName> <book><title>Intro to Semantic Web</title></book> </author> <author> <name>Liyang Yu</name> <book>Intro to Semantic Web</book> </author>

RDF: One Clear Way

<rdf:Description rdf:about="http://...#semanticweb"> <dc:title>Introduction to the Semantic Web</dc:title> <dc:creator>Liyang Yu</dc:creator> </rdf:Description>

The Bottom Line

XML is excellent for data exchange, but RDF provides the semantic structure needed for machine understanding and reasoning.

RDF and Dublin Core

Reusing Standard Vocabularies

What is Dublin Core?

Dublin Core is a standardized set of metadata elements for describing documents and resources on the Web.

Common Dublin Core Elements

  • dc:title - The name of the resource
  • dc:creator - The person or organization responsible for creating the content
  • dc:subject - The topic of the resource
  • dc:description - An account of the resource
  • dc:date - A date associated with the resource
  • dc:type - The nature or genre of the resource

Using Dublin Core in RDF

<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://...#Nikon-D70"> <dc:creator>Liyang Yu</dc:creator> <dc:date>2005-06-21</dc:date> <dc:title>Nikon D70 Camera Information</dc:title> </rdf:Description> </rdf:RDF>

Best Practice: Reuse, Don't Reinvent

Always search for existing vocabularies before creating your own. Using standard vocabularies like Dublin Core ensures your data can be understood by existing tools and applications.

Summary: Why RDF Matters

The Foundation of the Semantic Web

Key Takeaways

  • RDF provides a standard way to express metadata about resources
  • The triple structure (subject-predicate-object) is simple yet powerful
  • Global URIs ensure resources are uniquely identified everywhere
  • Anyone can say anything about any resource - enabling distributed information
  • RDF is machine-understandable - enabling automated reasoning
  • Standard vocabularies promote interoperability and reuse

The Semantic Web Vision

RDF enables a Web where:

  • Information is machine-readable and processable
  • Data from multiple sources can be automatically integrated
  • Smart agents can reason and make inferences
  • Knowledge is distributed but accessible as if centralized

Next Steps

To fully realize the Semantic Web vision, we need to add vocabularies and schemas that define the meaning of classes and properties. This is where RDFS (RDF Schema) and OWL (Web Ontology Language) come in!

Thank you!

RDF is the foundation - now you're ready to build on it.

1 / 16