I am working on a project which need to save multiple ontologies in one TDB. I tried to do it in my own way, but it didn\'t work. Help me please..If you know how to use TDB , co
These helper functions work for me:
/**
* get a model for the given directory
*
* @param directory
* @return
*/
public Model getModel(String directory) {
// Make a TDB-backed dataset
dataset = TDBFactory.createDataset(directory);
// open write transaction
// see http://jena.apache.org/documentation/tdb/tdb_transactions.html
dataset.begin(ReadWrite.WRITE);
Model model = dataset.getDefaultModel();
return model;
}
/**
* save the given model
* @param model
*/
public void saveModel(Model model) {
if (model != null && dataset != null) {
model.commit();
model.close();
dataset.close();
}
}
Which version of Jena?
Try putting the transaction on the dataset.
dataset.begin(ReadWrite.WRITE) ;
see http://jena.apache.org/documentation/tdb/tdb_transactions.html