Is there a simple way to load OWL import ontologies from a local file before the remote file is being accessed?
Background: I ran into an issue with an updated ontology that is being imported by another ontology. The import statement is not versioned so the only way to avoid imported the broken ontology is to provide an older version locally.
The problem: loadOntologyFromOntologyDocument(<DOCUMENT_IRI>)
automatically loads OWL imports from their remote source.
My current attempt:
Issues: Steps 1 to 4 work but I can't get step 5 running. Ideally I would like to hold of with loading imports until step 5 and then decide whether to load the imported ontology from a remote source or a local file. It wouldn't be ideal but I could also discard the already loaded remote version and re-load the local version. Unfortunately when I just trigger loadOntologyFromOntologyDocument()
it complains because the ontology is already loaded and using removeOntology()
says Error loading the ontology: Unknown ontology
.
If you use an AutoIRIMapper
pointing at the folder containing your local version(s), the local version will be loaded before attempting to load the online version.
About the contradictory results of loading an ontology and attempting to remove it, it sounds like the problem might be that the document IRI and the ontology IRI differ - so that the ontology you're trying to remove via the document IRI is actually known as a different ontology by the manager. Might be easier to diagnose if you can share the document IRI.