private void checkForImportsChange(OWLOntologyChange change) { // Called by a write lock holder if (change.isImportChange()) { resetImportsClosureCache(); if (change instanceof AddImport) { OWLImportsDeclaration addImportDeclaration = ((AddImport) change).getImportDeclaration(); IRI iri = addImportDeclaration.getIRI(); java.util.Optional<OWLOntologyID> findFirst = ids().filter(o -> o.match(iri) || o.matchDocument(iri)).findFirst(); findFirst .ifPresent(o -> ontologyIDsByImportsDeclaration.put(addImportDeclaration, o)); if (!findFirst.isPresent()) { // then the import does not refer to a known IRI for // ontologies; check for a document IRI to find the ontology // id corresponding to the file location documentIRIsByID.entrySet().stream().filter(o -> o.getValue().equals(iri)) .findAny().ifPresent(o -> ontologyIDsByImportsDeclaration .put(addImportDeclaration, o.getKey())); } } else { // Remove the mapping from declaration to ontology OWLImportsDeclaration importDeclaration = ((RemoveImport) change).getImportDeclaration(); ontologyIDsByImportsDeclaration.remove(importDeclaration); importedIRIs.remove(importDeclaration.getIRI()); } } }
private void checkForImportsChange(OWLOntologyChange change) { // Called by a write lock holder if (change.isImportChange()) { resetImportsClosureCache(); if (change instanceof AddImport) { OWLImportsDeclaration addImportDeclaration = ((AddImport) change).getImportDeclaration(); IRI iri = addImportDeclaration.getIRI(); java.util.Optional<OWLOntologyID> findFirst = ids().filter(o -> o.match(iri) || o.matchDocument(iri)).findFirst(); findFirst .ifPresent(o -> ontologyIDsByImportsDeclaration.put(addImportDeclaration, o)); if (!findFirst.isPresent()) { // then the import does not refer to a known IRI for // ontologies; check for a document IRI to find the ontology // id corresponding to the file location documentIRIsByID.entrySet().stream().filter(o -> o.getValue().equals(iri)) .findAny().ifPresent(o -> ontologyIDsByImportsDeclaration .put(addImportDeclaration, o.getKey())); } } else { // Remove the mapping from declaration to ontology OWLImportsDeclaration importDeclaration = ((RemoveImport) change).getImportDeclaration(); ontologyIDsByImportsDeclaration.remove(importDeclaration); importedIRIs.remove(importDeclaration.getIRI()); } } }
private void checkForImportsChange(OWLOntologyChange change) { // Called by a write lock holder if (change.isImportChange()) { resetImportsClosureCache(); if (change instanceof AddImport) { OWLImportsDeclaration addImportDeclaration = ((AddImport) change).getImportDeclaration(); IRI iri = addImportDeclaration.getIRI(); java.util.Optional<OWLOntologyID> findFirst = ids().filter(o -> o.match(iri) || o.matchDocument(iri)).findFirst(); findFirst .ifPresent(o -> ontologyIDsByImportsDeclaration.put(addImportDeclaration, o)); if (!findFirst.isPresent()) { // then the import does not refer to a known IRI for // ontologies; check for a document IRI to find the ontology // id corresponding to the file location documentIRIsByID.entrySet().stream().filter(o -> o.getValue().equals(iri)) .findAny().ifPresent(o -> ontologyIDsByImportsDeclaration .put(addImportDeclaration, o.getKey())); } } else { // Remove the mapping from declaration to ontology OWLImportsDeclaration importDeclaration = ((RemoveImport) change).getImportDeclaration(); ontologyIDsByImportsDeclaration.remove(importDeclaration); importedIRIs.remove(importDeclaration.getIRI()); } } }
private void checkForImportsChange(OWLOntologyChange change) { // Called by a write lock holder if (change.isImportChange()) { resetImportsClosureCache(); if (change instanceof AddImport) { OWLImportsDeclaration addImportDeclaration = ((AddImport) change).getImportDeclaration(); IRI iri = addImportDeclaration.getIRI(); java.util.Optional<OWLOntologyID> findFirst = ids().filter(o -> o.match(iri) || o.matchDocument(iri)).findFirst(); findFirst .ifPresent(o -> ontologyIDsByImportsDeclaration.put(addImportDeclaration, o)); if (!findFirst.isPresent()) { // then the import does not refer to a known IRI for // ontologies; check for a document IRI to find the ontology // id corresponding to the file location documentIRIsByID.entrySet().stream().filter(o -> o.getValue().equals(iri)) .findAny().ifPresent(o -> ontologyIDsByImportsDeclaration .put(addImportDeclaration, o.getKey())); } } else { // Remove the mapping from declaration to ontology OWLImportsDeclaration importDeclaration = ((RemoveImport) change).getImportDeclaration(); ontologyIDsByImportsDeclaration.remove(importDeclaration); importedIRIs.remove(importDeclaration.getIRI()); } } }
private void checkForImportsChange(OWLOntologyChange change) { if (change.isImportChange()) { resetImportsClosureCache(); if(change instanceof AddImport) { // Do we contain the import already? for(OWLOntologyID id : ontologiesByID.keySet()) { OWLImportsDeclaration addImportDeclaration = ((AddImport) change).getImportDeclaration(); if(id.getDefaultDocumentIRI() != null && id.getDefaultDocumentIRI().equals(addImportDeclaration.getIRI())) { // Yes we do ontologyIDsByImportsDeclaration.put(addImportDeclaration, id); } } } else { // Remove the mapping from declaration to ontology ontologyIDsByImportsDeclaration.remove(((RemoveImport) change).getImportDeclaration()); } } }
public void ontologiesChanged(List<? extends OWLOntologyChange> changes) { getHistoryManager().logChanges(changes); boolean refreshActiveOntology = false; for (OWLOntologyChange change : changes) { dirtyOntologies.add(change.getOntology()); if (change.isImportChange()){ refreshActiveOntology = true; } } if (refreshActiveOntology){ setActiveOntology(getActiveOntology(), true); } }
public void ontologiesChanged(List<? extends OWLOntologyChange> changes) { if (changes.isEmpty()) { return; } getHistoryManager().logChanges(changes); boolean refreshActiveOntology = false; for (OWLOntologyChange change : changes) { if (change instanceof SetOntologyID) { SetOntologyID ontologyIDChange = (SetOntologyID) change; dirtyOntologies.remove(ontologyIDChange.getOriginalOntologyID()); } dirtyOntologies.add(change.getOntology().getOntologyID()); if (change.isImportChange()) { refreshActiveOntology = true; } } if (refreshActiveOntology) { setActiveOntology(getActiveOntology(), true); } }
public void ontologiesChanged(List<? extends OWLOntologyChange> changes) { getHistoryManager().logChanges(changes); boolean refreshActiveOntology = false; for (OWLOntologyChange change : changes) { if (change instanceof SetOntologyID) { SetOntologyID ontologyIDChange = (SetOntologyID) change; dirtyOntologies.remove(ontologyIDChange.getOriginalOntologyID()); } dirtyOntologies.add(change.getOntology().getOntologyID()); if (change.isImportChange()) { refreshActiveOntology = true; } } if (refreshActiveOntology) { setActiveOntology(getActiveOntology(), true); } }
public void ontologiesChanged(@Nonnull List<? extends OWLOntologyChange> changes) { if(changes.isEmpty()) { return; } deprecationCache.handleOntologyChanges(changes, getActiveOntologies()); getHistoryManager().logChanges(changes); boolean refreshActiveOntology = false; for(OWLOntologyChange change : changes) { if(change instanceof SetOntologyID) { SetOntologyID ontologyIDChange = (SetOntologyID) change; dirtyOntologies.remove(ontologyIDChange.getOriginalOntologyID()); } dirtyOntologies.add(change.getOntology().getOntologyID()); if(change.isImportChange()) { refreshActiveOntology = true; } } if(refreshActiveOntology) { setActiveOntology(getActiveOntology(), true); } }