Thanks for your answer, but how to query when I don't know the object value.I 
want to query the latest insert  object value, without deleting the data 
inserted before .
 


[email protected]
 
From: Andy Seaborne
Date: 2015-01-06 17:39
To: users
Subject: Re: How to query the latest insert data from TDB dataset
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