Re: programatically accessing SPARQL endpoint ( lod etc)

On 10 Jun 2009, at 16:52, रविंदर ठाकुर (ravinder  
thakur) wrote:

> hello friends
>
>
> has anyone written some code to programatically query any of the  
> SPARQL
> endpoints (esp lod data at lod.openlinksw.com in java) ? if so it  
> would be
> awesome if he/she can share the sample code or the documentation  
> needed for
> this.

It isn't very difficult to query using java's httpurlconnection [1]  
and xml facilities to deal with the results of SELECT and ASK. Just  
construct a url like "http://example.com/sparql?query=" +  
URLEncoder.encode(queryString, "UTF-8")

However if you want something full featured there is ARQ's  
sparqlService [2], which will deal with the messy details for you. [3]

Damian

[1] <http://java.sun.com/j2se/1.5.0/docs/api/javax/net/ssl/HttpsURLConnection.html 
 >
[2] <http://jena.sourceforge.net/ARQ/javadoc/com/hp/hpl/jena/query/QueryExecutionFactory.html#sparqlService(java.lang.String,%20com.hp.hpl.jena.query.Query) 
 >
[3] <http://jena.sourceforge.net/ARQ/app_api.html>

Received on Wednesday, 10 June 2009 17:13:34 UTC