Search code examples
labelsparqlsesamerdfs

How do I insert a language-tagged literal using a SPARQL INSERT DATA query?


I have a problem with a query in SPARQL for a Sesame triplestore. I enter this query in "SPARQL Update" option of the Sesame workbench:

INSERT DATA { <http://www.example#test> rdfs:label "test_label"@en }

I would have this RDF result:

<rdf:Description rdf:about="http://www.example#test">
     <rdfs:label xml:lang="en">test_label</rdfs:label>
</rdf:Description>

But I don't know how write the query in order to add xml:lang="en".

With my query, I have this error:

org.openrdf.query.UpdateExecutionException: org.openrdf.sail.SailException:
org.openrdf.rio.RDFParseException: Expected ':', found ' '

I don't manage to find the right syntax for my query.


Solution

  • The SPARQL update query as you have it is correct. The error is caused by a bug in Sesame release 2.7.11 (see SES-2063).

    A fix will be available in the next patch release. In the meantime, a workaround is to reformulate your query, as follows:

     INSERT { <http://www.example#test> rdfs:label "test_label"@en } WHERE {}