Hi AndyThankyou agian.Does upgrading Jena from ver 2.x to 3.x require a lot of
code changing?ThanksAbdul
From: Andy Seaborne <[email protected]>
To: [email protected]
Sent: Wednesday, 10 August 2016, 14:40
Subject: Re: Model Inconsisten
On 10/08/16 14:36, Abduladem Eljamel wrote:
> Hi Andy
> Thanks for answering my question.Is this code only for version 3.0 and higher?
It should work for earlier but I've not checked ... upgrading would be a
very good idea to pick all the improvements.
> Do we need to close the model or commit and end the dataset are enough?
No need to close.
The dataset is more important than the model, which is just a view of
part of the database.
Andy
> ThanksAbdul
>
>
>
> From: Andy Seaborne <[email protected]>
> To: [email protected]
> Sent: Wednesday, 10 August 2016, 13:13
> Subject: Re: Model Inconsisten
>
> On 10/08/16 12:57, Abduladem Eljamel wrote:
>> Hi,,I hope everyone is fine.I would like to know the difference between code
>> 1 andcode 2 below. When can each one be used for?
>> What is "NoSuchElementException" Exception andmodel inconsistent?If there is
>> a reference to cite the explanation,please tell me.
>> ThanksAbdul---------------------
>> code 1:
>> Dataset dataset = TDBFactory.createDataset(location);Model model =
>> dataset.getDefaultModel();
>> try { dataset.begin(ReadWrite.WRITE) ;
>> // write triples to model
>> dataset.commit() ;
>> } finally {
>> dataset.end() ;
>> }----------code 2:Dataset dataset =
>>TDBFactory.createDataset(location);Model model =
>>dataset.getDefaultModel();try { model.enterCriticalSection(Lock.WRITE);
>> // write triples to model
>> model.commit();
>> TDB.sync(model);
>> } finally {
>> model.leaveCriticalSection();
>> }
>>
>
> The correct form (all 3.x versions):
>
> Dataset dataset = TDBFactory.createDataset(location);
> dataset.begin(ReadWrite.WRITE) ;
> try {
> // Inside begin-commit.
> Model model = dataset.getDefaultModel();
> // write triples to model
> dataset.commit() ;
> } finally {
> dataset.end() ;
> }
>
> Andy
>
>
>
>
>