Hi,
I tried update Jena from 3.1.0 to 3.2.0. And at a later point I tried to update
to Jena 3.1.1. In both cases I had the problem, that the following code didn't
work anymore.
public Model pullNamedModelFromTDB(String pathToTDB, String modelURI) {
// create a TDB-dataset
Dataset dataset = TDBFactory.createDataset(pathToTDB);
dataset.begin( ReadWrite.WRITE );
try {
// get the named model from the dataset
Model tdb = dataset.getNamedModel(modelURI);
// finish the "WRITE" transaction
dataset.commit();
return tdb;
} finally {
// close the dataset
dataset.end();
dataset.close();
// write a message if the data was successfully find in the jena tdb
System.out.println("The model " + modelURI + " was successfully loaded from
directory: " + pathToTDB);
}
}
Model defaultCompositionModel;
defaultCompositionModel =
connectionToTDB.pullNamedModelFromTDB(currDirectoryPath,
defaultCompositionNGURI);
System.out.println("close test = " + defaultCompositionModel.isClosed());
System.out.println("empty test = " + defaultCompositionModel.isEmpty());
The program stops immediatly when I try to access the data of the named model.
So is there a new/correct way to pull a Named Model from a Dataset to use it
afterward? The Code above works fine with the old versions(3.1.0 & 3.0.0). I
saw there was a change in "DatasetImpl.java"-code. A variable called "dftModel"
was removed from the code. I also saw that there was a change on Feb 8, 2017,
where an if-statement was added for the transformation from a graph in a model.
Thanks in advance!
Roman