This discussion is archived
1 Reply Latest reply: Nov 7, 2011 9:24 AM by alwu RSS

Print results

887107 Newbie
Currently Being Moderated
Hello!!
there is way to print the data from Describe and Construct queries in a table view like the data are printed from select query?
In Select Query we use
ResultSet results = qexec.execSelect();
ResultSetFormatter.out(System.out, results, query);
In Describe for example if we try to use we take back error!
Results results = qexec.execDescribe();
ResultSetFormatter.out(System.out, results, query);


if we use System.out.println("describe result = " + m.toString() ); it works but i don't want the results in a line
can anyone help?
thx a lpt
  • 1. Re: Print results
    alwu Pro
    Currently Being Moderated
    Hi,

    A describe or construct query returns a Jena Model object.
    You can invoke the listStatements API against the Jena Model object and that method will return a
    StmtIterator.

    See http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/model/StmtIterator.html

    It is straightforward to print all the statements from the iterator.

    Hope it helps,

    Zhe Wu

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points