RDF Abstract Syntax

Editors:

Jonathan Borden jonathan@openhealth.org

Pat Hayes phayes@ai.uwf.edu

Drew McDermott drew.mcdermott@yale.edu

This version: June 26, 2001

Latest version

Previous version: June 19, 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. It arose after many discussions on the www-rdf-logic@w3.org mailing list and irc://irc.openprojects.org/rdfig group.

In RDF a statement is composed of a triple whose elements are members of the set of terms of discourse. These terms have been called Resources however to avoid conflation with resources as defined by RFC 2396, we will call these terms.

In order to further discuss these terms it is useful to describe types, in particular note that constraints are placed on the type which a predicate may assume, this type is called a word.

word

A word is either a URI reference, a quantified variable or a literal. A literal is a string or quoted piece of XML. A word is a type of RDF resource.

word ::= (URIreference | variable | literal)

Note that an XML QName is used as shorthand for a URI reference and used interchangably with URI reference in this paper and its examples.

term

A term is either a word a statement or a bundle. A term is a type of RDF resource.

term ::= (word | statement | bundle)

Statement

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

statement ::= [predicate,subject,object]

Bundle

A bundle is a collection of terms. A bundle is a type of RDF resource. A bundle might be represented as an RDF collection.

the world ::= (bundle*)

bundle ::=   {term*}

variable

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

predicate

A predicate is a word.

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.

Application of predicates to bundles.

n-ary predicate

The type of a statement can be expressed as the type of its predicate, subject and object. Using a subject which is of type bundle an n-ary predicate may be modelled by applying each of the terms in a bundle to the predicate. e.g.:

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

Application of predicates to lists.

Predicates are considered binary i.e. predicate(subject,object). Statements are represented as triples. The first element of the list is the subject and the rest of the list is the object.

(or a b c d e) -> [or a [etc b [etc c [etc d [etc e nil]]]]]

predicate.list := predicate(first(list),rest(list))

lists may be composed of triples using the "rdf:etc" predicate.

Examples:

sentences

A sentence is generally a statement that contains a statement or bundle as its predicate or object i.e. it contains nested statements.

The following sentence is represented as an RDF statement/triple:

[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
 

as list:

predicate: or -type qname
subject: a - type qname
object: [etc b ...] - type statement
	predicate: etc - type qname
	subject: b - type qname
	object: [etc c ...] - type statement

[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)(foaf:surname, ?x, "Borden")

is represented as the bundle:

  1. [dc:creator,foo,?x]
  2. [foaf:mbox,?x,mailto:jonathan@openhealth.org]
  3. [foaf:surname,?x,"Borden"]
  4. [foaf:givenName,?x,"Jonathan"]

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]
			[foaf:surname, ?x, "Borden"]
			[foaf:givenName, ?x, "Jonathan"]
			}
		])
]
    

Sentences

Sentences are collected into bundles. A sentence is a subgraph which has as its root a statement that incorporates or nests other terms and sentences. The root or top level statements within a particular bundle are those statements which are not referred as the subject or object of any other statement within the context, that is they are direct elements of the bundle.

A language which is defined as an extension of RDF defines the syntactic structure and semantics of its sentences. The syntax may be defined in an extension of EBNF where "{" and "}" are used to delimit a bundle and "[" and "]" are used to delimit a statement:

'KIF' in RDF

an example of the sentence definitions for a KIF-like language in RDF are as follows:

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