> What am I doing wrong?

Nothing.
The SPARQL parser at the far end is rather touchy.


Works using wget or curl:
http://sparql.data.southampton.ac.uk/?query=SELECT+%3Fo+%7B+%3Fs+%3Fprop+%3Fo+%7D+LIMIT+1

Does not work:
http://sparql.data.southampton.ac.uk/?query=SELECT+%3Fo+%7B+%3Fs+%3Fprop+%3Fo+%7D+LIMIT++1

The difference is an extra space "LIMIT  1"

> Any help to make it right?

Try

QueryExecution qexec = new QueryEngineHTTP(sparqlEndPoint, qString3) ;

which by passes local query parsing/string conversion.

        Andy

On 01/03/16 15:54, Carlo.Allocca wrote:
Dear All,


I am using Jena to query a SPARQL endpoint but I got "==== No variables ====" 
as result. But, when I run the same query over the SPARQL endpoint, I get the expected 
results. Below, I reported the details of the query, sparql endpoint and jena code.


I tried to check other endpoints, but I got the same experience.


What am I doing wrong? Any help to make it right?


Many Thanks,

Best Regards,

Carlo



=== Query Southampton SPARQL endpoint


1) SPARQL EndPoint:


String sparqlEndPoint = "http://sparql.data.southampton.ac.uk/";;


2) SPARQL Query:


String qString3 = "prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> "

                 + "prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "

                 + " SELECT DISTINCT ?o  where "

                 + "{ "

                 + " ?s ?prop ?o . "

                 + " FILTER (isLiteral(?o)) "

                 + "} LIMIT 1000";




3) Jena code:


         QueryExecution qexec = QueryExecutionFactory.sparqlService(sparqlEndPoint, 
qString3, "");

         qexec.setTimeout(10 * 60 * 1000); //10 min

         ResultSet results = qexec.execSelect();

         ResultSetFormatter.out(out, results);


4) Jena Result:

==== No variables ====

----

|  |

====


5) SPARQL endpoint Results:


http://www.w3.org/2000/01/rdf-schema#label

http://www.w3.org/2004/02/skos/core#prefLabel

http://www.w3.org/2000/01/rdf-schema#label

http://www.w3.org/2004/02/skos/core#prefLabel

http://www.w3.org/2000/01/rdf-schema#comment

http://www.w3.org/2000/01/rdf-schema#label

http://www.w3.org/2004/02/skos/core#prefLabel

http://www.w3.org/2000/01/rdf-schema#comment

http://www.w3.org/2000/01/rdf-schema#label

http://www.w3.org/2004/02/skos/core#prefLabel


Reply via email to