Chapter 7. RDF : Resource Description Framework

Table of Contents

7.1. Triples in RDF/XML
7.2. RDF Schema
7.3. RDF queries
7.4. Convert XML to RDF/XML
7.5. RDF versus XML
7.6. Additional Information on RDF

In the previous chapters, we have seen how to label information using XML tags so that it can be processed with diverse technologies. Although, we tried to give mnemonic names to element tags, we never assigned any formal meaning to them. We focused on the syntactic checking of the tag names and their proper nesting according to a schema. In order that the information on the web be more easily shared and manipulated by machines or automated intelligent agents, much research activity has been performed in the area of the Semantic Web [8] to make available for applications not only the information textually present in documents but also its intended meaning.

On the Semantic Web, computers, not only humans should do the browsing in order to search for knowledge, to process it and to take action. Now that the current (syntactic) web is a well-accepted distributed presentation platform, the semantic web aims for a distributed knowledge platform. Although this is a laudable goal, it is much easier said than done. Progress in this area has been relatively slow compared to the expectations of the original Semantic Web designers. But ideas and technologies have emerged and started being used in many contexts.

In this chapter, we present a Semantic Web technology called RDF which stands for Resource Description Framework. RDF is a way of identifying relations between things on the web; it is very flexible and scalable but as it is quite loose, it is limited in its inferencing possibilities. XML and RDF are at the core of the Semantic Web as can be seen in Figure 7.1. RDF can be described using an XML syntax although its principles are independent from this notation. RDF should be primarily considered as a triple-based data model to define graphs of relations between things.

We will first present the data model using a non-XML syntax for which an XML serialization has been defined. For humans, the non-XML syntax is easier to read, to write and understand but the uniformity, ease of parsing and standardisation of the XML syntax is a great asset for computer-based applications.

Figure 7.1. Semantic Stack

"Layer cake" diagram (2007 version) taken from http://www.w3.org/sw

Semantic Stack


RDF [77] was developed as a simple and extensible data model for annotating web content. Its goal was to enable Anybody to say Anything about Any topic, sometimes called the AAA Slogan. It is a tradeoff between ease of expression and strictness of organization that allows the combination of information from diverse sources anywhere on the web or even elsewhere. RDF is a means of associating property-value pairs with ressources on the web. It is more oriented towards metainformation about web pages than providing information itself although its generality allows the definition of anything.

In order to associate properties and values to entities, it is important to be able to identify them uniquely and universally. RDF uses the notion of URI which stands for Uniform Resource Identifier. An URI can identify anything (a resource in the RDF jargon) either

a web page
http://www.iro.umontreal.ca/~lapalme/ForestInsteadOfTheTrees/HTML/index.html
a web site
http://rali.iro.umontreal.ca
a person
http://www.iro.umontreal.ca/lapalme
an abstract concept
http://www.iro.umontreal.ca/lapalme/MyViewOnXML

An URI is in a sense arbitrary but, like the namespaces we described in Section 2.1, they often look like URLs whose start usually give an official name or address of a person or organization. An URI is not necessarily an existing web document. Although there is no formal check on this, it is expected that a person or an organization defining an URI for their own purposes will start with an address that they own in a certain way unless an existing resource is referred to. It usually consists of the following parts:

scheme
a type of address followed by a colon, most often http:, but it could be mailto:, isbn: or tel: among others.
authority
the name of a domain in the internet (e.g. www.iro.umontreal.ca) preceded by //
path
usually your name or the name of a project possibly followed by the specifics of this application (e.g. lapalme/CellarBook);
fragment
starting with hash (#), a specific term for the name given to the concept to identify (e.g. #wine).

These would form the following URI:

       http://www.iro.umontreal.ca/lapalme/CellarBook#wine

Although we have argued previously that URIs are arbitrary, the goal of the Semantic Web is to share information with others. Naming conventions are thus essential to ensure that the same concepts or information are all named the same. Also a given name should not reference different things depending on the context of use because URI are universal.

The largest effort to distribute and link structured information across the web is a project called Linked Data [31]. In this context, a naming convention patterned after the Cool URI [42] proposition of the W3C has been defined to ease the sharing of information. Here are a few guidelines for creating one's own URIs so that others can easily make sense of them and combine them in their applications.

There are two requirements for a cool uri:

These two contradictory requirements can be met by taking advantage of the HTTP protocol which allows (at least) two tricks : hash URIs and 303 URIs.

Hash URIs are URLs containing a fragment part i.e. an identifier following a hash sign (#) thus their name. Hash URIs are used for non-document ressources. When a client sends a request to retrieve a hash URI from a server , the HTTP protocol requires that the fragment part be stripped off before requesting the URI from the server. Thus a URI with a hash cannot be retrieved directly and does not necessarily identify a Web document but it can be used to identify a non-document resource without creating ambiguity. This scheme is often used when many concepts are defined in the same HTML or RDF document. Referencing the URI thus retrieves a human or machine readable document giving access to all these concepts with a single access.

303 URIs are mostly used when the RDF and HTML representations of the resource are two different documents. In this case, the Web server corresponding to a given URI can be configured to redirect the query to another URL depending on the information given by the caller in the header of the request: e.g. it could answer with an HTML document to a browser but with an RDF document if the caller is an application. By looking at the code of the response header (200 for a normal document and 303 for a redirection), the application can distinguish the two types of response.

Within the Linked Data community, it is a best practice to distinguish three types of URI for non-information resources: the resource itself, a web page for human readers or a RDF/XML file for machines.

For example in DBPedia, the town of Montréal in Canada is associated with three URIs:

The choice between these two mechanisms depends on the application; section 4.4 of [42] present some basic rules but it concludes by If in doubt, follow your nose! But care has to be given for the initial choice because in the words of Tim Berners-Lee Cool URIs don't change!