예제 #1
0
 public boolean handleDeleteFromRepositoryRequest() throws Exception {
   if (DBG) System.out.println("HG HandleDeleteFromRepositoryRequest");
   boolean success;
   HGDBOntologyManager m = (HGDBOntologyManager) this.getModelManager().getOWLOntologyManager();
   m.getOntologyRepository().printStatistics();
   // Find our Repository
   OntologyRepository repository = getProtegeRepository();
   if (repository == null)
     throw new IllegalStateException(
         "Cannot handle delete from repository. No HGOwlOntologyRepository registered with Protege.");
   // Open Repository delete dialog
   OntologyRepositoryEntry ontologyEntry = RepositoryViewPanel.showDeleteDialog(repository);
   if (ontologyEntry != null) {
     // User wants to delete ontology.
     // Do not allow deletion of any active ontology:
     if (isLoadedOntologyFromLocation(ontologyEntry.getPhysicalURI())) {
       // Dialog, cannot delete active ontology. Remove from sources
       // first.
       showDeleteCannotDeleteLoaded(ontologyEntry.getPhysicalURI());
       success = false;
     } else {
       success = handleDeleteFrom(ontologyEntry);
     }
   } else {
     success = false;
   }
   //
   if (DBG) m.getOntologyRepository().printStatistics();
   return success;
 }
예제 #2
0
 public boolean handleLoadFromRepositoryRequest() throws Exception {
   if (DBG) System.out.println("HG HandleLoadFromRepositoryRequest");
   boolean success;
   HGDBOntologyManager m = (HGDBOntologyManager) this.getModelManager().getOWLOntologyManager();
   OntologyRepository repository = getProtegeRepository();
   if (repository == null)
     throw new IllegalStateException(
         "Cannot handle load from repository. No HGOwlOntologyRepository registered with Protege.");
   // Open Repository open Dlg
   OntologyRepositoryEntry ontologyEntry = RepositoryViewPanel.showOpenDialog(repository);
   if (ontologyEntry != null) {
     if (isLoadedOntologyFromLocation(ontologyEntry.getPhysicalURI())) {
       // Dialog: database backed ontology already loaded, no reload
       // necessary.
       success = false;
     } else {
       success = handleLoadFrom(ontologyEntry.getPhysicalURI());
     }
   } else {
     success = false;
   }
   //
   m.getOntologyRepository().printStatistics();
   return success;
 }