RDF Abstract Syntax

Editors:

Jonathan Borden jonathan@openhealth.org

Pat Hayes phayes@ai.uwf.edu

Drew McDermott drew.mcdermott@yale.edu

This version: June 19, 2001

Latest version

Previous version: June 14, 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 it is useful to group triples into sets of statements termed: Bundles.

This document has no official status. 

Bundle

A bundle is a collection of statements.

world ::= (bundle*)

bundle ::= (term*)

Statement

A statement is a triple composed of a predicate, a subject and an object.

statement ::= (predicate,subject,object)

word

A word is either a statement, a bundle, a qname, a URI reference, a quantified variable or a literal. A literal is a string or quoted piece of XML.

word ::= (qname | URIreference | variable | literal)

term

term ::= (word | statement | bundle)

variable

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

predicate

A predicate is a QName.

subject

A subject is a term.

object

An object is a term.

Purpose of the Bundle

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

Conversion of QNames to and from URI references:

For each URIreference U, Q = QName(U) and  U = URIreference(Q)

Converting a URI reference to a QName

A URI reference may be separated into a namespace URI part which is the substring of the URI reference up until the last non alphanumeric character. The localname part is the part subsequent to this last alphanumeric character. If the localname part is null, the special name "_" is used as the localname part of the QName.

Converting a QName to a URIreference

If the namespace name ends in a non alphanumeric character, the namespace URI and localname are concatenated to form a URI reference. If the namespace name ends in an alphanumeric the namespace URI, '#' and localname are concatenated.

Application of predicates to bundles.

The functions first(bundle) , rest(bundle) and nth(i,bundle) are defined where:

unary predicate

the subject is the argument, the object must be nil

foo(bar) -> (foo bar nil)

binary predicate

the subject is the first argument, the object is the second argument

foo(bar,baz) -> (foo bar baz)

n-ary predicate

or(a b c d e) -> (or {a b c d e} nil)

predicaten.bundle := predicaten(nth(1,bundle),nth(2,bundle) ... nth(n,bundle))

the subject is of type bundle and holds the argument list, the object is nil

Examples:

Compound expression

An expression is a statement that contains a statement or bundle as its predicate or object.

The statement:

(not(if (color sky blue)(color leaf green)))

predicate: not - type qname
subject:  [if [color sky blue][color leaf green]] - type statement
    predicate: if - type qname
    subject: [color sky blue] - type statement
    object:  [color leaf green] - type statement
object: nil
 

[or a b c d e f g]

predicate: or - type qname
subject: {a b c d e f g} type bundle
object: nil
 

[if [and [color sky blue][color leaf green]] [season summer]]

<rdf:If>
  <rdf:And>
    <ex:color rdf:aboutQ="ex:sky" rdf:resourceQ="ex:blue"/>
    <ex:color rdf:aboutQ="ex:leaf" rdf:resourceQ="ex:green"/>
  </rdf:And>
  <ex:season rdf:aboutQ="ex:summer"/>
</rdf:If>

Queries as FOPL quantified variables

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

is represented as the bundle:

  1. [dc:creator,foo,?x]
  2. [foaf:mbox,?x,mailto:jonathan@openhealth.org] 

In the context of a query, variables are existentially quantified over the conjunction of the bundle

(exists ?x and{(dc:creator, foo,?x),(foaf:mbox,?x,mailto:jonathan@openhealth.org)})

Expressions

Expressions are collections of statements within a common context. An expression is a subgraph. The root or top level expression within a particular context are those statements which are not referred as the subject or object of any other statement within the context.

Is there a formal expression of this?

  1. W3C RDF Model and Syntax 1.0
  2. ILRT Squish
  3. RDF DB
  4. 1
  5. N3
  6. Klyne's Contexts