I really hate RDF Lists

The subject of the e-mail is a bit tongue-in-cheek, but after being
forced to work with RDF lists in the RDFa work and now again in the
JSON-LD work - I really, truly hate the way RDF Lists are modeled.

Just a few anecdotes to why:

* The addition of RDF List processing is one of the most complex
   features of RDFa 1.1 and the triples that are generated are nearly
   useless in their raw form to developers. It took me a full 38 hours
   to implement support for it in librdfa - which was the grand total
   amount of time that it took me to implement the first cut of the
   librdfa processor in C. Yes, this is partly due to the difficulty
   of expressing a list in a hierarchical document expressing RDF,
   but even the resulting triples just make no sense to someone that
   isn't a programmer. You can't expect Web developers to know what
   a linked list is.
* The addition of RDF List processing in JSON-LD created many hours
   of head-scratching and pain because of the awkwardness of the
   RDF data model when it comes to lists. It also prevented us from
   implementing lists of lists because the algorithm to do so became
   fantastically complex - corner cases related to lists started
   mounting fairly quickly and we had to fence the work to not fall
   into the endless pit of RDF List related issues.
* We went out of our way to not support RDF Lists in the PaySwarm
   implementations we've been doing. It was only when we created JSON-LD
   did we figure out a way to use them without having to give
   everybody that didn't know anything about RDF, who wanted to
   learn the PaySwarm API, a lesson in RDF Lists 101. The solution was
   to hide RDF Lists from developers entirely.

In summary - RDF Lists are difficult to implement, even for people that
know quite a bit about RDF. They are fantastically difficult to grasp
for Web developers. They are really hard to author in many of the RDF
syntaxes.

I'd like to propose something that the group should seriously consider:

1. Add lists as a first-class citizen for all RDF serializations -
deprecate all serializations that don't support lists as first-class
citizens.

2. Get rid of the the Seq, Bag and List classes - replace with two
datatypes - rdf:ordered and rdf:unordered. All "lists" in RDF are
ordered by default.

So, N-Triples and N-Quads could look something like this:

# ordered list
<s> <p> ["O1", "O2"@ja, <http://example.org/>] .

# unordered list
<s> <p> ["01", "O2"@ja, <http://example.org/>]^^rdf:unordered .

or even:

# ordered list
<s> <p> ["O1", "O2"@ja, <http://example.org/>] .

# unordered list
<s> <p> ("01", "O2"@ja, <http://example.org/>) .

If we had started with this, it would mean that RDF Lists would have a
direct mapping to JSON (which got lists right, IMHO). The beauty of JSON
is that by default, the list has order... and if you don't care about
order, you just process the list in any order. If you care about order,
start from the beginning and go to the end. JSON got lists right because
they make the default case ordered and the corner-case unordered. RDF
did it backwards and got it wrong.

While this idea isn't fully baked, I've been sitting on it for two years
now and thought I should send it out while I was still agitated about
having to foist RDF Lists onto Web developers. This is one of those bits
of RDF that has been hurting the cause for over a decade. Surely, this
has been discussed before? Anyone have a link?

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: PaySwarm Website for Developers Launched
http://digitalbazaar.com/2012/02/22/new-payswarm-alpha/

Received on Friday, 4 May 2012 04:12:10 UTC