Question

I'm new to the concept of ontology and Jena, so I'm not sure I'm phrasing this correctly..

I need to read a series of connected owl files (by namespace dependencies?) into an in memory Jena model (OntModel?) so inference can be run. How do I do this? Does the order of the files matter? Do I need to call a specific method to "run the inference engine"?

Was it helpful?

Solution

This is what I did. It seems to work

    OntModel model = ModelFactory.createOntologyModel();
    for (OwlFile referencedOntology: referencedOntologyList) {
        model.getDocumentManager().addAltEntry( referencedOntology.getNamespace(), referencedOntology.getURI());
    }
    model.read(ontology.getURI());

The OwlFile object contains the URI to the ontology file as well as its namespace.

referencedOntologyList contains a list of referenced OwlFiles

ontology is the OwlFile containing the main ontology.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top