In the general case you cannot do this unless as part of your insert you
include some form of time stamp/provenance information that you can test
for

TDB does not keep any record of when a specific piece of data was inserted
so if you want this functionality you need to implement it as part of your
data model and application logic

Rob

On 06/01/2015 10:51, "[email protected]" <[email protected]> wrote:

>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