use of org.semanticweb.owlapi.model.MissingImportListener in project stanbol by apache.
the class ODPRegistryCacheManager method retrieveLocalResource.
private static synchronized OWLOntology retrieveLocalResource(URI uri) throws OWLOntologyCreationException, ODPRegistryCacheException, URIUnresolvableException {
File file = uris.get(uri);
if (!file.exists()) {
uris.remove(uri);
return getOntology(uri);
}
manager.setSilentMissingImportsHandling(true);
manager.addMissingImportListener(new MissingImportListener() {
public void importMissing(MissingImportEvent arg0) {
if (!getUnresolvedURIs().contains(arg0.getImportedOntologyURI()))
getUnresolvedURIs().add(arg0.getImportedOntologyURI().toURI());
}
});
IRI oi = oiri.get(uri);
OWLOntology ontology = null;
ontology = manager.getOntology(oi);
if (ontology == null)
try {
ontology = manager.loadOntologyFromOntologyDocument(IRI.create(file));
} catch (OWLOntologyAlreadyExistsException e) {
ontology = manager.getOntology(e.getOntologyID());
}
return ontology;
}
Aggregations