It gives me error: NoSuchElementException: QueryIteratorCloseable t com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.nextBinding(QueryIteratorBase.java:93)
On Thu, Nov 3, 2016 at 3:35 PM, neha gupta <[email protected]> wrote: > Thanks Lorenz, I did not know about this method. > > > On Thu, Nov 3, 2016 at 3:00 PM, Lorenz B. <[email protected] > leipzig.de> wrote: > >> If you know that there is exactly 1 result why does it not work to call >> just once rs.next() ? E.g. >> >> rs.next().getLiteral(THE_VAR_NAME).getLexicalForm(); >> >> Lorenz >> >> > I have a query which has output of one single string line "My name is >> ---, >> > living in city -----, located in country ----. >> > >> > After query string , I have executed the query >> > >> > Query query = QueryFactory.create(queryString); >> > QueryExecution qexec = QueryExecutionFactory.create(query, model) ; >> > ResultSet rs = qexec.execSelect() ; >> > I want this string to be displayed as string: >> > JOptionPane.showMessageDialog(null, string); >> > >> > But I dont think I need while(rs.hasNext()) and convert it to string >> > because resultset only contain one string output at one time. >> > How can I display the resultset as string? >> > >> -- >> Lorenz Bühmann >> AKSW group, University of Leipzig >> Group: http://aksw.org - semantic web research center >> >> >
