I have query Sparql on OWL 'ressu.owl' file which created with protege 3.x.. am obliged to point to transform the resultset into something usable like JTextArea for this i work with ResultSetFormatter()
i use it like this
ResultSetFormatter.out(System.out, results, query) ;
and it give me this result in console of Netbeans:
but when i try to return System.out to String ::
com.hp.hpl.jena.query.ResultSet results = qe.execSelect();
ResultSetFormatter.out(System.out, results, query) ;
ByteArrayOutputStream go = new ByteArrayOutputStream ();
ResultSetFormatter.out((OutputStream)go ,results, query);
String result = go.toString();
jTextArea1.setText(result);
it show me in the JtextArea only
---------------------------------------------------------------
| hasnamefonctioncontrainte | hasnamefonctionprincipale
===============================================================
help Thanks a lot
result
is an iterator.
You printed it out at
ResultSetFormatter.out(System.out, results, query) ;
so now you are at the end of the iterator and the second call:
ResultSetFormatter.out((OutputStream)go ,results, query);
iterates from that point (the end) hence no rows.
Try ResultSetFactory.copyResults
to get a result set you can rewind (or just don't print it out).