Hi People, How do you query DBPedia using sesame's SparqlRepository Class?

I am able to get it to work in the absence of a proxy. But unfortunately I am behind a proxy in office and am not able to hit it.

Get a Connect Exception.

Any solution? Thanks in Advance :)

Edit: http://sourceforge.net/mailarchive/forum.php?thread_name=7767F3FDF9BF194A9DDDD22719FD3FF523BE82307B%40ZEUS.cefriel.it&forum_name=sesame-general

Found a Link that gives an answer to this. A source code change is required apparently.

Weird ain't it? anybody else faced a similar problem?? if so did you get around to solving it??

Edit: tried with it with the following code

Tried it .....couldn't get it to work at all....

System.getProperties().put("http.proxyHost", "someproxy");

System.getProperties().put("http.proxyPort", "someport");

System.getProperties().put("http.proxyUser", "myId");

System.getProperties().put("http.proxyPassword", "password");

String endpointURL = "http://dbpedia.org/sparql";

dbpediaEndpoint = new HTTPRepository(endpointURL, "");

dbpediaEndpoint.initialize();

conn = dbpediaEndpoint.getConnection();

String sparqlQuery = " SELECT ?X ?P ?Y WHERE {?X ?P ?Y}";

TupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL,

sparqlQuery); TupleQueryResult result = query.evaluate(); // do something linked and open

Doesn't want to connect :(

Am i doing something wrong?

asked 12 Feb '13, 05:12

Avinash's gravatar image

Avinash
314
accept rate: 0%

edited 21 Feb '13, 23:16

The discussion you found is quite old, there have been some improvements since then, see my answer for details.

(12 Feb '13, 17:18) Jeen Broekstra ♦ Jeen%20Broekstra's gravatar image

You can configure HTTP proxy settings for Sesame using Java system properties. The following properties are relevant:

  • http.proxyHost should be set to the host name of your proxy.
  • http.proxyPort should be set to the proxy port number.
  • http.proxyUser (optional) should be set to a username to identify yourself at the proxy.
  • http.proxyPassword (optional) should be set to a password to identify yourself at the proxy.

Unfortunately, this currently only works for HTTPRepository, the SPARQLRepository class currently does not consider these options (this is being worked on).

However, you should be able to use the HTTPRepository class for accessing DBPedia via SPARQL in place of the SPARQLRepository. It's not normally the recommended way, but it will work. Just use the DBPedia SPARQL endpoint url as if it were a Sesame repository url. SPARQL querying will work, but most other API operations will fail.

Edit The way you are setting system properties is incorrect. Instead, use something like this:

System.setProperty("http.proxyHost", hostname);
//... etc for other properties

Or, of course, set them at runtime using java -Dhttp.proxHost=hostname -D... .

link

answered 12 Feb '13, 17:13

Jeen%20Broekstra's gravatar image

Jeen Broekstra ♦
11.5k412
accept rate: 37%

edited 22 Feb '13, 02:15

Right now all i want is querying. So let me try it out. Will Update once i give it a shot :)

(19 Feb '13, 05:00) Avinash Avinash's gravatar image

couldn't get that working also :( I have updated my question as well...don't know what's happening

(21 Feb '13, 23:17) Avinash Avinash's gravatar image

You are not setting system properties correctly. See updated answer for details.

(22 Feb '13, 02:15) Jeen Broekstra ♦ Jeen%20Broekstra's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1,268
×266
×151
×137

Asked: 12 Feb '13, 05:12

Seen: 1,693 times

Last updated: 22 Feb '13, 02:15