Re: Langtag in Turtle BNF

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
>
> LANGTAG ::= BASE
>  | PREFIX
>  | "@" [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 (
http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-concepts/index.html#section-Graph-Literal)
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.

Regards,
Alex



>
> 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