Quads (rough draft)

Revised: 7/8/2002   by Seth Russell

Abstract:

Quads is a language designed to be easily read and written by both humans and automated agents. It is an an extension of  N-Triples. This means that every well formed N-Triple is also a well formed Quad.  Quads extends N-triples by adding the optional attributes: context, and the dialogue performatives: ". ? !".  Names are allowed in the place of uriref; and they may be prefixed with namespaces. Compound names are supported.  

Authors:

Seth Russell  <mailto:seth@robustai.net>.
Sean B. Palmer <mailto:sean@mysterylights.com>
.  
Sean does not endorse this paper yet, hopefully I can convince him, and the community of the utility of this grammar.

Background and motivation:

Although RDF is adequately expressive for most communications on the semantic web, there are many cases where communications about context are either not possible or no standard method exists.  Also raw RDF is not easily browsed by humans.  This proposal addresses those concerns. 

Please see the work in progress at <http://robustai.net/sailor/words.html>

EBNF definition of Quads grammar:

1
QuadsDoc
::=
line*
2
line
::=
ws* (comment | Quad) ? eoln
3
comment
::=
'#' (character - ( cr | lf ) )* 
4
Quad ::=
subject ws+ predicateSlot ws+ object ws+ ((context | ',') seq?)? terminal? ws*  
5
context
::=
name | nodeID |  compoundName
6
subject
::=
name | nodeID |  compoundName
7
predicateSlot
::=
name | compoundName
8
object
::=
name | compoundName | literal
9
seq
::=
realNumber
10
terminal
::=
'.' | '?' | '!'
11
uriref
::=
'<' absoluteURIref '>'  
12
compoundName ::=
'(' ws* name (ws+ name)+ ws* ')'
13
name
::=
uriref | nameToken | namespacePrefix ':' nameToken
14
namespacePrefix
::=
namespacePrefix ::= [A-Za-z][A-Za-z0-9_]*
15
nodeID ::=
'_:' nameToken
16
literal
::=
langstring | xmlString
17
langString
::=
'"' string '"' ('-' language)?
18
xmlString
::=
'xml' langString
19
language
::=
( character - ( '.' | ws ) )+
and containing any allowed xml:lang content as defined in
http://www.w3.org/TR/REC-xml#sec-lang-tag
20
ws
::=
space | tab  
21
eoln
::=
cr | lf | cr lf  
22
space
::=
#x20 /* US-ASCII space - decimal 32 */  
23
cr
::=
#xD /* US-ASCII carriage return - decimal 13 */  
24
lf
::=
#xA /* US-ASCII linefeed - decimal 10 */  
25
tab
::=
#x9 /* US-ASCII horizontal tab - decimal 9 */  
26
string ::=
character* with escapes. Defined in section Strings  
27
nameToken
::=
 [A-Za-z0-9_]+
28
realNumber
::=
[0-9]+  ('.' [0-9]+)?
29
absoluteURIref
::=
defined in section URI References  also see #rdfig discussion
30
character
::=
[#x20-#x7E] /* US-ASCII space to decimal 127 */

Implementations:

This grammar has been implemented in python for sailor agents.

Examples:

1
SethBot ownedBy Seth.
2
seth is great seth.
3
N-Triples seeUrl <http://www.w3.org/TR/rdf-testcases/#ntrip_grammar>.
4
(sailor agents) type (software agent) sailor.
5
type rai:rdfUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> rdf.
6
type rdf:comment "Identifies the Class of a resource" rdf.
7
rdf rai:nsUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> rdf.
8
rai nsUri <http://robustai.net/namespace#> rai.

References:

    N-Triples <http://www.w3.org/TR/rdf-testcases/#ntrip_grammar>
    EBNF <http://www.w3.org/TR/REC-xml#sec-notation>
    SAILOR <http://robustai.net/sailor/>