1

I am using JENA TDB to store a OWL file read as OntModel. The code for the same is :

public static void initializeModel(){
        dataset=TDBFactory.createDataset("Path/to/TDBDir");
        Model b = dataset.getDefaultModel();
        ontModel= ModelToOntModel(b);
        FileManager.get().readModel( ontModel, "Path/to/sourceOWL.owl");
        jListener= new JenaListener(ontModel,"MODEL");
        ontModel.register(jListener);
    }

Hereby I am facing a problem where if the owl file is change externally (specifically when we delete something form the owl file) when the application is not running and again re-run the application, the data set appears to be in an inconsistent state as per the owl file, as because the entities deleted from the owl file still persists in the ontModel (as those old entries persists in the TDB), which is not desired in our case.

Is there any way to overcome this kind of problem? so that the dataset remains consistent with my OWL file? Or is the method as shown above is not the correct way of creating TDB?

1 Answers1

1

TDB has it's own copy of the data - you need to tell it that the file is changed. In fact, all readModel operations are taking some source syntax and creating (a copy) the RDF triples to be stored in-memory or in-database.

If your file is small, empty the database and reload.

If you file is large, then if you can obtain the changes in someway, then apply the changes to the database version.

AndyS
  • 16,345
  • 17
  • 21