/** * Clone into another ontology with the same axioms and same manager. NB : In a future version this function may return an ontology that share axiom with * previous for memory saving. * * @param version that will have the new ontology. * @return a new ontology with the axioms of the given one. * @throws OWLOntologyCreationException if we can't create the ontology. * @since 2.5.1 */ default public OWLHelper derivate(final double version) throws OWLOntologyCreationException { final Optional<OWLHelper> result = look(this.getOntology().getOntologyID().getOntologyIRI().get(), version); if (!result.isPresent()) throw new OWLOntologyCreationException("Can't derivate to version " + version); if (result.get().getOntology().getAxiomCount() != 0) getLogger().warning(() -> "The ontology you try to derivate from " + getVersion() + " to version " + version + " already exist."); result.get().addAxioms(getOntology().axioms()); return result.get(); }
/** * Clone into another ontology with the same axioms and same manager. NB : In a future version this function may return an ontology that share axiom with * previous for memory saving. * * @param version that will have the new ontology. * @return a new ontology with the axioms of the given one. * @throws OWLOntologyCreationException if we can't create the ontology. * @since 2.5.1 */ default public OWLHelper derivate(final double version) throws OWLOntologyCreationException { final Optional<OWLHelper> result = look(this.getOntology().getOntologyID().getOntologyIRI().get(), version); if (!result.isPresent()) throw new OWLOntologyCreationException("Can't derivate to version " + version); if (result.get().getOntology().getAxiomCount() != 0) getLogger().warning(() -> "The ontology you try to derivate from " + getVersion() + " to version " + version + " already exist."); result.get().addAxioms(getOntology().axioms()); return result.get(); }
/** * Clone into another ontology with the same axioms and same manager. NB : In a future version this function may return an ontology that share axiom with * previous for memory saving. * * @param version that will have the new ontology. * @return a new ontology with the axioms of the given one. * @throws OWLOntologyCreationException if we can't create the ontology. * @since 2.5.1 */ default public OWLHelper derivate(final double version) throws OWLOntologyCreationException { final Optional<OWLHelper> result = look(this.getOntology().getOntologyID().getOntologyIRI().get(), version); if (!result.isPresent()) throw new OWLOntologyCreationException("Can't derivate to version " + version); if (result.get().getOntology().getAxiomCount() != 0) getLogger().warning(() -> "The ontology you try to derivate from " + getVersion() + " to version " + version + " already exist."); result.get().addAxioms(getOntology().axioms()); return result.get(); }
/** * Axiom are parsed from the stream then add into the ontology. * * @param input is a stream of axioms * @throws OWLOntologyCreationException if we can't load the ontology. * @throws IOException if there is an problem when reading. * @since 2.5.1 */ default public void deserializeAxiomsInto(final String input) throws OWLOntologyCreationException, IOException { try (final InputStream stream = new ByteArrayInputStream(input.getBytes())) { addAxioms(getManager().loadOntologyFromOntologyDocument(stream).axioms()); } catch (final OWLOntologyAlreadyExistsException e) { if (e.getOntologyID().equals(getOntology().getOntologyID())) { getLogger().severe("The ontology already exists with the name of the Tools : " + e.getOntologyID()); throw e; } else { getManager().removeOntology(e.getOntologyID()); deserializeAxiomsInto(input); // WARN : if the file define 2 ontologies and one is already define, then an infinite loop here can occur. } } }
/** * Axiom are parsed from the stream then add into the ontology. * * @param input is a stream of axioms * @throws OWLOntologyCreationException if we can't load the ontology. * @throws IOException if there is an problem when reading. * @since 2.5.1 */ default public void deserializeAxiomsInto(final String input) throws OWLOntologyCreationException, IOException { try (final InputStream stream = new ByteArrayInputStream(input.getBytes())) { addAxioms(getManager().loadOntologyFromOntologyDocument(stream).axioms()); } catch (final OWLOntologyAlreadyExistsException e) { if (e.getOntologyID().equals(getOntology().getOntologyID())) { getLogger().severe("The ontology already exists with the name of the Tools : " + e.getOntologyID()); throw e; } else { getManager().removeOntology(e.getOntologyID()); deserializeAxiomsInto(input); // WARN : if the file define 2 ontologies and one is already define, then an infinite loop here can occur. } } }
/** * Axiom are parsed from the stream then add into the ontology. * * @param input is a stream of axioms * @throws OWLOntologyCreationException if we can't load the ontology. * @throws IOException if there is an problem when reading. * @since 2.5.1 */ default public void deserializeAxiomsInto(final String input) throws OWLOntologyCreationException, IOException { try (final InputStream stream = new ByteArrayInputStream(input.getBytes())) { addAxioms(getManager().loadOntologyFromOntologyDocument(stream).axioms()); } catch (final OWLOntologyAlreadyExistsException e) { if (e.getOntologyID().equals(getOntology().getOntologyID())) { getLogger().severe("The ontology already exists with the name of the Tools : " + e.getOntologyID()); throw e; } else { getManager().removeOntology(e.getOntologyID()); deserializeAxiomsInto(input); // WARN : if the file define 2 ontologies and one is already define, then an infinite loop here can occur. } } }
final OWLHelper owl = new OWLGenericTools(group, ontId, false); owl.addAxioms(expected.stream());
final OWLHelper owl = new OWLGenericTools(group, ontId, false); owl.addAxioms(expected.stream());