Re: RDF Lists in Turtle

Further down in the examples it says:

[[
As indicated by the  grammar, a collection can be either a subject or an object. This subject or object will be the novel blank node for the first object, if the collection has one or more objects, or rdf:nil if the collection is empty.
]]

It is true that the grammar does say

NIL ::= "(" (WS)* ")"

but NIL is not used anywhere. Currently one finds 

  collection ::= "(" object* ")"

I think what was meant was

  collection ::= "(" object+ ")" | NIL

And I can see how an attempt at simplification would have lead from one to the other. 
But as a result the NIL case is missing a description in the documentation. And
it seems a bit odd that it is hiding in an example.
 


On 26 Feb 2012, at 10:43, Henry Story wrote:

> In section 5.3 of the latest Turtle editors draft [1] I read
> 
> [[
> Beginning the collection production records the curSubject and curPredicate, sets curSubject to a novel blank node Bhead and sets curSubject and curPredicate to Bhead and rdf:first respectively. Each object O in collection allocates a novel blank node Bn, creates an additional triple curSubject rdf:rest Bn . and sets curSubject to Bn. Finishing the collection production creates an additional triple curSubject rdf:rest rdf:nil . and restores curSubject and curPredicate The node produced by matchingcollection is the blank node Bhead.
> ]] 
> 
> Is this correct? In most programming languages one thinks of Nil as itself a list (just the empty one).
> So one thinks that 
> 
>  :tasks todo () .
> 
> as equivalent to 
> 
>  :tasks todo rdf:nil .
> 
> Things are a bit odd, as otherwise it is not clear what the rdf:first of () is .
> This seems wrong:
> 
>  :tasks todo _:t1 .
>  :t1 rdf:first ? .
>  :t2 rdf:next rdf:nil .
> 
> I see that this is tricky to describe correctly. Lists are usually described recursively.
> 
> Henry
> 
> 
> [1] http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/index.html#sec-parsing-triples
> 
> Social Web Architect
> http://bblfish.net/
> 

Social Web Architect
http://bblfish.net/

Received on Sunday, 26 February 2012 10:03:16 UTC