/** * Determines if the change will remove an axiom from an ontology. * * @return {@code true} if the change is a RemoveAxiom change and it will remove an axiom from * an ontology, {@code false} otherwise. */ public boolean isRemoveAxiom() { return isAxiomChange() && !isAddAxiom(); }
/** * Determines if the change will remove an axiom from an ontology. * * @return {@code true} if the change is a RemoveAxiom change and it will remove an axiom from * an ontology, {@code false} otherwise. */ public boolean isRemoveAxiom() { return isAxiomChange() && !isAddAxiom(); }
/** * Determines if the change will remove an axiom from an ontology. * * @return {@code true} if the change is a RemoveAxiom change and it will remove an axiom from * an ontology, {@code false} otherwise. */ public boolean isRemoveAxiom() { return isAxiomChange() && !isAddAxiom(); }
/** * Converts a list of OWL ontology changes to a SPARQL 1.1 Update command. * * @param changes the ontology changes * @return the SPARQL 1.1 Update command */ public String convert(List<OWLOntologyChange> changes) { sb = new StringBuilder(); // sort by type of change Collections.sort(changes, (o1, o2) -> ComparisonChain.start() .compareTrueFirst(o1.isAddAxiom(), o2.isAddAxiom()) .compare(o1.getAxiom(), o2.getAxiom()) .result()); // convert to SPARQL 1.1 Update for (OWLOntologyChange change : changes) { sb.append(change instanceof RemoveAxiom ? "DELETE DATA" : "INSERT DATA"); sb.append("{"); change.getAxiom().accept(this); sb.append("}"); sb.append("\n"); } return sb.toString(); }
for (OWLOntologyChange change : rawChanges) { OWLAxiom ax = change.getAxiom(); if (change.isAddAxiom()) { if (!reasonerAxioms.contains(ax) && !reasonerAxioms.contains(ax.getAxiomWithoutAnnotations())) {
/** * Determines if a change is applicable. A change may not be applicable for a number of reasons. * * @param change The change to be tested. * @return {@code true} if the change is applicable, otherwise, {@code false}. */ private boolean isChangeApplicable(OWLOntologyChange change) { OWLOntologyLoaderConfiguration ontologyConfig = ontologyConfigurationsByOntologyID.get(change.getOntology().getOntologyID()); if (ontologyConfig != null && !ontologyConfig.isLoadAnnotationAxioms() && change.isAddAxiom() && change.getAxiom() instanceof OWLAnnotationAxiom) { return false; } return true; }
/** * Determines if a change is applicable. A change may not be applicable for a number of reasons. * * @param change The change to be tested. * @return {@code true} if the change is applicable, otherwise, {@code false}. */ private boolean isChangeApplicable(OWLOntologyChange change) { OWLOntologyLoaderConfiguration ontologyConfig = ontologyConfigurationsByOntologyID.get(change.getOntology().getOntologyID()); if (ontologyConfig != null && !ontologyConfig.isLoadAnnotationAxioms() && change.isAddAxiom() && change.getAxiom() instanceof OWLAnnotationAxiom) { return false; } return true; }
if (change.isAddAxiom()) { if(!axiomsToRemove.get(change.getOntology()).remove(change.getAxiom())) { axiomsToAdd.get(change.getOntology()).add(change.getAxiom()); if (change.isAddAxiom()) { if (axiomsToAdd.get(change.getOntology()).contains(change.getAxiom())) { minimisedChanges.add(change);
/** * Determines if a change is applicable. A change may not be applicable for a number of reasons. * * @param change The change to be tested. * @return {@code true} if the change is applicable, otherwise, {@code false}. */ private boolean isChangeApplicable(OWLOntologyChange change) { OWLOntologyLoaderConfiguration ontologyConfig = ontologyConfigurationsByOntologyID.get(change.getOntology().getOntologyID()); if (ontologyConfig != null && !ontologyConfig.isLoadAnnotationAxioms() && change.isAddAxiom() && change.getAxiom() instanceof OWLAnnotationAxiom) { return false; } return true; }
/** * Determines if a change is applicable. A change may not be applicable for a number of reasons. * * @param change The change to be tested. * @return {@code true} if the change is applicable, otherwise, {@code false}. */ private boolean isChangeApplicable(OWLOntologyChange change) { OWLOntologyLoaderConfiguration ontologyConfig = ontologyConfigurationsByOntologyID.get(change.getOntology().getOntologyID()); if (ontologyConfig != null && !ontologyConfig.isLoadAnnotationAxioms() && change.isAddAxiom() && change.getAxiom() instanceof OWLAnnotationAxiom) { return false; } return true; }
/** * Updates the active languages from the list of applied changes * * @param changes The changes. */ public synchronized void handleChanges(@Nonnull List<OWLOntologyChange> changes) { if (changes.isEmpty()) { return; } changes.stream() .filter(OWLOntologyChange::isAxiomChange) .filter(chg -> chg.getAxiom() instanceof OWLAnnotationAssertionAxiom) .filter(chg -> isLabellingAnnotation((OWLAnnotationAssertionAxiom) chg.getAxiom())) .forEach(chg -> { if (chg.isAddAxiom()) { addAxiom((OWLAnnotationAssertionAxiom) chg.getAxiom()); } else { removeAxiom((OWLAnnotationAssertionAxiom) chg.getAxiom()); } }); rebuildSortedLanguages(); }
if (change.isAddAxiom()) { if(!axiomsToRemove.get(change.getOntology()).remove(change.getAxiom())) { axiomsToAdd.get(change.getOntology()).add(change.getAxiom()); if (change.isAddAxiom()) { if (axiomsToAdd.get(change.getOntology()).contains(change.getAxiom())) { minimisedChanges.add(change);
if (change.isAddAxiom()) { OntologyAxiomPair pair = OntologyAxiomPair.get(change.getOntology(), change.getAxiom()); if(!removals.remove(pair)) { if (change.isAddAxiom()) { OntologyAxiomPair pair = OntologyAxiomPair.get(change.getOntology(), change.getAxiom()); if (additions.contains(pair)) {
@Override public void ontologiesChanged(List<? extends OWLOntologyChange> changes) { for (OWLOntologyChange change : changes) { if (!change.isAxiomChange() || !contains(ontology.importsClosure(), change.getOntology())) { continue; } OWLAxiom axiom = change.getAxiom(); if (change.isAddAxiom()) { addAxiom(axiom); } else if (change.isRemoveAxiom()) { removeAxiom(axiom); } else { throw new UnsupportedOperationException("Unrecognized axiom change: " + change); } } } }
@Override public void ontologiesChanged(List<? extends OWLOntologyChange> changes) { for (OWLOntologyChange change : changes) { if (!change.isAxiomChange() || !contains(ontology.importsClosure(), change.getOntology())) { continue; } OWLAxiom axiom = change.getAxiom(); if (change.isAddAxiom()) { addAxiom(axiom); } else if (change.isRemoveAxiom()) { removeAxiom(axiom); } else { throw new UnsupportedOperationException("Unrecognized axiom change: " + change); } } } }
@Override public void ontologiesChanged(List<? extends OWLOntologyChange> changes) { for (OWLOntologyChange change : changes) { if (!change.isAxiomChange() || !contains(ontology.importsClosure(), change.getOntology())) { continue; } OWLAxiom axiom = change.getAxiom(); if (change.isAddAxiom()) { addAxiom(axiom); } else if (change.isRemoveAxiom()) { removeAxiom(axiom); } else { throw new UnsupportedOperationException("Unrecognized axiom change: " + change); } } } }
@Override public void ontologiesChanged(List<? extends OWLOntologyChange> changes) { for (OWLOntologyChange change : changes) { if (!change.isAxiomChange() || !contains(ontology.importsClosure(), change.getOntology())) { continue; } OWLAxiom axiom = change.getAxiom(); if (change.isAddAxiom()) { addAxiom(axiom); } else if (change.isRemoveAxiom()) { removeAxiom(axiom); } else { throw new UnsupportedOperationException("Unrecognized axiom change: " + change); } } } }