Federated query with a BIND clause returns a "no write permission" error

When running a federated SPARQL query with a BIND clause inside the SERVICE block, Virtuoso Open Source returns a “no write permission” error even though it is a SELECT query and does not do any updates:

Query:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX : <https://swapi.co/vocabulary/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?char ?char_label ?uri ?fullURI WHERE{
  ?char rdf:type :Human. 
  ?char :wikidataLink ?wiki_char.
  SERVICE <https://query.wikidata.org/sparql> {
      ?wiki_char wdt:P3798 ?uri.
      BIND(IRI(CONCAT("https://www.starwars.com/databank/", ?uri, "/")) AS ?fullURI)
    }
  OPTIONAL{?char rdfs:label ?char_label. FILTER(LANG(?char_label) = 'en')} 
}

Error message:

Virtuoso RDF02 Error SR619: SPARUL LOAD SERVICE DATA access denied: database user 107 (SPARQL) has no write permission on graph wdq

Hi @CaptSolo,

Please load the SPARQL endpoint metadata via the following command using the iSQL or Conductor interface.

SPARQL LOAD <{sparql-endpoint-url}> DATA ;

This registers the remote SPARQL endpoint with Virtuoso.

Note also this Enabling SPARQL 1.1 Federated Query Processing in Virtuoso post …

Hi @kidehen ,

What should we specify as the <{sparql-endpoint-url}> – the URI of the Wikidata SPARQL endpoint or the URI of the Star Wars dataset (we load it from a file) which we use in this query?

We loaded Star Wars data like this:

ld_dir('/data/sw', '*.*', 'http://starwars.org');
rdf_loader_run();
checkpoint();

This problem only appears if we use the BIND statement inside the SERVICE block:

This query (from the original post) returns an error message:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX : <https://swapi.co/vocabulary/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?char ?char_label ?uri ?fullURI 
WHERE{
  ?char rdf:type :Human. 
  ?char :wikidataLink ?wiki_char.
  SERVICE <https://query.wikidata.org/sparql> {
      ?wiki_char wdt:P3798 ?uri.
      BIND(IRI(CONCAT("https://www.starwars.com/databank/", ?uri, "/")) AS ?fullURI)
    }
  OPTIONAL{?char rdfs:label ?char_label. FILTER(LANG(?char_label) = 'en')} 
}

This query works fine:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX : <https://swapi.co/vocabulary/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?char ?char_label ?uri ?fullURI 
WHERE{
  ?char rdf:type :Human. 
  ?char :wikidataLink ?wiki_char.
  SERVICE <https://query.wikidata.org/sparql> {
      ?wiki_char wdt:P3798 ?uri.
    }
  BIND(IRI(CONCAT("https://www.starwars.com/databank/", ?uri, "/")) AS ?fullURI)
  OPTIONAL{?char rdfs:label ?char_label. FILTER(LANG(?char_label) = 'en')} 
}

Which implies that data was loaded into the local Virtuoso instance under the Graph IRI <http://starwars.org> . That’s verified by the behavior exhibited by the BIND usage location i.e., conditions don’t match over on the Wikidata side.

Update: the LOAD … DATA command did not work:

SPARQL LOAD <https://data.nobelprize.org/store/sparql> DATA ;

It returns an error:

SQLState: 37000

Message: SQ074: Line 1: SP030: SPARQL compiler, line 1: syntax error at 'DATA'
 SPARQL LOAD <https://data.nobelprize.org/store/sparql> DATA  

Virtuoso version: 07.20.3236

The correct command is:

SPARQL LOAD SERVICE <sparql-endpoint-iri> DATA 

so you should be specifying:

SPARQL LOAD SERVICE <https://data.nobelprize.org/store/sparql> DATA ;

although when I run that myself https://data.nobelprize.org/store/sparql does not appear to be a valid SPARQL endpoint URI:

SQL> SPARQL LOAD SERVICE <https://data.nobelprize.org/store/sparql> DATA ;

*** Error 22023: VD [Virtuoso Server]The service <https://data.nobelprize.org/store/sparql> has no description and the site is not responding as a SPARQL endpoint
in
signal:(BIF),
        __01 => '22023',
        __02 => 'The service <https://data.nobelprize.org/store/sparql> has no description and the site is not respon' (truncated),
DB.DBA.SPARQL_SD_PROBE([executable]/sparql_io.sql:849),
  service_iri => 'https://data.nobelprize.org/store/sparql',
   proxy_iri => NULL,
     verbose => 0,
  inside_resultset => 0,
signal:(BIF),
        __01 => '22023',
        __02 => 'The service <https://data.nobelprize.org/store/sparql> has no description and the site is not respon' (truncated),
DB.DBA.SPARUL_LOAD_SERVICE_DATA([executable]/sparql.sql:8287),
  service_iri => 'https://data.nobelprize.org/store/sparql',
   proxy_iri => NULL,
         uid => 0,
    log_mode => NULL,
  compose_report => 0,
     options => (ARRAY_OF_POINTER value, tag 193),
      silent => 0,
<Top Level>
at line 2 of Top-Level:
SPARQL LOAD SERVICE <https://data.nobelprize.org/store/sparql> DATA 
SQL>

So what is the URI of the SPARQL endpoint you are seeking to run the SPARQL-FED query against ?