OntologyScope scope = reg.getScope(scopeId);
OntologySpace cs = scope.getCustomSpace();
if (cs.hasOntology(ontIri)) {
try {
reg.setScopeActive(scopeId, false);
cs.removeOntology(ontIri);
reg.setScopeActive(scopeId, true);
} catch (OntologyCollectorModificationException e) {
reg.setScopeActive(scopeId, true);
throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
}