W3C home > Mailing lists > Public > semantic-web@w3.org > June 2017

Re: Are spaces allowed between terms in N-Triples 1.1?

From: Gregg Kellogg <gregg@greggkellogg.net>
Date: Wed, 28 Jun 2017 16:48:21 -0700
Cc: SW-forum Web <semantic-web@w3.org>, "Peter F. Patel-Schneider" <pfpschneider@gmail.com>
Message-Id: <F6624162-D95C-494B-977B-E30730F9DABD@greggkellogg.net>
To: Wouter Beek <w.g.j.beek@vu.nl>
Whitespace is typically taken to zero or more characters of whitespace. Note in the Change Log [1]:

> White space rules defined outside of grammar, as in Turtle [2], although the N-Triples grammar restricts White space to tab or (tab U+0009 or space U+0020).

If N-Triples parsers are overly lenient in allowing multiple whitespace characters between terminals, then by that logic, so are Turtle parsers.

The restriction that terminals be separated by exactly a single whitespace is true for the Canonical form of N-Triples [3]. Tokenizers only require whitespace to distinguish two terminals that would otherwise be joined.

Furthermore, there is a minimal whitespace test [4] that verifies that this is the intention of the working group.


There is also the original N-Triples test [5] that contains many instances of terminals separated by mutliple whitespace characters [5], for example:

    # spaces and tabs throughout:
         <http://example.org/resource3>          <http://example.org/property>   <http://example.org/resource2>         .        

Gregg Kellogg

[1] https://www.w3.org/TR/n-triples/#changes-between-last-call-working-draft-and-publication-as-note
[2] https://www.w3.org/TR/turtle/#grammar-production-WS
[3] https://www.w3.org/TR/n-triples/#canonical-ntriples
[4] http://w3c.github.io/rdf-tests/ntriples/lantag_with_subtag.nt

> On Jun 28, 2017, at 8:58 AM, Peter F. Patel-Schneider <pfpschneider@gmail.com> wrote:
> This means that all existing N-Triples parsers are lenient in that they
> process documents that are not valid N-Triples documents.  This, however, does
> not make them too lenient as there is no requirement that an N-Triples
> processor reject inputs that are not N-Triples documents.
> This does mean that Canonical N-Triples documents are not valid N-Triples
> documents.
> peter
> PS:  Of course what it really means is that the grammar section of the
> N-Triples document needs to be changed.
> On 06/28/2017 08:50 AM, Wouter Beek wrote:
>>> So it seems to me that spaces are not allowed anywhere in [1] in N-Triples, i.e.,
>>> <x:y> <x:y> <x:y> .
>>> is not a valid N-Triples triple.
>> I do follow your reasoning here, but this would mean that all existing
>> N-Triples parsers are too lenient.
Received on Wednesday, 28 June 2017 23:48:57 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 08:45:50 UTC