SuhasD SuhasD - 3 months ago 7x
Java Question

OWLAPI: Use of 'Imports' enum

Is it possible to configure OWLAPI not to go for importing ontology/ontologies present inside current working ontology?


enum works? (available at org.semanticweb.owlapi.model.parameters) [An enumeration for human readable values to include/exclude imports from searches]. How to add this to OWLAPI code in JAVA ?

This enum has two constants INCLUDE and EXCLUDE.


The Imports enumeration is not related to loading imported ontologies, it is related to searching axioms in those ontologies. INCLUDE will search imported ontologies as well as the current ontology in any method call that accepts an Import parameter.

I don't believe there is any switch to just stop import resolution. You can work around this by creating an empty ontology and a SimpleIRIMapper that returns the empty ontology IRI for any input. This effectively redirects all import directives to include the empty ontology in place of actual ontologies.

Example with OWLOntologyIRIMapper:

final IRI emptyOntologyIRI=...
OWLOntologyIRIMapper mapper = new OWLOntologyIRIMapper() {
    public IRI getDocumentIRI(IRI in) {
        return emptyOntologyIRI;