RDF Abstract Syntax

Editors:

Jonathan Borden jonathan@openhealth.org

Pat Hayes phayes@ai.uwf.edu

This version: June 3, 2001

Latest version

Previous version: May 24, 2001

Introduction

This document defines an Abstract Syntax or Infoset for RDF [1]. RDF Statements are commonly refered to as triples of {predicate,subject,object}. In practice RDF Datastores may supplement the triple with associated information. This abstract syntax defines the supplemented information items.

Context

A Context is a list (ordered set) of Statements

Statement

A Statement is represented by the 6-tuple: <predicate,subject,object, context, index, asserted>

atom

An atom represents either an XML QName, according to XML Namespaces, or a quantified variable matching the EBNF:

atom := (quantvar | QName)

quantvar := ('?' Name) Name as defined in XML 1.0

predicate

A predicate is an atom.

subject

A subject is an atom.

object

An object is an atom. Note that literal strings may be represented by the data: URI scheme.

context

A context is represented by a QName

Purpose of the Context

The context allows separation of statements into lists which can be asserted as a group. Contexts allow 'coloring' of subgraphs. The document from which a set of statements arises forms a context (represented by its URI). Contexts can 'contain' other contexts.

index

The index gives the index of a statement within a context in document order. The index allows preservation of statement order as if each RDF <Description> defines a container, and folds the RDF concept of container directly into the RDF Abstract Syntax.

Purpose of the index

The index allows representation of the statements contained by a context as a list which is an ordered set of tuples. Index also allows reference to a statement within a context using the syntax "/" number, where the number refers to the particular statement. This is the syntax of the XPointer child sequence.

If we remove index, how do we represent lists? Also consider using a special statement to indicate the last statement in a list.

asserted

asserted flags whether a statement is asserted within the context. Asserted statements are the root statements of expressions formulated from more than one statement.

Purpose of asserted

An asserted statement is a root statement for expressions contained by a context.

If we remove asserted, how will we signal that the statement is the root statement of an expression? This seems to be the sole purpose of this flag.

Abstract Syntax

  1. There exists a set called QNames
  2. There exists a set called quantifiedVariables
  3. There exists a set called Atoms where for all a in Atoms => (a in QNames) or (a in quantifiedVariables)
  4. for all atom(x) <=> x in Atoms
  5. There exists a set called Predicates where for all p in Predicates => atom(p)
  6. There exists a set called Subjects where for all s in Subjects => atom(s)
  7. There exists a set called Objects where for all o in Objects => atom(o)
  8. There exists a set called Contexts where for all c in Contexts => atom(c)
  9. There exists a set called Asserted where for all a in Asserted => boolean(a)
  10. There exists a set of Statements := {<predicate,subject,object,context,index,asserted>}

Referring to Statements by Index

A statement may be referred to by index using a syntax consistent with the ChildSeq syntax of XPointer []. For example, the 2nd statement in a context is referred to as:

/2

This syntax allows reference to a particular statement in a context as if the context were an <rdf:Seq> container. One can refer to a range of statements by inserting a hyphen between the start and ending index of the range, e.g.: /2-6.

Examples:

The statement:

(not (says jon (color sky blue))

is represented by the Statements:

  1. <not,/2,true,ctx-foo:s1,1,true>
  2. <says,jon,/3,ctx-foo:s1,2,false>
  3. <color,sky,blue,ctx-foo:s1,3,false>

The Squish [2] query: (dc:creator, foo, ?x)(foaf:mbox, ?x, mailto:jonathan@openhealth.org)

is represented as:

  1. <stmt,this,/2-3,ctx-query,1,false>
  2. <dc:creator,foo,?x,ctx-query,2,false>
  3. <foaf:mbox,?x,mailto:jonathan@openhealth.org,ctx-query,3,false>

S Expressions

An s-expression may be represented in XML:

(or a b c d)

becomes

<or>
 <a/>
 <b/>
 <c/>
 <d/>
</or>

In the case of representing an s-expression in RDF, the statement index is used to represent the list.

  1. <rdf:type,this:or,or,ctx-stmt,1,true>
  2. <a,this:or,true,ctx-stmt/1,2,false>
  3. <b,this:or,true,ctx-stmt/1,3,false>
  4. <c,this:or,true,ctx-stmt/1,4,false>
  5. <d,this:or,true,ctx-stmt/1,5,false>
  1. W3C RDF Model and Syntax 1.0
  2. ILRT Squish
  3. RDF DB
  4. 1
  5. N3
  6. Klyne's Contexts