Andy,

I found the solution this morning...:

use:   datasetGraphTDB.sync();
instead of:   TDB.sync(dataset) ;

where the datasetGraphTDB was from the DatasetGraphTransaction that was from 
the Dataset, and that seemed to work (see code below, init() method for 
reference, if interested.).

For reference only:

I am just writing a simple JenaDAO class and a JeneDAOTest junit test for ... 
testing my methods.. ;-)
Nothing too complicated...

So, between test runs, I would (or would NOT) run a maven clean that would 
delete my TDB DB, thus allowing me the test over JVM restarts, all from a 
Win/DOS cmd line... (using maven).  I was only add 1 Statement, stopping, and 
then querying...


I'm running in Winblows 7,  don't have cygwin installed, so can't run the 
tdbquery...  [I would have just for reference for ya...]
But, per maven, and clean compile and install, get the latest versions....



Is there any thoughts of writing equivalent windows .bat scripts for those unix 
scripts...?   (or an  Ant script that would work on both OS's...?)?


Thanks for the help, much appreciated!!!
 
 
Tkx,
Jim



  private void init()
  {
    String assemblerFile = "tdb-assembler.ttl";
    dataset = TDBFactory.assembleDataset(assemblerFile);
    model = dataset.getDefaultModel();
    DatasetGraphTransaction dst = (DatasetGraphTransaction) 
dataset.asDatasetGraph();
    datasetGraphTDB = dst.getBaseDatasetGraph();
    fileMgr = FileManager.get();
    fileMgr.addLocatorClassLoader(JenaDAO.class.getClassLoader());
  }


  public void addStatement(Statement statement)
  {
    model.add(statement);
    datasetGraphTDB.sync();
  }





________________________________
 From: Andy Seaborne <a...@apache.org>
To: jena-users@incubator.apache.org 
Sent: Thursday, April 19, 2012 9:50 AM
Subject: Re: Loading OWL and TDB
 
Jim,

(I'm not on a machine capable of doing anything like run an IDE or a 
Java program for a few more days)

Could you turn thins into a complete, minimal example? i.e. a piece of 
code that illustrates the undesirable effect.  Details matter here so 
there is a risk that I might misunderstand your setup details.

Also, the output from "tdbquery -version" to say which snapshots you are 
using would be useful when I get back to a big computer.

    Andy

On 18/04/12 18:30, Jim Reilly wrote:
> Andy,
>
> Thanks and that worked by the way.  I am using maven and have these setting, 
> so I get the latest:
> jena-arq:<version>2.9.1-incubating-SNAPSHOT</version>
>
> jena-tdb:<version>0.9.1-incubating-SNAPSHOT</version>
>
>
>
> Now, I am having a similar issues as before, but with using the model to add 
> a statement (vs before was TDBLoader) and the issue is between restarts of 
> the JVM.
>
>
> If, I use this:
>
>      model.add(statement);
>      TDB.sync(dataset);
>
>
>
> on a restart, I get a count of 1 with my Count query, but no visible results 
> with my All query:
>
> 1) All query:         "SELECT * {?s ?p ?o}"
> 2 ) Count query:   "SELECT (count(*) AS ?count) { ?s ?p ?o }"
>
>
>
> But, if I change the TDB.sync(dataset) to model.close(), it does work, and I 
> see the results as well as still the count of 1.
>
>
>
> So, do I need to close the model after an add, or call some other method to 
> sync, or is it a bug....???
>
>
>
> Tkx,
> Jim
>
>
>
> ________________________________
>   From: Andy Seaborne<a...@apache.org>
> To: jena-users@incubator.apache.org
> Sent: Monday, April 16, 2012 12:07 PM
> Subject: Re: Loading OWL and TDB
>
> On 16/04/12 16:33, Jim Reilly wrote:
>> Andy,
>>
>> I tried the TDB.sync without the model.close, but that did not work
>> (meaning no data shown after a JVM re-start).
>
> Lack of clarity on my part.
>
> There is a bug in the 0.9.0 release whereby sync of a dataset was not getting 
> passed down to the storage correctly (this is JENA-234). dataset.close should 
> do a sync if the dataset has not been used for transactions at all, that is, 
> it's running in 0.8 style.  The dataset implementation in TDB 0.9.0 behaves 
> non-transactionally until used in some transaction - this is to maximise 
> compatibility with existing code.
>
> Unfortunately, JENA-234 means that .close was not causing a sync and sync was 
> not getting propagated properly. Fixed now in development builds and svn.
>
> The development build 0.9.1-incubator-SNAPSHOT (via [1] as described in [2])
>
>      Andy
>
> [1] 
> https://repository.apache.org/content/repositories/snapshots/org/apache/jena/
>
> [2] http://incubator.apache.org/jena/download/maven.html

Reply via email to