STRDT not working on INSERT

While manipulating data in a named graph I discovered that changing the type of a literal with STRDT is not working correctly.
Given the following data:

    GRAPH <> {
        :i :p "123"^^xsd:integer . 
        :p rdfs:range xsd:integer

The following DELETE/INSERT combination should switch the range as well as all assertions into xsd:long. This fails for the assertions:

graph <> {
        ?s ?p ?o.
        ?p rdfs:range ?r }
INSERT { graph <> {
        ?s ?p ?o2.
        ?p rdfs:range xsd:long }
    graph <> {
            SELECT ?p {
                ?x ?p ?y.
                FILTER(datatype(?y) = xsd:integer)
                FILTER (?y > 10)
        ?s ?p ?o .
        ?p rdfs:range ?r
        BIND(STRDT(STR(?o), xsd:long) AS ?o2)


Try using xsd:long as a casting function:

BIND(xsd:long(STR(?o)) AS ?o2)

Ok, I replaced the BIND clause with the one you provided. Unfortunately I get the following on execution:
Failed to run query: 00UOE2. There was an error while creating a new query plan (not implemented).

(Stardog server 7.0.3)

Hi Thorsten,

Can you share the error from the stardog.log file on your server?


When I run: ./stardog query my graph long-query.sparql -v
I get:

The detailed stack trace for the error is:
com.complexible.stardog.cli.CliException: There was an error while creating a new query plan
	at com.complexible.stardog.cli.CLIBase.execute(
	at com.complexible.stardog.cli.CLI.main(
Caused by: com.complexible.stardog.protocols.http.client.BaseHttpClient$HttpClientException: There was an error while creating a new query plan
	at com.complexible.stardog.protocols.http.client.BaseHttpClient.checkResponseCode(
	at com.complexible.stardog.protocols.http.client.BaseHttpClient.execute(
	at com.complexible.stardog.protocols.http.client.HttpClientImpl.update(
	at com.complexible.stardog.protocols.http.client.HttpConnection._update(
	at com.complexible.stardog.api.impl.AbstractConnection.executeUpdate(
	at com.complexible.stardog.api.impl.UpdateQueryImpl.execute(
	at com.complexible.stardog.api.impl.UpdateQueryImpl.execute(
	at com.complexible.stardog.cli.impl.QueryWithOutput.writeOutput(
	at com.complexible.stardog.cli.impl.Query.execute(
	... 2 more
Caused by: com.complexible.stardog.StardogException: There was an error while creating a new query plan
	at com.complexible.stardog.ErrorCodes.parseToThrowable(
	at com.complexible.stardog.protocols.http.client.BaseHttpClient.checkResponseCode(
	... 11 more


Is that the full stack trace from stardog.log, or the output from the client command? The server log would have the complete stack trace as well as (potentially) other helpful information for us to diagnose.

It's the output form the client "query" command. The server log (stardog.log) doesn't list a stack trace at all. Do I have to start Stardog with a special argument to obtain stack traces?

Hi Stardog team, is there any progress or insight to this issue yet? We would like to include Stardog to our list of supported backends but are blocked by this issue.

Hi Thorsten,

I can reproduce the issue. Will look into this and update this thread.


Alright, here's what happens:

  • the original issue isn't about strdt(..), that function works as expected, but by default Stardog canonicalizes literals of certain datatypes, particularly, numerical. If you create the database with -o index.literals.canonical=false, you should see the literal converted to xsd:long. Then Stardog will treat "123"^^xsd:integer and "123"^^xsd:long as distinct RDF terms, otherwise (by default) the former will be chosen as the canonical. See the description of the option in

  • the problem with xsd:long is that there's no implementation for that specific cast function (I created a ticket for that). It'd be merely a convenience specialization of strdt and won't change the canonicalization behavior.

  • we are aware that some errors are not currently logged and that will be fixed in the next release.

Thanks for the patience!

Hi Pavel,
Many thanks for this insight. Which issue number do I have to track in the release notes to see when this is done?

The xsd:long issue is #8411 and the error swallowing ticket is #8273.