1

I have a java code that load an ontology and then use it. the code work correctly when I run program using eclipse. but when I convert project to runnable jar file it can not load the ontology.it does not produce any error. It seems it tacks many many many significant time. but no matter how much I wait program still is on that line.I am using jena frame work to load ontology. hear is my code :

Rxmodel = ModelFactory.createOntologyModel();
OntDocumentManager docModel = Rxmodel.getDocumentManager();
docModel.addAltEntry("http://purl.obolibrary.org/obo/dron/dron-rxnorm.owl",
            "file:/Users/xx/Desktop/Ontology/rxnorm.owl");

try{
    Rxmodel.read("http://purl.obolibrary.org/obo/dron/dron-rxnorm.owl");
    }catch(Exception e){
        JOptionPane.showConfirmDialog(null, e.getMessage(), "Error", JOptionPane.CLOSED_OPTION, JOptionPane.PLAIN_MESSAGE);

    }

the line that program remain on it is

Rxmodel.read("http://purl.obolibrary.org/obo/dron/dron-rxnorm.owl");
Mosafer Koochooloo
  • 189
  • 1
  • 1
  • 8

1 Answers1

0

I had a similar problem when I used the 3.2.0 version of jena. It worked for me when I changed to version 3.0.0

Download: Apache Jena Version 3.0.0

It also works when creating a jar with maven using this dependency:

<dependency>
  <groupId>org.apache.jena</groupId>
  <artifactId>apache-jena-libs</artifactId>
  <type>pom</type>
  <version>3.0.0</version>
</dependency>