I've been working with Jena, and I ran into a problem. I saw that this has 
previously been discussed, but I didn't find a conclusive answer on the Jena 
mailing list archives. I am hoping for anyone to shed some light on my problem. 
I'm getting an Allocation attempt on NodeTableReadonly exception

First, a new ontology is created, populated and stored in TDB:
       OntModel newModel = ModelFactory.createOntologyModel();
       // various things to populate the ontology model omitted

       System.out.println("Starting write:");
       Dataset dataset =TDBFactory.createDataset(directory);
                Dataset.addNamedModel("metadata", newModel);
                dataset.begin(ReadWrite.WRITE);
                try {
                      dataset.commit();
                } finally {
                     dataset.end();
                }

Then later, in another method, I want to read this ontology (and edit it):

        Dataset dataset =TDBFactory.createDataset(directory);
       System.out.println("Starting read:");
        Model model = null;
        dataset.begin(ReadWrite.READ);
        // Get model inside the transaction
        model = dataset.getNamedModel("metadata");
        dataset.end();

        OntModel ontModel =
            ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF,
                model);

The ontology model is newly created (I've deleted the TDB directory multiple 
times). But whenever I try to access the ontology model, it throws the 
exception.

However, I tried reading the ontology model in an entirely separate process, 
and it reads fine. I'm guessing there's some sort of lingering lock on the 
dataset?


Edward Swing
Applied Research Technologist
Vision Systems + Technology, Inc., a SAS Company
6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
Email: [email protected]<mailto:[email protected]>
Web: http://www.vsticorp.com<http://www.vsticorp.com/>

Reply via email to