eu.larkc.shared
Class SimpleSparqlClient

java.lang.Object
  extended by eu.larkc.shared.SimpleSparqlClient

public class SimpleSparqlClient
extends java.lang.Object

A very simple SPARQL client which is capable of asking queries to the LarKC platform. This code is taken mostly from the SPARQLClient GUI from the development kit.

Author:
Christoph Fuchs, Norbert Lanzanasto

Field Summary
static java.lang.String serverLocalhost
          Default address of the LarKC SPARQL server.
 
Constructor Summary
SimpleSparqlClient()
          Constructor.
SimpleSparqlClient(java.lang.String serverAddress)
          Constructor.
 
Method Summary
 java.lang.String sendQuery(java.lang.String query)
          Sends a SPARQL query to the LarKC SPARQL server specified in the constructor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverLocalhost

public static final java.lang.String serverLocalhost
Default address of the LarKC SPARQL server.

See Also:
Constant Field Values
Constructor Detail

SimpleSparqlClient

public SimpleSparqlClient()
                   throws java.net.MalformedURLException
Constructor. Uses default address of the LarKC SPARQL server (localhost:8000).

Throws:
java.net.MalformedURLException

SimpleSparqlClient

public SimpleSparqlClient(java.lang.String serverAddress)
                   throws java.net.MalformedURLException
Constructor.

Parameters:
serverAddress - the address of the LarKC SPARQL server (e.g. http://localhost:8000). A trailing forward slash ("/") will be added if missing. The path to the SPARQL endpoint will be added as well ("sparql/").
Throws:
java.net.MalformedURLException - if the URL is malformed
Method Detail

sendQuery

public java.lang.String sendQuery(java.lang.String query)
                           throws java.io.IOException
Sends a SPARQL query to the LarKC SPARQL server specified in the constructor.

Parameters:
query - the SPARQL query to send
Returns:
server response as a String
Throws:
java.io.IOException - if the server is unreachable