DBpedia endpoint via SERVICE - encoding errors when the resource has special chars



if I do a SERVICE call to DBpedia, from a local virtuoso instance, I get encoding errors when the resource has special chars and it gets translated into a unicode escaped.

In our local triplestore we have triples about <http://it.dbpedia.org/resource/Cefalù>
but when using it in query it get encoded to:<http://it.dbpedia.org/resource/Cefal\u00F9>

error message:

Virtuoso RDFZZ Error DB.DBA.SPARQL_REXEC('http://it.dbpedia.org/sparql', ...) returned Content-Type 'text/plain' status 'HTTP/1.1 400 Bad Request ' Virtuoso 37000 Error SP030: SPARQL compiler, line 0: Invalid character in SPARQL expression at '\' in sparql_to_sql_text:(BIF), &lt;Top Level&gt; SPARQL query: define output:format "HTTP+XML application/sparql-results+xml" define output:dict-format "HTTP+TTL text/rdf+n3" SELECT ?image WHERE { &lt;http://it.dbpedia.org/resource/Cefal\u00F9&gt; &lt;http://xmlns.com/foaf/0.1/depiction&gt; ?image . } SPARQL query: define sql:big-data-const 0 #output-format:text/html define sql:signal-void-variables 1 SELECT * WHERE { GRAPH &lt;http://athena.pa.icar.cnr.it/eventiPCC2018-merged-nominatim&gt;{ ?event &lt;http://schema.org/location&gt; ?place . ?place &lt;http://www.w3.org/2002/07/owl#sameAs&gt; ?sameAs } SERVICE &lt;http://it.dbpedia.org/sparql&gt; { ?sameAs &lt;http://xmlns.com/foaf/0.1/depiction&gt; ?image } }

Note, when importing the DBpedia data required for that call (foaf:depiction triples) the same query works well without SERVICE and by using just a GRAPH call.


@ninokeys: What is the actual SPARQL-FED query being executed ?


Continuing the discussion from DBpedia endpoint via SERVICE - encoding errors when the resource has special chars:


GRAPH <http://athena.pa.icar.cnr.it/eventiPCC2018-merged-nominatim>{

#?event <http://schema.org/location> ?place .

<http://athena.pa.icar.cnr.it/pcc2018/Location/471> <http://www.w3.org/2002/07/owl#sameAs> ?sameAs


SERVICE <http://it.dbpedia.org/sparql> {

?sameAs <http://xmlns.com/foaf/0.1/depiction> ?image



@ninokeys -

First thing, please note that the Italian DBpedia instance is running on a VERY old Virtuoso Open Source v6.1.8 (engine 06.01.3127, as of Sep 15 2014), unlike the main DBpedia instance which is running a current Enterprise Edition 7.2.6.

Marco should be strongly encouraged to upgrade to at least a current VOS from stable/7, if not a current VOS 7.2.6-rc1 from develop/7.

If you are also running an older Virtuoso, an update is likewise recommended.

Now, starting to look at the query – I think you’ll find code-fences (three backticks before and after) work better when posting big query, code, and/or error blocks here. Else, it’s hard to tell where various HTML and other escaping happens, and we need to know the exact characters in your query, error, etc.

I think (with some adjusted whitespace) that this is the query you’re actually executing?

    GRAPH <http://athena.pa.icar.cnr.it/eventiPCC2018-merged-nominatim>
        #?event   <http://schema.org/location>            ?place .

                  <http://www.w3.org/2002/07/owl#sameAs>  ?sameAs
    SERVICE <http://it.dbpedia.org/sparql>
        ?sameAs   <http://xmlns.com/foaf/0.1/depiction>   ?image

I would suggest that, after confirming your own Virtuoso is a recent version (at least 7.2.4 if not fully current), you try almost the identical query, changing only the SERVICE from <http://it.dbpedia.org/sparql> to <http://dbpedia.org/sparql>.

Any error message from that test should be quite informative.


My bad Ted, I posted a wrong copy pasted query, this is the correct one:

you can try that in our endpoint (remove the default graph):
virtuoso version: 07.20.3217
I’ve just tried using http://dbpedia.org/sparql and the error is identical.

GRAPH <http://athena.pa.icar.cnr.it/eventiPCC2018-merged-nominatim>{
?event <http://schema.org/location> ?place .
?place <http://www.w3.org/2002/07/owl#sameAs> ?sameAs
SERVICE <http://it.dbpedia.org/sparql> {
?sameAs <http://xmlns.com/foaf/0.1/depiction> ?image