1

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.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353

1 Answers1

1

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.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • These are proprietary ontologies that we do not publish online, and thus are not available for download. I have used `setSilentMissingImportsHandling(true)`, but this causes the import statements to be ignored. As you describe, this will not provide a correct overview of the unsatisfiable entities in the combined ontology. Is there a way to define that certain folders should be inspected for inclusion of OWL files? Or can we define a catalog (like in protege) linking the URIs to files locations? – Quentin Reul Jun 17 '15 at 19:48
  • 1
    If all ontologies to be imported were defined in a single folder, would the problem be resolved if I use [`AutoIRIMapper`](http://owlapi.sourceforge.net/javadoc/org/semanticweb/owlapi/util/AutoIRIMapper.html)? – Quentin Reul Jun 17 '15 at 20:22
  • 1
    Yes it should work. Note that AutoIRIMapper supports only a few formats. If the ontologies are RDF/XML you should be fine. – Ignazio Jun 18 '15 at 06:24
  • @Ignazio, i've checked that OWL API 4.1.3 doesn't have this option, how to manage this in this version ? thanks – Noor Apr 17 '19 at 12:23