RDF Documents

RDF is an abbreviation of "Resource Description Framework" (see also [RDF] for the gory details) and is used as a means to provide meta data, that is, descriptions of resources. Resources are identified by URIs (see also [URI]) in this context and can denote almost anything. Descriptions are given as a number of statements that define relations between resources. A statement (also called a triple) consists of a subject, a predicate (also called a property) and an object. All three parts of a statement are determined by resources and hence can usually be identified by URIs (except for anonymous resources). An object can also be a literal (a string or a number) that is not further interpreted by RDF.

The concept that resources are used to denote any part of a statement makes RDF very extensible, so that descriptions of resources can be mixed from many different vocabularies. And because it is possible to make statements also about the resources of properties, RDF is even able to describe itself to some extent, and this leads to RDF schemas for vocabularies. These features are also used as a basis for the Semantic Web, an effort to make the Web more machine-processable.

Structure of an RDF Document

An RDF document typically consists of some prefix declarations and a number of node specifications. A node represents a collection of statements about the same subject resource. A prefix declaration associates a prefix name to a namespace URI. A URI that has such a namespace URI as a string prefix can be abbreviated later in certain situations and within the same scope by using a qualified name that is derived from the related prefix name. Note that all property URIs being used are required to have a proper prefix declaration because of RDF/XML syntax limitations.

The web page editor is able to read most RDF/XML documents (see also [RDF]) and extract the relevant information, but language tagging and RDF datatypes are currently not supported and are ignored. A generated RDF/XML document makes always use of a syntax form in which property names do not appear as attribute names in XML and therefore, the use of default namespaces is not restricted in any way.

Textual Representation of RDF

The textual representation of an RDF document is largely based on Turtle (formerly N-Triples Plus, a superset of N-Triples with some additions from Notation3, see also [RDF/N3]) and looks like this:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix vcf: <http://www.w3.org/2001/vcard-rdf/3.0#>.

  dc:title "W3Browse";
  dc:creator [
    vcf:FN "Alexander Krebs";
    vcf:NICKNAME "Alex";
    vcf:N [
      vcf:Family "Krebs";
      vcf:Given "Alexander"]];
  dc:rights "Copyright (C) 2003-2005 Alexander Krebs";
  dc:subject "w3browse - a text-based web-browser and e-mail-client";
  dc:description "  ....  ";
  dc:language "en-us";
  dc:format "text/html";
  rdfs:seeAlso <http://www.aksware.de/w3browse/changes.html>.

A sequence of a generalized form of statements constitute the textual representation of an RDF document. Such an extended statement may be either a prefix declaration or the (partial) description of a subject resource and is always terminated by a dot (.). It usually defines one or more triples, but it may also result in no triple at all.

In its basic form, a statement corresponds directly to a triple and consists of just a subject, a property and an object, being specified in this order. The first refinement of a simple statement is to use a semi-colon (;) as a shortcut for the current subject in order to group multiple statements together. This can also be used for prefix declarations. The second refinement is to use a comma (,) to separate multiple objects for the same subject and property.

  rdf:type rdf:Seq;
  rdf:li "red", "green", "blue".

The subject of the description of a resource may be either a URI, a qualified name or an anonymous node. An object may additionally be a literal. A property may be either a qualified name or a URI, but note that a property URI must be representable as a qualified name that is appropriate for RDF/XML.

An anonymous node is much like the description of a resource, but it does not have an explicit subject resource that can be used to refer to it from other places than its definition. Such a blank node is introduced by an opening bracket ([) and terminated by a closing bracket (]), and encloses a (maybe empty) number of property-object specifications for the same implicit subject which is the blank node.

  vcf:FN "Alexander Krebs";
  vcf:NICKNAME "Alex";
  vcf:N [
    vcf:Family "Krebs";
    vcf:Given "Alexander"].

A prefix declaration is introduced by the special subject @prefix. In this case, the property is the prefix being defined and the object is the URI of the namespace that is to be bound to that prefix. An empty namespace URI (<>) undefines a prefix. The scope of a prefix, once defined, extends to the end of the document until it is redefined.

Note that all prefixes that are associated to the same namespace URI are mapped to the first prefix that is bound to that namespace URI. Collisions of prefix names are resolved by successively appending _1, _2, ... to the original prefix name until the new name is unique. The result is that each prefix is bound to a different namespace URI which is valid for the whole document. This remapping of prefixes happens for RDF/XML documents as well as for the textual representation of RDF where it may also be used to remap a particular prefix (except rdf:) to another one by placing the desired prefix declaration in front of the existing one.

Syntax Elements (Tokens)

The building blocks of statements are represented by the following syntax elements (tokens):

Any sequence of white-space characters (Space, TAB, CR and LF) can be used to separate tokens in order to increase the readability of a document. At least one white-space character between two adjacent tokens is only needed in cases where they could be misinterpreted as one token. Comments can be placed anywhere where white-space is allowed. A comment is introduced by a hash (#) and extends to the next following CR or LF.


The following restrictions in the processing of RDF/XML documents should be taken into account: