0

I'm try to just list class from OBI Ontology (http://obi-ontology.org), but Jena (3.9.0) is not working in this big (not so big) OWL file.

The code is:

    public void Jena() throws FileNotFoundException {

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

    File file = new File("////Users/Documents/Ontologias/OBI/obi.owl");
    //File file = new File("////Users/Documents/Ontologias/pizza/pizza.owl");
    FileReader reader = new FileReader(file);

    System.out.println(" ** read **");
    model.read(reader, null);

    System.out.println(" ** iterador ** ");
    ExtendedIterator<OntClass> classIter = model.listNamedClasses();

    System.out.println(" ** while ** ");
    while(classIter.hasNext()) {
        OntClass ontClass = classIter.next();
        String classe = ontClass.getLocalName();
        String label  = ontClass.getLabel(null);

        System.out.println(classe + " | " + label);
    }
}

And works perfect with pizza.owl for example.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
erfelipe
  • 460
  • 4
  • 14
  • *"not working"* is meaningless with any details...and yes, reasoning can be expensive, can be on weak hardware even slower – UninformedUser Dec 15 '18 at 19:46
  • Yes, @AKSW. Not working in this case is after 17 minutes of process, the Eclipse show not enough memory to process. – erfelipe Dec 16 '18 at 21:31

1 Answers1

1

I change the OntModelSpec for a LITE config and works now.

    OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_LITE_MEM);
erfelipe
  • 460
  • 4
  • 14