W3C home > Mailing lists > Public > public-rdf-comments@w3.org > February 2012

Re: Langtag in Turtle BNF

From: Alex Hall <alexhall@revelytix.com>
Date: Fri, 24 Feb 2012 09:45:49 -0500
Message-ID: <CAFq2bizvS6Y2a9rSOKw0N0EgD=Ag1mHBW4ZYwOu5n66EsHobzA@mail.gmail.com>
To: Henry Story <henry.story@bblfish.net>
Cc: public-rdf-comments@w3.org
On Fri, Feb 24, 2012 at 7:34 AM, Henry Story <henry.story@bblfish.net>wrote:

> In the current editors draft and spec we find
> http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/turtle.bnf
>  | "@" [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )*
> BASE ::= "@base"
> PREFIX ::= "@prefix"
> RDFLiteral ::= String ( LANGTAG | ( "^^" IRIref ) )?
Interesting... Note that a language tag in Turtle (as in SPARQL) is defined
simply as '@' followed by one or more letters, with optional hyphenated
alphanumeric segments. Under this definition, '@base' and '@prefix' are
both valid language tags regardless of whether they are explicitly included
in the LANGTAG production using their BASE and PREFIX rules.

Now, I agree that it is confusing to have them included this way in the
LANGTAG definition. They aren't there in SPARQL, and they probably
shouldn't be in Turtle. My guess would be that this was transcribed
directly from the input grammar for some parser generator, and BASE and
PREFIX were added to LANGTAG to quiet some warnings about ambiguous tokens.

> I don't know what
>        :me foaf:name "hello"@base
> would mean though.

This would be syntactically valid Turtle, but would not represent a valid
RDF literal. Note that the editors draft of RDF Concepts (
says that the language tag must be well-formed according to BCP47. The
decision was made not to push this well-formedness constraint down into the
Turtle language, thereby simplifying the grammar to accept anything more or
less follows the general format of a language tag.  Applications that wish
to enforce the well-formedness of language tags should do so as an
additional step after parsing from the Turtle grammar.


> Henry
> PS. thanks for replies to previous question I asked yesterday on this
> list. I'll get
> back to it as soon as I have progressed a bit further.
> Social Web Architect
> http://bblfish.net/
Received on Friday, 24 February 2012 14:46:44 UTC

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