On 06/01/15 01:21, [email protected] wrote:
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 }";

SELECT ?x { <...> <...> ?x . FILTER (?x = 2 ) }

though if you know the answer is 2

ASK{ { <...> <...> 2 }

return true/false depending on presence of that triple.

        Andy

QueryExecution qExec=QueryExecutionFactory.create(qs1, model);
try {
     ResultSet rs = qExec.execSelect() ;
     ResultSetFormatter.out(rs) ;
}
finally
{
     qExec.close() ;
}
the answer:
-----
| x |
=====
| 0 |
| 1 |
| 2 |
-----


Reply via email to