use of org.apache.stanbol.ontologymanager.servicesapi.ontology.OntologyHandleException in project stanbol by apache.
the class RootResource method deleteOntology.
@DELETE
@Path("/{ontologyId:.+}")
public Response deleteOntology(@PathParam("ontologyId") String ontologyId, @Context HttpHeaders headers) {
OWLOntologyID key = OntologyUtils.decode(ontologyId);
ResponseBuilder rb;
try {
if (!ontologyProvider.hasOntology(key)) {
rb = Response.status(NOT_FOUND);
} else {
try {
// TODO check aliases!
ontologyProvider.removeOntology(key);
rb = Response.ok();
} catch (OntologyHandleException e) {
rb = Response.status(CONFLICT);
}
}
} catch (OrphanOntologyKeyException e) {
log.warn("Orphan ontology key {}. No associated graph found in store.", e.getOntologyKey());
rb = Response.status(NOT_FOUND);
}
// addCORSOrigin(servletContext, rb, headers);
return rb.build();
}
use of org.apache.stanbol.ontologymanager.servicesapi.ontology.OntologyHandleException in project stanbol by apache.
the class ClerezzaOntologyProvider method removeOntology.
@Override
public boolean removeOntology(OWLOntologyID publicKey) throws OntologyHandleException {
if (descriptor.getDependents(publicKey).isEmpty() && descriptor.getHandles(publicKey).isEmpty()) {
IRI graphName = keymap.getMapping(publicKey);
// TODO propagate everything to the descriptor
// release dependencies
descriptor.clearDependencies(publicKey);
// remove metadata
keymap.registerOntologyDeletion(publicKey);
// Now the actual deletion
store.deleteGraph(graphName);
return true;
} else
throw new OntologyHandleException("There are ontologies or collectors depending on " + publicKey + "Those handles must be released first.");
}
Aggregations