Re: TriG -- trailing DOT in {} blocks.

On Jun 15, 2013, at 12:54 PM, Andy Seaborne <andy@apache.org> wrote:

> The TriG showed up one issue with the TriG grammar.
> 
> In "traditional" TriG, and in SPARQL and N3, the final DOT in a {...} is optional making this legal:
> 
> { :s :p :o }
> 
> It is illegal by the current TriG grammar which requires a trailing DOT
> 
> Two bad syntax tests show this:
> 
> ** trig-syntax-bad-struct-08
> ----
> # No DOT
> {<http://example/s> <http://example/p> <http://example/o>}
> ----
> 
> ** trig-syntax-bad-struct-11
> ----
> # Trailing ;
> {<http://example/s> <http://example/p> <http://example/o> ;}
> ----
> because in Turtle
> 
>  <s> <p> <o>; .
> 
> is legal turtle (it's quite useful for repeated lines to always terminate with ";" and not have to worry about the last line being special -- the Turtle test manifest uses this).
> 
> 
> The grammar rule affected is TriG [3g]
> 
> Currently:
> [3g] 	graph 	  ::= 	 graphIri? '{' (triples '.')* '}'
> 
> A change would be:
> 
> [3g] 	graph 	  ::= 	 graphIri? '{' triplesBlock? '}'
> [] triplesBlock   ::=    triples ('.' triplesBlock?)?
> 
> which is recursive; it is at least contained to a single rule  -- it's how SPARQL 1.0 writes it so it should be reasonable for everyone.
> 
> 	Andy

+1

I also did a minor update to allow BlankNode graph names:

[3g] graph ::= graphName "{" (triples ".")* "}" | "{" (triples ".")* "}"
[4g] graphName ::= iri | BlankNode

Gregg

> PS This not not new - see also, from Gregg:
> 
> http://lists.w3.org/Archives/Public/public-rdf-comments/2011Dec/0012.html
> 
> there, [6] allows multiple adjacent DOTs:
> 
> [6] triples ::=
> subject predicateObjectList ( "." ( subject predicateObjectList)? )*
> 
> matches
> 
> :s :p :o1 .... :s :p :o2 ..


Wow, I had forgotten about this.

Received on Saturday, 15 June 2013 21:13:45 UTC