import java.io.*; import java.util.*; import java.net.MalformedURLException; import uk.co.magus.fourstore.client.Store; class exampleQuery { private static final String SPARQL_EP = "http://localhost:8080"; private static final String SPARQL_QUERY = "SELECT ?uri ?name ?id WHERE { ?uri ?name ; ?id } LIMIT 10"; public static void main(String args[]) { System.out.println("Am about to query a sparql endpoint"); Store store; try { store = new Store(SPARQL_EP); //simple query String response = store.query(SPARQL_QUERY,Store.OutputFormat.TAB_SEPARATED); BufferedReader br = new BufferedReader(new StringReader(response)); boolean firstLine = true; String data = ""; String[] splittArray = null; ArrayList uris = new ArrayList(); ArrayList names = new ArrayList(); ArrayList ids = new ArrayList(); while ((data = br.readLine()) != null) { //System.out.println("Print the contents from the file :" + data); if (firstLine) { firstLine = false; continue; } else { splittArray = data.split("\\t"); uris.add(splittArray[0]); names.add(splittArray[1]); ids.add(splittArray[2]); } } for (String item : names ) { System.out.println("A user name is:" + item); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }