W3C home > Mailing lists > Public > public-lod@w3.org > June 2009

Re: programatically accessing SPARQL endpoint ( lod etc)

From: Damian Steer <d.steer@bristol.ac.uk>
Date: Wed, 10 Jun 2009 18:12:26 +0100
Cc: public-lod@w3.org
Message-Id: <B43A0D36-5558-4ABA-B611-808FA9A23FF2@bristol.ac.uk>
To: रविंदर ठाकुर (ravinder thakur) <ravinderthakur@gmail.com>

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

This archive was generated by hypermail 2.3.1 : Sunday, 31 March 2013 14:24:21 UTC