Editors:
Jonathan Borden jonathan@openhealth.org
Pat Hayes phayes@ai.uwf.edu
Drew McDermott drew.mcdermott@yale.edu
This version: June 26, 2001
Previous version: June 19, 2001
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.
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.
A term is either a word a statement or a bundle. A term is a type of RDF resource.
term ::= (word | statement | bundle)
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]
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 := ('?' Name) Name as defined in XML 1.0
A predicate is a word.
A subject is a term.
An object is a term.
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.
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
Although this abstract syntax does not require a particular implementation, one might express a bundle as either a collection or list of triples.
Expressed as a collection, each statement in a bundle is a member of the collection which represents the bundle. For example:
The special predicate "rdf:etc" is used to indicate a list cell where the first element of the list is the subject and the rest of the list is the object. The special URI "rdf:nil" signals the end of a list.
(or a b c d e) -> [or a [etc b [etc c [etc d [etc e nil]]]]]
predicates are applied to a list as: predicate(first(list),rest(list))
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>
The Squish [2] query: (dc:creator, foo, ?x)(foaf:mbox, ?x, mailto:jonathan@openhealth.org)(foaf:surname, ?x, "Borden")
is represented as the bundle:
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 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:
an example of the sentence definitions for a KIF-like language in RDF are as follows: