Importing owl files

Posted by Mikae Combarado on Stack Overflow See other posts from Stack Overflow or by Mikae Combarado
Published on 2010-06-14T16:44:39Z Indexed on 2010/06/17 0:42 UTC
Read the original article Hit count: 444

Filed under:
|
|
|

Hello, I have a problem with importing owl files using owl api in Java. I successfully can import 2 owl files. However, a problem occurs, when I try to import 3 or more owl files that are integrated to each other. E.g.

Base.owl -- base ontology
Electronics.owl -- electronics ontology which imports Base.owl
Telephone.owl -- telephone ontology which imports Base.owl and Electronics.owl

When, I just import Base.owl and run Electronics.owl, it works smoothly. The code is given below:

File fileBase = new File("filepath/Base.owl");
File fileElectronic = new File("filePath/Electronic.owl");
SimpleIRIMapper iriMapper =  new SimpleIRIMapper(IRI.create("url/Base.owl"),
                IRI.create(fileBase));
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
manager.addIRIMapper(iriMapper);
OWLOntology ont = manager.loadOntologyFromOntologyDocument(fileElectronic);

However, when I want to load Telephone.owl, I just create an additional iriMapper and add it to the manager. The additional code is shown with ** :

File fileBase = new File("filepath/Base.owl");
File fileElectronic = new File("filePath/Electronic.owl");
**File fileTelephone = new File("filePath/Telephone.owl");**
SimpleIRIMapper iriMapper =  new SimpleIRIMapper(IRI.create("url/Base.owl"),
                IRI.create(fileBase));
**SimpleIRIMapper iriMapper2 =  new SimpleIRIMapper(IRI.create("url/Electronic.owl"),
                IRI.create(fileElectronic));**
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
manager.addIRIMapper(iriMapper);
**manager.addIRIMapper(iriMapper2);**
OWLOntology ont = manager.loadOntologyFromOntologyDocument(**fileTelephone**);

The code shown above gives this error :

Could not load import:        
Import(url/Electronic.owl>)
Reason: Could not loaded imported ontology:       
<url/Base.owl> Cause: null

It would be really appreciated, if someone gives me a hand... Thanks in advance...

© Stack Overflow or respective owner

Related posts about api

Related posts about import