Talk:Wikibase/Indexing/SPARQL Query Examples

Why no comments?
It is hard to understand the queries without comments. Does SPARQL interface allow them? --Techtonik (talk) 15:00, 6 June 2015 (UTC)

programatic access
I am trying to execute SPARQL queries at the endpoint http://wdqs-beta.wmflabs.org/ from an Apache Jena program. It works fine for the DBpedia endpoint, but its failing on this one because the response is in HTML - presumably for human consumption. Is there a query parameter that can be set to control the response type? Code:

public static void main(String[] args) {

String queryStr = "select distinct ?Concept where {[] a ?Concept} LIMIT 10";

Query query = QueryFactory.create(queryStr);

//does not work:  Endpoint returned Content-Type: text/html

//try ( QueryExecution qexec = QueryExecutionFactory.sparqlService("http://wdqs-beta.wmflabs.org/", query) ) {

//works

try ( QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query) ) {

// Set the DBpedia specific timeout.

((QueryEngineHTTP)qexec).addParam("timeout", "10000") ;

// Execute.

ResultSet rs = qexec.execSelect;

ResultSetFormatter.out(System.out, rs, query);

} catch (Exception e) {

e.printStackTrace;

}

}

--I9606 (talk) 00:27, 4 September 2015 (UTC)