Question

In Jena I'm loading an ontology into a Model, using this code:

Model model =  FileManager.get().loadModel("/path/myontology.owl");

My problem is that "myontology.owl" imports another ontology with owl:imports. In pseudo code lets just say that "Myontology.owl" imports other files to complete the ontology, since several individuals are declared in external files, e.g.:

  • In myontology.owl
  • Import → myontologywithindividuals.owl

My problem is that I can't import the ontology with its individuals into a single Model in Jena. That is,

Model model =  FileManager.get().loadModel("/path/myontology.owl");

doesn't seem to work. Any idea why? How can I import this correctly?

Was it helpful?

Solution

Plain models in Jena don't do any processing of owl:imports, because plain RDF doesn't have any notion of importing other documents. Ontology imports are an OWL concept, and you'll need to use an OntModel if you want imports processing. You may need to use setDynamicImports() to enable import processing. If the imports statements refer to ontologies using their ontology IRI, but you want to retrieve them from a local file, you may also need to setup the OntModel's OntDocumentManager and FileManager to take care of the appropriate mapping from IRIs to local files.

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