Hello all,

I have some issues reading from a local file. 
The details are as follows:


— Using latest version: apache-jena-2.10.1
— Main owl file imports local file, as follows

  <owl:Ontology rdf:about="">
    <owl:imports 
rdf:resource="file:///Users/emiguelanez/sb.work/sb.dev/onto-db/ont-seed/target.owl"/>
  </owl:Ontology


— TDB is creating using ./tdbloader2, loading main owl file 
— In the application, the following code fails


                Dataset ds = TDBFactory.createDataset(repoDir) ;
                Model bModel = ds.getDefaultModel();
                OntModel aModel = ModelFactory.createOntologyModel(spec, 
bModel);

given the following exception, triggered at the creation of the OntModel

[com.hp.hpl.jena.ontology.OntDocumentManager] :: An error occurred while 
attempting to read from 
file:///Users/emiguelanez/sb.work/sb.dev/onto-db/ont-seed/target.owl. Msg was 
'Not found: 
file:///Users/emiguelanez/sb.work/sb.dev/onto-db/ont-seed/target.owl'.
com.hp.hpl.jena.shared.NotFoundException: Not found: 
file:///Users/emiguelanez/sb.work/sb.dev/onto-db/ont-seed/target.owl
        at 
com.hp.hpl.jena.util.FileManager.readModelWorker(FileManager.java:399)
        at com.hp.hpl.jena.util.FileManager.readModel(FileManager.java:345)
        at com.hp.hpl.jena.util.FileManager.readModel(FileManager.java:329)
        at 
com.hp.hpl.jena.ontology.OntDocumentManager.read(OntDocumentManager.java:1061)

— I have done two tests:

++ Test 1: run the following code

               File f = new 
File("/Users/emiguelanez/sb.work/sb.dev/onto-db/ont-seed/target.owl");
                logger.info(f.exists()); // prints "true"
                new FileManager().readModel(bModel, f.getAbsolutePath());
                logger.info("Done");

and fails

++ Test 2: run the following code

                File f = new 
File("/Users/emiguelanez/sb.work/sb.dev/onto-db/ont-seed/target.owl");
                logger.info(f.exists()); // prints "true"
                bModel.read(new FileInputStream(f),"");
                logger.info("Done");

and succeed.


I could include the code from the second test into the application, but I don't 
want to include file directories into the code.

Any ideas what is happening?

Cheers,
Emilio

--
Emilio Migueláñez Martín
[email protected]


Reply via email to