1
votes

I am developing a maven plugin to validate OWL ontologies using OWL-API v3.4.3 and HermiT 1.3.8.4. Some of the OWL ontologies are proprietary, and thus are not available on the Web.

Looking at the documentation, I'm using loadOntologyFromOntologyDocument() to load an OWL file to perform the validation:

OWLOntology onto = ontoManager.loadOntologyFromOntologyDocument(new File($fileName))
Reasoner hermit = new Reasoner(onto);

This works fine when the ontology does not import any proprietary ontology, but returns UnloadableImportException error otherwise. I have seen people using addIRIMapper to create a link between the ontology URI and the physical file in which the entities are defined, but I don't think it would work in my case (mostly because the file name are unknown).

Is there a way to tell the OWL API to ignore imports? If there is, I could iterate over the file in a folder and leverage OWLOntologyMerger to validate all ontologies together.

1

1 Answers

1
votes

OWLOntologyManager has a setSilentMissingImportsHandling(boolean b) that you can use. Setting he argument to true stops exceptions being thrown.

However I'm not sure why you're getting those errors - unless the check is done offline? Or the imported ontologies are not available for download. The problem I can see is that the validation carried out by HermiT will not include all ontologies that would actually be used for reasoning, so you might get false positives and false negatives from the validation.