TriG examples not conforming to grammar

The TriG grammar [sect 4.5] does not permit a wrapped graph 
to end with a '.'.

   # Illegal
   { :foo a foaf:Person . }

   # Legal
   { :foo a foaf:Person }

However every single example in the 5 Nov candidate 
recommendation includes a wrapped graph ending with a '.'.

In SPARQL, the terminating '.' is not permitted, and it is 
only those sections of the examples that use the SPARQL 
'GRAPH' syntax that conform to the TriG grammar.  For SPARQL 
compatibility is necessary to allow omission of the 
terminating '.' when the 'GRAPH' keyword is used.  The formula 
syntax of N3, from which the wrapped graph syntax is clearly 
derived, also does not permit a terminating '.'.

The simple solution is simply to update all examples to 
remove the terminating '.'.  The problem with this is until 
the draft of 19 Sept 2013, the terminating '.' was required 
and any early adopters are probably expecting to allow the 
terminating '.'.  Even now, a causal read of the candidate 
recommendation suggests that it is required (or at least 
allowed) because of the erroneous examples.  The terminating 
'.' is not marked as a "feature at risk".

An altenative would be to require the terminating '.' in the 
native (i.e. non-SPARQL) syntax, but to prohibit it in the 
SPARQL syntax.  This provides compatibility with the present 
examples and with SPARQL, and is easy enough to implement by 
providing two versions of wrappedGraph and triplesBlock, one 
with a terminating '.' and one without.  But this seems 
arbitrary and confusing.

Probably the best solution is to make the terminating '.' 
optional in all cases.  This would be easy fix to make by 
changing the triplesBlock production in the TriG grammar to 
read:

   [6g] triplesBlock ::= triples ('.' triplesBlock?)? '.'?


Richard

Received on Sunday, 17 November 2013 18:25:31 UTC