ARQ - Querying Remote SPARQL Services

SPARQL is a query language and a remote access protocol. The remote access protocol can be used with plain HTTP or over SOAP.

See Fuseki for an implementation of the SPARQL protocol over HTTP. Fuseki uses ARQ to provide SPARQL query access to Jena models, including Jena persistent models.

ARQ includes a query engine capable of using the HTTP version.

From your application

The QueryExecutionFactory has methods for creating a QueryExecution object for remote use. QueryExecutionFactory.sparqlService

These methods build a query execution object that uses the query engine in com.hp.hpl.jena.sparql.engine.http.

The remote request is made when the execSelect, execConstruct, execDescribe or execAsk method is called.

The results are held locally after remote execution and can be processed as usual.

From the command line

The arq.sparql command can issue remote query requests using the --service argument:

java -cp ... arq.query --service 'http://host/service' 'SELECT ?s WHERE {?s [] []}'

This takes a URL that is the service location.

The query given is parsed locally to check for syntax errors before sending.

Firewalls and Proxies

Don't forget to set the proxy for Java if you are accessing a public server from behind a blocking firewall. Most home firewalls do not block outgoing requests; many corporate firewalls do block outgoing requests.

If, to use your web browser, you need to set a proxy, you need to do so for a Java program.

Simple examples include:

-DsocksProxyHost=YourSocksServer

-DsocksProxyHost=YourSocksServer -DsocksProxyPort=port

-Dhttp.proxyHost=WebProxy -Dhttp.proxyPort=Port

This can be done in the application if it is done before any network connection are made:

   System.setProperty("socksProxyHost", "socks.corp.com");

Consult the Java documentation for more details. Searching the web is also very helpful.

ARQ documentation index