Federated query not returning data when using variables

I'm trying to combine some data from our Stardog database with the Wikidata endpoint.
The following query doesn't return any data. However when I replace the ?uri with

<http://www.wikidata.org/entity/Q427000>

The data is returned correctly.

It appears as if the value returned for the ?uri is not used in the Service part of the query

SELECT * WHERE  {
       
      ?measurements measurement:hasParameter parameter:Reb%20A.
      ?measurements measurement:hasURI ?uri.
  
      Optional { Service<https://query.wikidata.org/sparql> {		
        	?uri <http://www.wikidata.org/prop/direct/P117> ?image.
        }
      }
   
}

The query to wikidata returns 5722 results and there is a possibility that they are only returning the first 200. I’m not sure if they will return complete results from queries. They may be requiring that you page results to limit load on their servers but I’m not sure. You can test it easily enough by running a count over the service query and seeing if you get the expected number of results.

I did that, and the count returns all items.
I used the following query to check it:

SELECT (count(?uri) as ?numberOfUri) WHERE  {
      Service<https://query.wikidata.org/sparql> {		
        	?uri <http://www.wikidata.org/prop/direct/P117> ?image.
        }
}

I found the issue, the virtual import (using R2RML format) was adding the URI to wikidata in our Stardog database as a literal and thus was parsed as a literal to the query at Wikidata.

I replaced the objectMapping from using a column value to a template and it works well now.
Any chance Stardog will support the URI/IRI function as described here: SPARQL 1.1 Query Language ?

Glad to hear you figured out the problem. Stardog should support those functions. Home | Stardog Documentation Latest

Are you having any trouble using them?

Tim,

You can also specify the rr:termType property in your mapping to indicate that the column value should be interpreted as an IRI instead of a string.

Jess