@Override @Nullable public OWLOntology getOntology(IRI iri) { OWLOntologyID ontologyID = new OWLOntologyID(optional(iri), emptyOptional()); readLock.lock(); try { OWLOntology result = ontologiesByID.get(ontologyID); if (result != null) { return result; } java.util.Optional<Entry<OWLOntologyID, OWLOntology>> findAny = ontologiesByID.entrySet().stream().filter(o -> o.getKey().match(iri)).findAny(); return findAny.isPresent() ? findAny.get().getValue() : null; } finally { readLock.unlock(); } }
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()); } } }
@Override public boolean contains(IRI iri) { checkNotNull(iri, "Ontology IRI cannot be null"); readLock.lock(); try { return ids().anyMatch(o -> o.match(iri)); } finally { readLock.unlock(); } // FIXME: ParsableOWLOntologyFactory seems to call this method with a // document/physical IRI, // but this method fails the general case where the ontology was loaded // from the given IRI directly, but was then renamed }
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()); } } }
@Override public boolean contains(IRI iri) { checkNotNull(iri, "Ontology IRI cannot be null"); readLock.lock(); try { return ids().anyMatch(o -> o.match(iri)); } finally { readLock.unlock(); } // FIXME: ParsableOWLOntologyFactory seems to call this method with a // document/physical IRI, // but this method fails the general case where the ontology was loaded // from the given IRI directly, but was then renamed }
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()); } } }
@Override public boolean contains(IRI iri) { checkNotNull(iri, "Ontology IRI cannot be null"); readLock.lock(); try { return ids().anyMatch(o -> o.match(iri)); } finally { readLock.unlock(); } // FIXME: ParsableOWLOntologyFactory seems to call this method with a // document/physical IRI, // but this method fails the general case where the ontology was loaded // from the given IRI directly, but was then renamed }
@Override public boolean contains(IRI iri) { checkNotNull(iri, "Ontology IRI cannot be null"); readLock.lock(); try { return ids().anyMatch(o -> o.match(iri)); } finally { readLock.unlock(); } // FIXME: ParsableOWLOntologyFactory seems to call this method with a // document/physical IRI, // but this method fails the general case where the ontology was loaded // from the given IRI directly, but was then renamed }
@Override @Nullable public OWLOntology getOntology(IRI iri) { OWLOntologyID ontologyID = new OWLOntologyID(optional(iri), emptyOptional()); readLock.lock(); try { OWLOntology result = ontologiesByID.get(ontologyID); if (result != null) { return result; } java.util.Optional<Entry<OWLOntologyID, OWLOntology>> findAny = ontologiesByID.entrySet().stream().filter(o -> o.getKey().match(iri)).findAny(); return findAny.isPresent() ? findAny.get().getValue() : null; } finally { readLock.unlock(); } }
@Override @Nullable public OWLOntology getOntology(IRI iri) { OWLOntologyID ontologyID = new OWLOntologyID(optional(iri), emptyOptional()); readLock.lock(); try { OWLOntology result = ontologiesByID.get(ontologyID); if (result != null) { return result; } java.util.Optional<Entry<OWLOntologyID, OWLOntology>> findAny = ontologiesByID.entrySet().stream().filter(o -> o.getKey().match(iri)).findAny(); return findAny.isPresent() ? findAny.get().getValue() : null; } finally { readLock.unlock(); } }
@Override @Nullable public OWLOntology getOntology(IRI iri) { OWLOntologyID ontologyID = new OWLOntologyID(optional(iri), emptyOptional()); readLock.lock(); try { OWLOntology result = ontologiesByID.get(ontologyID); if (result != null) { return result; } java.util.Optional<Entry<OWLOntologyID, OWLOntology>> findAny = ontologiesByID.entrySet().stream().filter(o -> o.getKey().match(iri)).findAny(); return findAny.isPresent() ? findAny.get().getValue() : null; } finally { readLock.unlock(); } }
OWLOntology ontByID = null; java.util.Optional<OWLOntologyID> findAny = ids().filter(o -> o.match(iri)).findAny(); if (findAny.isPresent()) { ontByID = ontologiesByID.get(findAny.get());
OWLOntology ontByID = null; java.util.Optional<OWLOntologyID> findAny = ids().filter(o -> o.match(iri)).findAny(); if (findAny.isPresent()) { ontByID = ontologiesByID.get(findAny.get());
OWLOntology ontByID = null; java.util.Optional<OWLOntologyID> findAny = ids().filter(o -> o.match(iri)).findAny(); if (findAny.isPresent()) { ontByID = ontologiesByID.get(findAny.get());
OWLOntology ontByID = null; java.util.Optional<OWLOntologyID> findAny = ids().filter(o -> o.match(iri)).findAny(); if (findAny.isPresent()) { ontByID = ontologiesByID.get(findAny.get());