Re: separator/terminator ;

Seaborne, Andy wrote:
> 
> 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


Updated grammar [*] around triple patterns. For triples, this follows n3.n3 and
Turtle as I understand it.

Based on:
   http://www.w3.org/2001/sw/DataAccess/df1/
   http://www.w3.org/2000/10/swap/grammar/n3.n3

Some differences:

The whitespace rules are as for n3.n3: "<a><b><c>." is legal.
    As this makes the query syntax a superset of Turtle,
    data can still be pasted in.

As per Turtle, "<a> ." is not legal (it is in n3.n3).
    There are different rules for empty and non-empty propertyLists.


I am now looking for syntax examples of things people want to work - my 
evolving, live development test suite is currently available at:

http://cvs.sourceforge.net/viewcvs.py/jena/ARQ/testing/ARQ/Syntax-SPARQL/

and I'm looking for more examples.  Please send complete SPARQL queries.

These tests should migrate to W3C sometime or become part of a wider test suite 
(which you can also get via the link above).

 Andy

[*] Not tokens - the matter of the trailing dot is still there.  What are we 
doing about this?

> 
> 
> 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 Wednesday, 13 April 2005 11:01:57 UTC