public boolean isParseable(String ontFile) { boolean isParseable = false; File f = new File(ontFile); if(!f.exists()) System.err.println("\tThe given ontology filepath '" + ontFile + "' does not point to a valid file"); else { OWLOntologyManager man = OWLManager.createOWLOntologyManager(); try{ ont = man.loadOntologyFromOntologyDocument(f); } catch(OWLOntologyCreationException e) { System.err.println("\tError parsing ontology file '" + ontFile + "' using the OWL API v" + VersionInfo.getVersionInfo().getVersion() + ":"); e.printStackTrace(); } if(ont != null) isParseable = true; } return isParseable; }
protected void initialise(){ logger.info("Using OWL API version " + VersionInfo.getVersionInfo().getVersion()); this.newPhysicalURIs = new HashSet<URI>(); modelManager = new OWLModelManagerImpl(); modelManager.setExplanationManager(new ExplanationManager(this)); modelManager.setMissingImportHandler(new MissingImportHandlerUI(this)); modelManager.setSaveErrorHandler(new SaveErrorHandler(){ public void handleErrorSavingOntology(OWLOntology ont, URI physicalURIForOntology, OWLOntologyStorageException e) throws Exception { handleSaveError(ont, physicalURIForOntology, e); } }); loadErrorHandler = new OntologyLoadErrorHandlerUI(this); modelManager.setLoadErrorHandler(loadErrorHandler); loadIOListenerPlugins(); registration = ProtegeOWL.getBundleContext().registerService(EditorKit.class.getCanonicalName(), this, new Properties()); }
public OWLEditorKit(@Nonnull OWLEditorKitFactory editorKitFactory) { super(editorKitFactory); logger.info("OWL API Version: {}", VersionInfo.getVersionInfo().getVersion()); modelManager = new OWLModelManagerImpl(); // Make sure that the workspace is not null, // but don't initialise it until our EditorKitHooks have been initialised. workspace = new OWLWorkspace(); workspace.setup(this); Initializers.loadEditorKitHooks(this); searchManagerSelector = new SearchManagerSelector(this); modelManager.addOntologyChangeListener(ontologyChangeListener); modelManager.setExplanationManager(new ExplanationManager(this)); modelManager.setMissingImportHandler(new MissingImportHandlerUI(this)); loadErrorHandler = new OntologyLoadErrorHandlerUI(this); modelManager.setLoadErrorHandler(loadErrorHandler); loadIOListenerPlugins(); registration = ProtegeOWL.getBundleContext().registerService(EditorKit.class.getCanonicalName(), this, new Hashtable<>()); // Finally load the UI workspace.initialise(); }
public OWLEditorKit(@Nonnull OWLEditorKitFactory editorKitFactory) { super(editorKitFactory); logger.info("OWL API Version: {}", VersionInfo.getVersionInfo().getVersion()); modelManager = new OWLModelManagerImpl(); // Make sure that the workspace is not null, // but don't initialise it until our EditorKitHooks have been initialised. workspace = new OWLWorkspace(); workspace.setup(this); Initializers.loadEditorKitHooks(this); searchManagerSelector = new SearchManagerSelector(this); modelManager.addOntologyChangeListener(ontologyChangeListener); modelManager.setExplanationManager(new ExplanationManager(this)); modelManager.setMissingImportHandler(new MissingImportHandlerUI(this)); loadErrorHandler = new OntologyLoadErrorHandlerUI(this); modelManager.setLoadErrorHandler(loadErrorHandler); loadIOListenerPlugins(); registration = ProtegeOWL.getBundleContext().registerService(EditorKit.class.getCanonicalName(), this, new Hashtable<>()); // Finally load the UI workspace.initialise(); }
protected void initialise() { logger.info("Using OWL API version " + VersionInfo.getVersionInfo().getVersion()); this.newPhysicalURIs = new HashSet<URI>(); modelManager = new OWLModelManagerImpl(); modelManager.setExplanationManager(new ExplanationManager(this)); modelManager.setMissingImportHandler(new MissingImportHandlerUI(this)); modelManager.setSaveErrorHandler(new SaveErrorHandler() { public void handleErrorSavingOntology(OWLOntology ont, URI physicalURIForOntology, OWLOntologyStorageException e) throws Exception { handleSaveError(ont, physicalURIForOntology, e); } }); ontologyChangeListener = new OWLOntologyChangeListener() { public void ontologiesChanged(List<? extends OWLOntologyChange> owlOntologyChanges) throws OWLException { modifiedDocument = true; } }; modelManager.addOntologyChangeListener(ontologyChangeListener); searchManager = new SearchManager(this, new SearchMetadataImportManager()); loadErrorHandler = new OntologyLoadErrorHandlerUI(this); modelManager.setLoadErrorHandler(loadErrorHandler); loadIOListenerPlugins(); registration = ProtegeOWL.getBundleContext().registerService(EditorKit.class.getCanonicalName(), this, new Hashtable<String, Object>()); getWorkspace().refreshComponents(); }