The RPV (Resource/Property/Value) Syntax for RDF

Abstract

The RPV (Resource/Property/Value) syntax is an XML-based language for expressing RDF assertions. It is designed to be entirely unambiguous and highly human-readable.

Table of Contents

1. Introduction
1.1 Motivation
1.2 Status of This Document
2. The R and PV Elements
3. Abbreviating URIs
4. Reification

1. Introduction

This document defines an XML-based language called RPV (short for Resource/Property/Value) which is designed for compact, precise, and human-readable interchange of RDF assertions.

1.1 Motivation

The Resource Description Framework (RDF) is designed to facilitate the interchange and processing of metadata concerning Resources (where the word Resource is used in its Web sense). RDF models metadata as 3-tuples which assert that some resource has some property (identified by URI) which has a value identified either by URI or given literally.

The centrality of metadata in many classes of application, and the simplicity and elegance of RDF's data model would seem to make it something that has many obvious applications on the Web. Despite this, RDF has been slow to catch hold. The RPV language proposal is motivated by a belief that RDF's problems are rooted at least in part in its syntax.

Specifically:

  1. The syntax of RDF/XML is sufficiently scrambled and arcane that it is neither human-writeable nor human-readable.
  2. The RDF/XML syntax makes heavy use of qnames that is neither intuitive to humans nor conforms particularly well to Web Architecture, which requires that everything significant be identified by URI.
  3. People who care about metadata have no trouble thinking in terms of resource/property/value triples.
  4. Alternatives like N3 that make the RDF triples evident in syntax suffer in comparison to the XML/RDF syntax because they lack XML's widely-deployed base of software, i18n facilities, and APIs.
  5. The notion that you RDF can be mixed into XML transparently enough to be unobtrusive has failed resoundingly in the marketplace.

1.2 Status of This Document

This document is a proposal from Tim Bray which has not been reviewed by any body and has no official standing of any kind.

2. The R and PV Elements

RPV needs only two elements, R for resource and PV for Property/Value pair.

The R and PV elements must both be in the RPV namespace, whose name is http://www.rdf.net/rpv/; in this document we assume the use of the prefix rpv for this namespace.

In all the following examples, assume that the root element of the containing XML docuemnt has xml:base="http://example.com".

The following example asserts that the resource identified by http://resources/rA has the property identified by http://properties/pA with the value http://values/vA. (In future, the base URI will be omitted in prose as well as examples).

<R r="/resources/rA">
 <PV p="/properties/pA" v="/values/vA" />
 </R>

An R element can contain multiple PV elements; all of the properties apply to the same resource.

An R element must have a p attribute which identifies the property with a URI reference.

If a PV element has a v attribute, it gives the poperty's value as a URI reference. If there is no v attribute, the property's value is the literal text which is the content of the PV element:

<R r="/resources/RA">
  <PV p="/properties/pA" v="/values/vA" />
  <PV p="/properties/PB">The value is PB</PV>
  </R>

A property's value may be non-local literal text identified by URI:

<R r="/resources/RA">
  <PV p="/properties/pA" v="/values/vA" />
  <PV p="/properties/PB">The value is PB</PV>
  <PV p="/properties/PC" vText="/texts/textC" />
  </R>

A PV element can have only one of a v attribute, a vText attribute, or content. If it has none of these, the value of the property is an empty string.

If the R element has no r attribute, then it represents the resource itself:

<R>
  <PV p="/properties/pA" v="/values/vA" />
  <PV p="/properties/PB">The value is PB</PV>
  <PV p="/properties/PC" vText="/texts/textC" />
  </R>

An R element may have an id attribute which must be a unique identifier in the containing XML document:

<R id="resource-A">
  <PV p="/properties/pA" v="/values/vA" />
  <PV p="/properties/PB">The value is PB</PV>
  <PV p="/properties/PC" vText="/texts/textC" />
  </R>

<R r="#resource-A">
  <PV p="/properties/pD">Value of pD</PV>
  </R>

Abbreviating URIs

RPV documents may be made more readable by the use of relative URI references for resources, properties, and values, as in the examples above. Software which processes RPV elements must, must expand relative URI references as specified by RFC2396, and allow the base URI of the resource containing the elements to be overriden by the xml:base attribute as described in the specification of XML.

Additionally, RPV provides three attributes rpv:rBase, rpv:pBase, and rpv:vBase which provide base URIs for resource, property, and value URI references respectively and which override both the base URI of the containing resource and xml:base. The effect of these attributes covers the whole of the element to which it is attached and any contained elements:

<R rBase="http://example.com/resources/"
   pBase="http://example.com/properties/"
   vBase="http://example.com/values/">
  <PV p="pA" v="vA" />
  <PV p="PB">The value is PB</PV>
  <PV p="PC" vText="/texts/textC" />
  </R>

4. Reification

An R element embodies zero or more assertions, and may also (if it has no r attribute) itself represent a resource. It may be required to treat the assertions themselves as resources and give them properties.

RPV provides the rpv attribute to support this:

<R id="resource-A">
  <PV p="/properties/pA" v="/values/vA" />
  </R>

<R r="#resource-A">
  <PV p="/properties/pD">Value of pD</PV>
  </R>
<R rpv="#resource-A">
  <PV p="/properties/reliability">Only true if there's an R in the month</PV>
  </R>

In the example above, the second R element makes an assertion about the resource identified by the resource-A element, while the third makes an assertion about the assertions contained in that element.