@Override default ChangeApplied removeAxioms(OWLAxiom... axioms) { return removeAxioms(Arrays.asList(axioms)); }
@Override default ChangeApplied removeAxioms(OWLAxiom... axioms) { return removeAxioms(Arrays.asList(axioms)); }
@Override default ChangeApplied removeAxioms(OWLAxiom... axioms) { return removeAxioms(Arrays.asList(axioms)); }
@Override public ChangeApplied removeAxioms(Collection<? extends OWLAxiom> axioms) { return withWriteLock(() -> delegate.removeAxioms(axioms)); }
/** * @param axioms to change * @return true changes list * @since 2.5.1 */ default public ChangeApplied removeAxioms(final Stream<OWLAxiom> axioms) { return getOntology().removeAxioms(axioms); }
@Override public ChangeApplied removeAxioms(OWLAxiom... axioms) { return withWriteLock(() -> delegate.removeAxioms(axioms)); }
@Override public ChangeApplied removeAxioms(OWLAxiom... axioms) { return withWriteLock(() -> delegate.removeAxioms(axioms)); }
/** * @param axioms to change * @return true changes list * @since 2.5.1 */ default public ChangeApplied removeAxioms(final Stream<OWLAxiom> axioms) { return getOntology().removeAxioms(axioms); }
/** * @param axioms to change * @return true changes list * @since 2.5.1 */ default public ChangeApplied removeAxioms(final Stream<OWLAxiom> axioms) { return getOntology().removeAxioms(axioms); }
/** * Update the ontology by adding or removing the given set of axioms * * @param ontology target ontology * @param axioms the axiom to add/remove * @param add true - add; false - delete */ public static void updateOntology(final OWLOntology ontology, final Stream<? extends OWLAxiom> axioms, final boolean add) { if (add) ontology.addAxioms(axioms); else ontology.removeAxioms(axioms); }
@Override public ChangeApplied removeAxioms(Collection<? extends OWLAxiom> axioms) { return withWriteLock(() -> delegate.removeAxioms(axioms)); }
@Override public ChangeApplied removeAxioms(OWLAxiom... axioms) { return withWriteLock(() -> delegate.removeAxioms(axioms)); }
@Override public ChangeApplied removeAxioms(Collection<? extends OWLAxiom> axioms) { return withWriteLock(() -> delegate.removeAxioms(axioms)); }
@Override public ChangeApplied removeAxioms(Collection<? extends OWLAxiom> axioms) { return withWriteLock(() -> delegate.removeAxioms(axioms)); }
@Override public ChangeApplied removeAxioms(OWLAxiom... axioms) { return withWriteLock(() -> delegate.removeAxioms(axioms)); }
/** * Update the ontology by adding or removing the given set of axioms * * @param ontology target ontology * @param axioms the axiom to add/remove * @param add true - add; false - delete */ public static void updateOntology(final OWLOntology ontology, final Stream<? extends OWLAxiom> axioms, final boolean add) { if (add) ontology.addAxioms(axioms); else ontology.removeAxioms(axioms); }
/** * Update the ontology by adding or removing the given set of axioms * * @param ontology target ontology * @param axioms the axiom to add/remove * @param add true - add; false - delete */ public static void updateOntology(final OWLOntology ontology, final Stream<? extends OWLAxiom> axioms, final boolean add) { if (add) ontology.addAxioms(axioms); else ontology.removeAxioms(axioms); }
/** * Removes all annotations (non-logical axioms) from the ontology causing the ontology to be changed in an unreversible way. For any entity that is only * referenced in an annotation but no logical axiom a declaration is added so that the referenced entities by the ontology remain same. Annotations have no * semantic importance and can be ignored for reasoning purposes including generating explanations and computing modules. Removing them from the ontology * completely reduces the memory requirements which is very high for large-scale annotation-heavy ontologies. * * @param ontology the ontology being changed */ public static void removeAllAnnotations(final OWLOntology ontology) { try { final Set<OWLEntity> referencedEntities = Stream.concat(// Stream.concat(ontology.classesInSignature(), ontology.objectPropertiesInSignature()), // Stream.concat(ontology.dataPropertiesInSignature(), ontology.individualsInSignature())// ).collect(Collectors.toSet()); // Remove every thing that is not logical. ontology.removeAxioms(ontology.axioms().filter(axiom -> !axiom.isLogicalAxiom())); final OWLDataFactory factory = ontology.getOWLOntologyManager().getOWLDataFactory(); // Add exactly once declaration per entity. ontology.addAxioms(referencedEntities.stream()// .filter(entity -> !ontology.containsEntityInSignature(entity))// .map(factory::getOWLDeclarationAxiom)// ); } catch (final OWLOntologyChangeException e) { throw new OWLRuntimeException(e); } }
/** * Removes all annotations (non-logical axioms) from the ontology causing the ontology to be changed in an unreversible way. For any entity that is only * referenced in an annotation but no logical axiom a declaration is added so that the referenced entities by the ontology remain same. Annotations have no * semantic importance and can be ignored for reasoning purposes including generating explanations and computing modules. Removing them from the ontology * completely reduces the memory requirements which is very high for large-scale annotation-heavy ontologies. * * @param ontology the ontology being changed */ public static void removeAllAnnotations(final OWLOntology ontology) { try { final Set<OWLEntity> referencedEntities = Stream.concat(// Stream.concat(ontology.classesInSignature(), ontology.objectPropertiesInSignature()), // Stream.concat(ontology.dataPropertiesInSignature(), ontology.individualsInSignature())// ).collect(Collectors.toSet()); // Remove every thing that is not logical. ontology.removeAxioms(ontology.axioms().filter(axiom -> !axiom.isLogicalAxiom())); final OWLDataFactory factory = ontology.getOWLOntologyManager().getOWLDataFactory(); // Add exactly once declaration per entity. ontology.addAxioms(referencedEntities.stream()// .filter(entity -> !ontology.containsEntityInSignature(entity))// .map(factory::getOWLDeclarationAxiom)// ); } catch (final OWLOntologyChangeException e) { throw new OWLRuntimeException(e); } }
/** * Removes all annotations (non-logical axioms) from the ontology causing the ontology to be changed in an unreversible way. For any entity that is only * referenced in an annotation but no logical axiom a declaration is added so that the referenced entities by the ontology remain same. Annotations have no * semantic importance and can be ignored for reasoning purposes including generating explanations and computing modules. Removing them from the ontology * completely reduces the memory requirements which is very high for large-scale annotation-heavy ontologies. * * @param ontology the ontology being changed */ public static void removeAllAnnotations(final OWLOntology ontology) { try { final Set<OWLEntity> referencedEntities = Stream.concat(// Stream.concat(ontology.classesInSignature(), ontology.objectPropertiesInSignature()), // Stream.concat(ontology.dataPropertiesInSignature(), ontology.individualsInSignature())// ).collect(Collectors.toSet()); // Remove every thing that is not logical. ontology.removeAxioms(ontology.axioms().filter(axiom -> !axiom.isLogicalAxiom())); final OWLDataFactory factory = ontology.getOWLOntologyManager().getOWLDataFactory(); // Add exactly once declaration per entity. ontology.addAxioms(referencedEntities.stream()// .filter(entity -> !ontology.containsEntityInSignature(entity))// .map(factory::getOWLDeclarationAxiom)// ); } catch (final OWLOntologyChangeException e) { throw new OWLRuntimeException(e); } }