erfelipe
erfelipe

Reputation: 461

List Class with Apache Jena in big OWL files

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.

Upvotes: 0

Views: 97

Answers (1)

erfelipe
erfelipe

Reputation: 461

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

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

Upvotes: 1

Related Questions