private void close() { try { this.ontologyModel.close(); } catch (OWLOntologyCreationException e) { this.dialogManager.showErrorMessageDialog(this.parent, e.getMessage() != null ? e.getMessage() : "", ERROR_TITLE); } } }
public void open() { JFileChooser fileChooser = this.dialogManager.createFileChooser(OPEN_TITLE, FILE_DESCRIPTION, FILE_EXTENSION); if (fileChooser.showOpenDialog(this.parent) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { this.ontologyModel.open(file); } catch (OWLOntologyCreationException e) { this.dialogManager .showErrorMessageDialog(this.parent, e.getMessage() != null ? e.getMessage() : "", ERROR_TITLE); } } } }
/** * @param e exception * @param importsDeclaration imports declaration */ public UnloadableImportException(OWLOntologyCreationException e, OWLImportsDeclaration importsDeclaration) { super("Could not load imported ontology: " + importsDeclaration.getIRI().toQuotedString() + " Cause: " + e.getMessage(), e); this.importsDeclaration = importsDeclaration; ontologyCreationException = e; }
public UnloadableImportException(OWLOntologyCreationException e, OWLImportsDeclaration importsDeclaration) { super("Could not loaded imported ontology: " + importsDeclaration.getIRI().toQuotedString() + " Cause: " + e.getMessage(), e); this.importsDeclaration = importsDeclaration; this.ontologyCreationException = e; }
/** * @param e exception * @param importsDeclaration imports declaration */ public UnloadableImportException(OWLOntologyCreationException e, OWLImportsDeclaration importsDeclaration) { super("Could not load imported ontology: " + importsDeclaration.getIRI().toQuotedString() + " Cause: " + e.getMessage(), e); this.importsDeclaration = importsDeclaration; ontologyCreationException = e; }
/** * @param e exception * @param importsDeclaration imports declaration */ public UnloadableImportException(OWLOntologyCreationException e, OWLImportsDeclaration importsDeclaration) { super("Could not load imported ontology: " + importsDeclaration.getIRI().toQuotedString() + " Cause: " + e.getMessage(), e); this.importsDeclaration = importsDeclaration; ontologyCreationException = e; }
@NonNull private static OWLOntology createOWLOntology(@NonNull OWLOntologyManager ontologyManager, @NonNull File file) throws SWRLAPIException { try { return ontologyManager.loadOntologyFromOntologyDocument(file); } catch (OWLOntologyCreationException e) { throw new SWRLAPIException( "Error create OWL ontology from file " + file.getAbsolutePath() + ": " + (e.getMessage() != null ? e.getMessage() : "")); } } }
Optional<Ontology> loadOntology() throws OntologyException { OWLAPITranslatorOWL2QL translator = getInjector().getInstance(OWLAPITranslatorOWL2QL.class); try { return loadInputOntology() .map(o -> translator.translateAndClassify(o)); } catch (OWLOntologyCreationException e) { throw new OntologyException(e.getMessage()); } }
public static void main(@NonNull String[] args) { if (args.length > 1) Usage(); Optional<@NonNull String> owlFilename = args.length == 0 ? Optional.<@NonNull String>empty() : Optional.of(args[0]); Optional<@NonNull File> owlFile = (owlFilename != null && owlFilename.isPresent()) ? Optional.of(new File(owlFilename.get())) : Optional.<@NonNull File>empty(); try { OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = owlFile.isPresent() ? ontologyManager.loadOntologyFromOntologyDocument(owlFile.get()) : ontologyManager.createOntology(); SWRLRuleEngine ruleEngine = SWRLAPIFactory.createSWRLRuleEngine(ontology); ruleEngine.infer(); } catch (OWLOntologyCreationException e) { if (owlFile.isPresent()) System.err.println("Error creating OWL ontology from file " + owlFile.get().getAbsolutePath() + ": " + ( e.getMessage() != null ? e.getMessage() : "")); else System.err.println("Error creating OWL ontology: " + (e.getMessage() != null ? e.getMessage() : "")); System.exit(-1); } catch (SWRLAPIException e) { System.err.println("SWRLAPI error: " + (e.getMessage() != null ? e.getMessage() : "")); System.exit(-1); } }
/** * Loads the ABox of the ontology in an in-memory Semantic Index. */ static OntopSemanticIndexLoader loadOntologyIndividuals(String ontologyFilePath, Properties properties) throws SemanticIndexException { try { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File(ontologyFilePath)); return OWLAPIABoxLoading.loadOntologyIndividuals(ontology, properties); } catch (OWLOntologyCreationException e) { throw new SemanticIndexException(e.getMessage()); } }
} catch (OWLOntologyCreationException e1) { String message = "OWLOntologyCreationException complete ontology NOT created. "; logger.error(message + e1.getMessage()); throw new ComponentInitException(message);
if (owlFile.isPresent()) System.err.println( "Error creating OWL ontology from file " + owlFile.get().getAbsolutePath() + ": " + (e.getMessage() != null ? e.getMessage() : "")); else System.err.println("Error creating OWL ontology: " + (e.getMessage() != null ? e.getMessage() : "")); System.exit(-1); } catch (SWRLAPIException e) {
public static String getLODEhtml(Configuration c, File lodeResources) throws Exception { try { String content = ""; String lang = c.getCurrentLanguage(); if (lang == null || "".equals(lang)) { lang = "en"; } //we have stored the ontology locally content = parseImports(c.isUseImported(), c.getMainOntology().getOWLAPIOntologyManager(), c.getMainOntology().getOWLAPIModel()); content = applyXSLTTransformation(content, c.getOntologyURI(), lang, lodeResources); return(content); } catch (OWLOntologyCreationException e) { System.err.println("Error while applying LODE. Error while applying the XLS file: "+e.getMessage()); throw e; } catch (OWLOntologyStorageException e) { System.err.println("Error while applying LODE. Error while applying the XLS file: "+e.getMessage()); throw e; } catch (URISyntaxException e) { System.err.println("Error while applying LODE. Error while applying the XLS file: "+e.getMessage()); throw e; } catch (TransformerException e) { System.err.println("Error while applying LODE. Error while applying the XLS file: "+e.getMessage()); throw e; } catch (UnsupportedEncodingException e) { System.err.println("Error while applying LODE. Error while applying the XLS file: "+e.getMessage()); throw e; } } /**
protected void loadOntology(String ontologyPath) { try { // Try ontologyPath as the path of a local file File f = new File(ontologyPath); IRI iri = IRI.create(f); ontology = manager.loadOntologyFromOntologyDocument(iri); } catch (Exception e) { // Try ontologyPath as an IRI IRI iri = IRI.create(ontologyPath); try { ontology = manager.loadOntologyFromOntologyDocument(iri); } catch (OWLOntologyCreationException ex) { printError("Could not load ontology: " + ex.getMessage()); } } }
public static OWLOntology extractTBox(OWLOntology ontology) throws SemanticIndexException { //Tbox: ontology without the ABox axioms (are in the DB now). try { OWLOntologyManager newManager = OWLManager.createOWLOntologyManager(); // TODO: there is a problem here // removing ABox from the current ontology does not remove it from the closure // so, the ABox assertions of the closure will remain OWLOntology tbox = newManager.copyOntology(ontology, OntologyCopy.SHALLOW); newManager.removeAxioms(tbox, tbox.getABoxAxioms(Imports.EXCLUDED)); return tbox; } catch (OWLOntologyCreationException e) { throw new SemanticIndexException(e.getMessage()); } } }
public void actionPerformed(ActionEvent e) { try { OWLReasonerManager reasonerManager = getOWLModelManager().getOWLReasonerManager(); ReasonerStatus status = reasonerManager.getReasonerStatus(); if (status != ReasonerStatus.INITIALIZED && status != ReasonerStatus.OUT_OF_SYNC) { ReasonerUtilities.warnUserIfReasonerIsNotConfigured(getOWLWorkspace(), reasonerManager); return; } final ExportInferredOntologyWizard wizard = new ExportInferredOntologyWizard(getOWLEditorKit()); int ret = wizard.showModalDialog(); if (ret != Wizard.FINISH_RETURN_CODE) { return; } new Thread(new ExportTask(wizard), "Export Inferred Axioms").start(); } catch (OWLOntologyCreationException e1) { JOptionPane.showMessageDialog(getWorkspace(), "Could not create ontology:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }
public void actionPerformed(ActionEvent e) { try { OWLReasonerManager reasonerManager = getOWLModelManager().getOWLReasonerManager(); ReasonerStatus status = reasonerManager.getReasonerStatus(); if (status != ReasonerStatus.INITIALIZED && status != ReasonerStatus.OUT_OF_SYNC) { ReasonerUtilities.warnUserIfReasonerIsNotConfigured(getOWLWorkspace(), reasonerManager); return; } final ExportInferredOntologyWizard wizard = new ExportInferredOntologyWizard(getOWLEditorKit()); int ret = wizard.showModalDialog(); if (ret != Wizard.FINISH_RETURN_CODE) { return; } new Thread(new ExportTask(wizard), "Export Inferred Axioms").start(); } catch (OWLOntologyCreationException e1) { JOptionPane.showMessageDialog(getWorkspace(), "Could not create ontology:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }
public void actionPerformed(ActionEvent e) { try { OWLReasonerManager reasonerManager = getOWLModelManager().getOWLReasonerManager(); ReasonerStatus status = reasonerManager.getReasonerStatus(); if (status != ReasonerStatus.INITIALIZED && status != ReasonerStatus.OUT_OF_SYNC) { ReasonerUtilities.warnUserIfReasonerIsNotConfigured(getOWLWorkspace(), reasonerManager); return; } final ExportInferredOntologyWizard wizard = new ExportInferredOntologyWizard(getOWLEditorKit()); int ret = wizard.showModalDialog(); if (ret != Wizard.FINISH_RETURN_CODE) { return; } new Thread(new ExportTask(wizard), "Export Inferred Axioms").start(); } catch (OWLOntologyCreationException e1) { JOptionPane.showMessageDialog(getWorkspace(), "Could not create ontology:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }
public void actionPerformed(ActionEvent e) { try { OWLReasonerManager reasonerManager = getOWLModelManager().getOWLReasonerManager(); ReasonerStatus status = reasonerManager.getReasonerStatus(); if (status != ReasonerStatus.INITIALIZED && status != ReasonerStatus.OUT_OF_SYNC) { ReasonerUtilities.warnUserIfReasonerIsNotConfigured(getOWLWorkspace(), reasonerManager); return; } final ExportInferredOntologyWizard wizard = new ExportInferredOntologyWizard(getOWLEditorKit()); int ret = wizard.showModalDialog(); if (ret != Wizard.FINISH_RETURN_CODE) { return; } new Thread(new ExportTask(wizard), "Export Inferred Axioms").start(); } catch (OWLOntologyCreationException e1) { JOptionPane.showMessageDialog(getWorkspace(), "Could not create ontology:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }
logger.error("There was a problem loading the ontology from {}. Error: {}", importedOntologyDocumentIRI, e.getMessage(), e); JOptionPane.showMessageDialog(editorKit.getOWLWorkspace(), "An error occurred whilst the ontology at " + importedOntologyDocumentIRI + " was being loaded.", "Error loading ontology", JOptionPane.ERROR_MESSAGE);