Introduction to RDF

by Kwong

My notes of RDF Basics from CS4211: Formal Methods for Software Engineering. Writing them here to fortify my own understanding.

What is RDF

The Resource Description Framework (RDF) is a family of World Wide Consortium  (W3C) specifications originally designed as a metadata data model. It has come to be used as a general method for conceptual description or modeling of information that is implemented in web resources, using variety of syntax formats. (wikipedia)

An RDF Document is a collection of assertions in subject, verb, object form for describing web resources. The framework itself provies interoperability between applications that exchange machine understandable information and uses XML as syntax.

So, from my understanding, this is the condensed form:

RDF is a framework using XML as syntax to model a conceptual system.

RDF Basics

rdf:Resource – Defines the class resource; things being described by RDF expressions. Resources are always named by URI (e.g. html document, specific xml element within the document source, collection or pages)

rdf:Property – Defines aspects, characteristics, attributes or relations used to describe a resource (e.g. title)

rdf:Statement – Resource (Subject) + Property (Predicate) + Property Value (Object)

Examples

Example 1:

kwong is the creator of weakbytes.wordpress.com

( https://weakbytes.wordpress.com) ——–creator—->[kwong]

In XML syntax:


<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 about="https://weakbytes.wordpress.com/">
    <dc:creator>kwong</dc:creator>
    <dc:title>KWブログ</dc:title>
  </rdf:Description>
</rdf:RDF>

RDF Containers

rdf:Bag – an unordered list of resources or literals

rdf:Seq  – an ordered list of resources or literals

rdf:Alt – a list of resources or literals that represent alternatives for the value of a property

Examples

Statement: The founders of Google are Sergey Brin and Larry Page.

<rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#
xmlns:s="http://www.schemas.org/Course/">
  <rdf:Description about=http://www.google.com/>
    <s:founders>
      <rdf:Seq>
        <rdf:li rdf:resource="http://infolab.stanford.edu/~sergey/"/>
        <rdf:li rdf:resource="http://infolab.stanford.edu/~page/"/>
      </rdf:Seq>
    </s:founders>
  </rdf:Description>
</rdf:RDF></pre>

RDF Schema

XML Schema can only provide specific constraints on the structure of an XML document, but this is insufficient if we want to know how to interpret these constraints. RDF Schema solves this issue.

Example from lecture

Class

<pre><?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdfs:Class rdf:ID="Person">
<rdfs:subClassOf
rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource"/>
</rdfs:Class>
<rdfs:Class rdf:ID="Student">
<rdfs:subClassOf rdf:resource="#Person"/>
</rdfs:Class>

Property

<rdf:Property rdf:ID="teacher">
<rdfs:domain rdf:resource="#Course"/>
<rdfs:range rdf:resource="#Person"/>
</rdf:Property>
<rdf:Property rdf:ID="students">
<rdfs:domain rdf:resource="#Course"/>
<rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"/>
</rdf:Property>

Why RDF itself is not enough

  • We can only define range/domain on properties
  • No properties of properties
  • No equivalence, disjointness
  • No necessary and sufficient condition