Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

How to query the latest insert data from TDB dataset

$
0
0
I have insert three statments : subject="ind1" predicate="intID" object=0,1,2 into my TDB dataset,and I want to select the latest insert data "2",but the dataset reply all the data.
Here is the query part:
dataset.begin(ReadWrite.READ);
model=dataset.getNamedModel("http://www.semanticweb.org/HRAtest01.owl#");
String qs1 = "SELECT ?x WHERE { <http://www.semanticweb.org/HRAtest01.owl#"+sub+"> <http://www.semanticweb.org/HRAtest01.owl#"+pre+"> ?x }";
QueryExecution qExec=QueryExecutionFactory.create(qs1, model);
try {
ResultSet rs = qExec.execSelect() ;
ResultSetFormatter.out(rs) ;

finally

qExec.close() ;

the answer:

| x |
=====
| 0 |
| 1 |
| 2 |

Viewing all articles
Browse latest Browse all 5648

Trending Articles