W3C home > Mailing lists > Public > public-rdf-comments@w3.org > November 2013

Bare collections in Turtle and TriG

From: Richard Smith <richard@ex-parrot.com>
Date: Sun, 17 Nov 2013 17:49:09 +0000 (GMT)
To: public-rdf-comments Comments <public-rdf-comments@w3.org>
Message-ID: <alpine.LRH.2.02.1311171704280.23626@sphinx.mythic-beasts.com>

The following is not a valid Turtle document, per the 
candidate recommendation:

   ( :foo :bar ) .

This is because a collection can only appear as the subject 
of a statement in Turtle.

The same document is a valid TriG document as it matches the 
triples2 production in the grammar.

It seems desirable that both TriG and Turtle should do the 
same thing here, and in general that any valid TriG document 
that does not use the { ... } construct should be a valid 
Turtle document.

SPARQL 1.0 allows bare collections that are not the subject 
of a statement, and that is now a stable recommendation.  It 
therefore seems best to conform to that by allowing bare 
collections in both TriG and Turtle.

In TriG, if it the collection is placed inside a wrapped 
graph in TriG, it is no longer valid:

   GRAPH { ( :foo :bar ) }

This is directly incompatible with SPARQL 1.0, and for that 
reason should be fixed.  It also introduces a surprising 
difference between implicit and explicit use of the default 

Bare collections are potentially useful as they do generate 
RDF statements.  So I think the right solution is to allow 
bare collections in both languages, inside and outside of 
wrapped graphs.  The simplest way of fixing this seems to me 
to be to redefine the following grammar productions:

Currently in Turtle:

   [6]   triples     ::= subject predicateObjectList
                           | blankNodePropertyList predicateObjectList?
   [10]  subject     ::= iri | BlankNode | colection

Proposed in Turtle:

   [6]   triples     ::= subject predicateObjectList
                           | triplesNode predicateObjectList?
   [10]  subject     ::= iri | BlankNode
   [NN]  triplesNode ::= blankNodePropertyList | collection

The name 'triplesNode' is chosen because the corresponding 
grammar production in SPARQL is called TriplesNode.

The same change to the same grammar productions will fix 
TriG.  However it may be desirable at the same time to:

   1) change [4g] triples2 to reference the new triplesNode

   2) delete production [7g] labelOrSubject and replace its
      use with subject, as the two are now identical; and

   3) delete production [14] blank and expand its sole use
      in [12] object because (i) it has a misleading name,
      (ii) it causes the definition of object to differ
      (albeit cosmetically) between TriG and Turtle, and
      (iii) it is misnumbered (it should have a 'g' suffix)
      and throws out the correspondence between production
      numbers in Turtle and TriG.

Received on Sunday, 17 November 2013 17:49:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:59:43 UTC