Hi!
I make a simple program to test TDB but I don't reach the starting line.

I attach the code:
*************

Location directory = new Location("data/DB4");
Dataset dataset = TDBFactory.createDataset(directory);
OntModel model1 = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RDFS_INF, dataset.getNamedModel(NS));
dataset.addNamedModel("hello", model1);
dataset.close();
//the ontology is loaded at model1 perfectly

And now, I try to see if the model was saved.

 Dataset dataset2 = TDBFactory.createDataset(directory);
 Iterator<String> listNames = dataset2.listNames();
 while (listNames.hasNext()){
      String name=listNames.next();
      System.out.println(name);
 }

I hope to find the word-model "hello" but no...

I obtain the next exception:
Exception in thread "main" java.lang.NullPointerException
at com.hp.hpl.jena.tdb.store.DatasetGraphTDB.listGraphNodes(DatasetGraphTDB.java:258) at com.hp.hpl.jena.tdb.migrate.DatasetGraphTrackActive.listGraphNodes(DatasetGraphTrackActive.java:129) at com.hp.hpl.jena.sparql.core.DatasetImpl.listNames(DatasetImpl.java:232)
    at ip.testJena.App.main(App.java:52)


What is wrong with that simple example?
Thanks
Isaac


Reply via email to