Wikidata currently has a SPARQL endpoint " https://query.wikidata.org/ ", I would like to query this site using Jena (3.0.1), I am using the following code, but I got the error message " Final the point returned by Content-Type: text / html, which is currently not supported for SELECT queries . " Is there any way to solve this problem? the same code works fine with dbpedia. Thanks
queryString = "PREFIX bd: <http://www.bigdata.com/rdf#>\n" + "PREFIX wikibase: <http://wikiba.se/ontology#>\n" + "PREFIX wdt: <http://www.wikidata.org/prop/direct/>\n" + "PREFIX wd: <http://www.wikidata.org/entity/>\n" + "SELECT DISTINCT ?country ?countryLabel\n" + "WHERE\n" + "{\n" + "\t?country wdt:P31 wd:Q3624078 .\n" + " ?country wdt:P1622 wd:Q13196750.\n" + " ?country wdt:P30 wd:Q15\n" + "\tFILTER NOT EXISTS {?country wdt:P31 wd:Q3024240}\n" + "\tSERVICE wikibase:label { bd:serviceParam wikibase:language \"en\" }\n" + "}\n" + "ORDER BY ?countryLabel"; query = QueryFactory.create(queryString); qexec = QueryExecutionFactory.sparqlService("https://query.wikidata.org/", queryString); try { ResultSet results = qexec.execSelect(); ResultSetFormatter.out(System.out, results, query); } catch (Exception ex) { System.out.println(ex.getMessage()); } finally { qexec.close(); }
source share