X3 Syntax Proposal

Following is a copy of Bill Barnhill's original email proposing X3 as a pure-text syntax for XDI documents using the RDFX (RDF XRI) model, preceeded by Drummond Reed's response with additional suggestions and examples.

Bill Barnhill's Original Email

Note: edited slightly to remove an unrelated topic at the end.


Original Message


From: Barnhill, William Sent: Thursday, February 01, 2007 4:48 PM To: Drummond Reed, XDI List Subject: RE: [xdi] Groups - XDI RDFX Model Proposal V1 (xdi-rdfx-model-v1.pdf) uploaded

The following are some ntoe regarding "X3" a more human readable representation of the RDFX XDI syntax. This would not replace RDFX but would enable easier human creation/understanding of XDI documents, similar to N3 does for RDF.

This is a first cut at the example XDI document recently posted, in X3 syntax:

=/$link/drummond
=drummond/$ref/=drummond.reed .
        (/$ref$object)/+person .
        (/+email)//drummond.reed@gmail.com .
        (/+email+home)/(/+email)
@/$link/cordance
@cordance/$link/dsr
@cordance*dsr/$ref/=drummond .
        (/$ref$object)/person .
        (/+email)//drummond.reed@cordance.net .
        (/+email+work)/(/+email) .
        (/email+home)/(=drummond/+email)
+/$link/email .
        (/../home) . {! This is a comment. Just like (/x) means the pred
applies to curr subj, (/../) means object applied
                      to current subj and pred !}
        (/../work) .
        (/../string)
+email/$ref$object/$data+string .
        (/$link)/+home .
        (/../+work)

Best regards, Bill

Drummond's Response

Bill,

As I said on the call yesterday, this is great stuff. I find X3 to be highly readable, and I'm going to start using this notation immediately when I need to communicate RDFX in text. (BTW, for anyone who wants a primer on RDF N3 syntax, I recommend http://www.w3.org/2000/10/swap/Primer).

Afer playing with it for awhile, a few suggestions/observations:

1) Since XRIs don't allow whitespace, I think we can drop the trailing period (I've always thought this was a little awkward in N3, since the trailing period needs to be preceeded by whitespace anyway).

2) I also suggest we drop the parens around a predicate when it follows on another line from the subject it describes, because the preceeding whitespace makes it unambiguous that you are starting a new statement, and we already have the precedent that a statement that starts with "/" describes the current (preceeding) subject. That way you can more easily spot the only "real" cross-references (the ones you need in the object slot when referencing another RDFX object).

3) I like the convention of indenting X3 statements that start with /. It makes it easy to see all the statements that describe a particular subject.

4) The /../ notation for repeating predicates is brilliant.

5) I think that we can just indicate literals with a double slash following the predicate. This is very clean, as it corresponds to exactly the pattern you see in RDFX tables, which is that you either have an XRI as a object or a data literal but not both.

6) What do you think of the idea of using quotes for literals that include white space, so simple X3 processors can process chunks of data that might include whitespace?

All of these are illustrated in the following example:

=/$link/drummond
=drummond/$ref/=drummond.reed
        /$ref$object/+person
        /+name//"Drummond Reed"
        /+email//drummond.reed@gmail.com
        /+email+home/(/+email)
@/$link/cordance
@cordance/$link/dsr
@cordance*dsr/$ref/=drummond
        /$ref$object/person
        /+email)//drummond.reed@cordance.net
        /+email+work/(/+email)
        /+email+home/(=drummond/+email)
+/$link/email
        /../home
        /../work
        /../string
+email/$ref$object/$data+string
        /$link)/+home
        /../+work

Lastly, what's really cool about X3 is that it is exactly what I meant when I mentioned the idea of nanoformats. As Kevin Marks had mentioned to me in Doc Searls VRM meeting last week, the term "nanoformats" has already been used to describe the idea of putting all the semantics in the identifier (intended for the "id" attribute in HTML documents -- see http://icite.net/blog/200602/nanoformats.html).

But X3 takes nanoformats to the extreme: an N3 statement can be used anywhere you can use an identifier, including just freestanding text. For example, now everyone can have a completely machine-readable nanoformat email sig just by using X3. Mine follows below!

=drummond/+name/"Drummond Reed"
        /+email//drummond.reed@cordance.net
        /+phone+work//+1.206.364.0992
        /+phone+cell//+1.206.618.8530
        /+chat@skype//drummondreed

Wow!!!!

Bill, X3 is so cool I'm posting this page on the XDI TC wiki so we can continue to document it there.

=Drummond (who it turns out has been using a nanoformat as my signature line for five years now!)

RdfX3Syntax (last edited 2009-08-12 18:06:58 by localhost)