I want to query the endpoint of wordnet from java code using http get. I get the connection to the endpoint "wordnet.rkbexplorer.com" but I get an error, that sparsql-query is not correct. The query itself is executed, when I just type it on the website of wordnet.rkbexplorer.com. Is the syntax of my URL for GTTP GET not correct? I have not much experience in that area.
My code:
URL url = new URL("http://wordnet.rkbexplorer.com/sparql/?query="+query);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
String query = "PREFIX id: <http://wordnet.rkbexplorer.com/id/> "
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
+ "SELECT * WHERE { ?s rdfs:label ?o } LIMIT 10";
Error:
error at URI 3store:default#:1 - syntax error, unexpected $end, expecting identifier