Re: Collection / Grammar Issue

On 16 May 2013, at 03:34, Sandro Hawke <sandro@w3.org> wrote:
> On 05/15/2013 07:41 PM, Alex Milowski wrote:
>> I ran across a problem while implementing a Turtle parser.
>> 
>> In section 3 of [1], the 7th example is: 
>> 
>> @prefix : <http://example.org/stuff/1.0/> .
>> (1 [:p :q] ( 2 ) ) .
> 
> (unofficial reply, trying to clarify)
> 
> Why would you want a turtle file that's just a list?

(Another unofficial reply)

Why not? RDF is supposed to be a flexible data model that can represent data coming from any source. Having a data source that is simply a list of things, and wanting to represent that in RDF, doesn't strike me as far-fetched. For example, there is a text/uri-list media type: http://amundsen.com/hypermedia/urilist/

For the record, I believe this limitation in the grammar is there because the Turtle grammar was derived from the SPARQL grammar, and SPARQL doesn't support such “naked lists” in triple patterns, because in a query they really wouldn't make sense.

I don't see this limitation in Turtle as a big problem, because there are workarounds such as spelling out the list in rdf:first and rdf:rest triples. So just changing the example is fine with me. Adding a note about it might be appropriate.

Richard



>  How would you use that?
> 
>         -- Sandro
> 
>> The production for triples in section 6.5 is:
>> 
>> [6] triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList?
>> [7] predicateObjectList ::= verb objectList (';' (verb objectList)?)*
>> [10] subject ::= iri | BlankNode | collection
>> 
>> According to these productions, the example is invalid.  The subject reduces to the collection and must be followed by a verb.  Yet, the example does not have a following predicate object list.
>> 
>> If this is truly suppose to be valid, I think the productions need to be:
>> 
>>    triples
>>             ::= subject predicateObjectList | 
>>                         collection predicateObjectList? | 
>>                         blankNodePropertyList predicateObjectList?
>>    subject ::= iri | BlankNode
>> 
>> BTW, it would be a wonderful editorial change to number the examples. 
>> 
>> [1] http://www.w3.org/TR/2013/CR-turtle-20130219/
>> 
>> -- 
>> --Alex Milowski
>> "The excellence of grammar as a guide is proportional to the paucity of the
>> inflexions, i.e. to the degree of analysis effected by the language
>> considered."
>> 
>> Bertrand Russell in a footnote of Principles of Mathematics
> 

Received on Thursday, 16 May 2013 09:25:29 UTC