W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2005

Re: separator/terminator ;

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Tue, 12 Apr 2005 14:47:54 +0100
Message-ID: <425BD18A.2000706@hp.com>
To: RDF Data Access Working Group <public-rdf-dawg@w3.org>, Dan Connolly <connolly@w3.org>


On further digging, I find that n3.n3 does not allow

:x :p :v ; :q :w :z .

but it is because all statements must end in a dot so a properlist can end in a 
";" but to end the statement it must be followed by a "."

So this works:

   [ rdf:subject ?work;
     rdf:predicate sam:isAbout;
     rdf:object ?topic;
   ] .

because properytlist can be null and so a trailing ";" is OK.

But the consequence is that there always trailing dots (outside formulae - the 
content of formulae are handled as a different case).

Turtle too requires a trailing '.' on all statements so
   :x :p :v ; :q :w :z .
is illegal as well.

SPARQL allows omission of the trailing dot when it is followed by a "}" - "." is 
a separator not a terminator - that was a request at F2F-BOS but it could be 
argumed to be non-Turtle because it is a basic pattern in a non-Turtle way.  It 
complicates the grammar both in just triples (minor) and also in requiring dots 
between everything e.g. after OPTIONAL { pattern } (major).

Investigations into the tradeoffs continue.

	Andy


Seaborne, Andy wrote:
> 
> This feature can be done but it may have consequences:
> 
> Example: Turtle:
> 
> triples 	::= 	subject ws+ predicateObjectList
> predicateObjectList ::=	verb ws+ objectList ( ws* ';' ws* verb ws+ objectList )* 
> (ws* ';')?
> 
> so:
> 
> :x :p :v ; :q :w :z .
> 
> is legal as triples
> 
> :x :p :v .
> :q :w :z .
> 
> because a triple can be "x y z ;"
> 
> 
> To help establish a baseline, could you let me know what's the official, 
> definitive grammar for N3?  Is it the N3 version or one of the Python parsers?
> 
> Hmm - there are whitespace differences as well.
> 
> e.g.
> 
> <a><b><c>
> 
> is legal N3 (according to cwm) but not Turtle because there is no WS after the 
> subject and no trailing dot for the triple.
> 
> What would be most useful is a principle for resolving these rather than a case 
> by case basis.
> 
> 	Andy
> 
> 
> Dan Connolly wrote:
> 
>>sparqler (http://sparql.org/query.html )seems to like
>>
>>SELECT ?who WHERE
>>{
>>  [ rdf:subject ?work;
>>    rdf:predicate sam:isAbout;
>>    rdf:object ?topic
>>  ] dc:creator ?who
>>}
>>
>>but not with a trailing semi
>>
>>SELECT ?who WHERE
>>{
>>  [ rdf:subject ?work;
>>    rdf:predicate sam:isAbout;
>>    rdf:object ?topic;
>>  ] dc:creator ?who
>>}
>>
>>When working on an N3 grammar, I was stumped for a while
>>trying to allow this. I think I eventually made a separate
>>token for "; followed by ]" as distinct from ;.
>>
>>I haven't checked the SPARQL grammar yet, but I think
>>this should be allowed.
>>
> 
> 
Received on Tuesday, 12 April 2005 13:48:09 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:23 GMT