Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to populate Data in Jtable from Sparql result

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




here ,is the code that creates a object of RdfHello and passes it to Result


The Result Gui gives an Empty Table while the textarea gives the required output
In ResultTableModel ,i have tried to populate data from resultset but it gives size=0
please help
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You never call method rdf() which actually fills the ResultSet.
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You never call method rdf() which actually fills the ResultSet.


i didn't understand .
please be more descriptive.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You defined method rdf(). This is the only method that reads any data. You do not call this method. Ergo, no data is ever read.
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry,i missed that line in the code,
rdf method is bring called.
i think there is some problem in the ResultTableModel or Result class
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then perhaps the problem is you closing the QueryExecution before reading the data from the ResultSet. I don't know how this works in the library you're using, but with JDBC you cannot read anything from a ResultSet after the (Prepared)Statement that created it has been closed. So you may want to check if the ResultSet has any data before you call qe.close(). If this is the case you need to extract the data from the ResultSet before calling this method.
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Rob
i commented


and then ran the code again .still,got the size 0
so,i put the entire code of querying in ResultTableModel ,
then,i got the desired results.

can you tell why it isn't working even after commenting


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic