private void loadModel(){ model = ModelFactory.createDefaultModel(); for (KnowledgeSource ks : reasoner.getSources()) { if(ks instanceof OWLFile){ try { model.read(((OWLFile) ks).getURL().openStream(), null); } catch (IOException e) { e.printStackTrace(); } } else if(ks instanceof OWLAPIOntology){ ByteArrayInputStream bais = new ByteArrayInputStream(((OWLAPIOntology) ks).getConverter().convert(((OWLAPIOntology) ks).getOntology())); model.read(bais, null); try { bais.close(); } catch (IOException e) { e.printStackTrace(); } } } }
private void loadModel(){ model = ModelFactory.createDefaultModel(); for (KnowledgeSource ks : reasoner.getSources()) { if(ks instanceof OWLFile){ try { model.read(((OWLFile) ks).getURL().openStream(), null); } catch (IOException e) { e.printStackTrace(); } } else if(ks instanceof OWLAPIOntology){ ByteArrayInputStream bais = new ByteArrayInputStream(((OWLAPIOntology) ks).getConverter().convert(((OWLAPIOntology) ks).getOntology())); model.read(bais, null); try { bais.close(); } catch (IOException e) { e.printStackTrace(); } } } }