whitehat
whitehat

Reputation: 2391

SPARQL Update: Underscore not allowed in language tag

I am trying to insert data into blazegraph using the 'Update' tab of blazegraph workbench. Below is a sample code snippet:

INSERT DATA
{
  ns:MyNode ns:hasValue "MyValue"@en_us
}

I am specifying language tag with @ symbol. However, it throws following exception:

org.openrdf.query.MalformedQueryException: Lexical error at line 8, column 49. Encountered: "u" (117), after : "_"

It seems that it does not allow an underscore as part of language tag. If try just with 'en' it works fine.

Why is that so? Is underscore a special character here? If so, what is the way to escape it?

Upvotes: 1

Views: 273

Answers (1)

AndyS
AndyS

Reputation: 16700

The syntax for language tags is defined by an RFC, now revised in RFC5646. Registration of language tags is controlled by IANA.

Subtags are separated by "-"; only A-Z,0-9 are legal in subtags.

When adopted for RDF syntaxes (N3, SPARQL, Turtle etc), the grammar pattern adopted was a compromise syntax that weakly matches the RFC. '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* without taking all the details. The subtag separator is "-". "_" is not allowed in a language tag.

Upvotes: 3

Related Questions