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()); } } }