@Override public Stream<OWLOntology> imports(OWLOntology ontology) { readLock.lock(); try { // XXX caches for imports and imports closure sets with Caffeine return getImports(ontology, new TreeSet<>()).stream(); } finally { readLock.unlock(); } }
@Override public Stream<OWLOntology> imports(OWLOntology ontology) { readLock.lock(); try { // XXX caches for imports and imports closure sets with Caffeine return getImports(ontology, new TreeSet<>()).stream(); } finally { readLock.unlock(); } }
@Override public Stream<OWLOntology> imports(OWLOntology ontology) { readLock.lock(); try { // XXX caches for imports and imports closure sets with Caffeine return getImports(ontology, new TreeSet<>()).stream(); } finally { readLock.unlock(); } }
@Override public Stream<OWLOntology> imports(OWLOntology ontology) { readLock.lock(); try { // XXX caches for imports and imports closure sets with Caffeine return getImports(ontology, new TreeSet<>()).stream(); } finally { readLock.unlock(); } }
/** * A method that gets the imports of a given ontology * * @param ont The ontology whose (transitive) imports are to be retrieved. * @param result A place to store the result - the transitive closure of the imports will be stored in this * result set. */ private void getImports(OWLOntology ont, Set<OWLOntology> result) { for (OWLOntology directImport : getDirectImports(ont)) { if (result.add(directImport)) { getImports(directImport, result); } } }
/** * A method that gets the imports of a given ontology. * * @param ont The ontology whose (transitive) imports are to be retrieved. * @param result A place to store the result - the transitive closure of the imports will be * stored in this result set. * @return modified result */ private Set<OWLOntology> getImports(OWLOntology ont, Set<OWLOntology> result) { readLock.lock(); try { directImports(ont).filter(result::add).forEach(o -> getImports(o, result)); return result; } finally { readLock.unlock(); } }
/** * A method that gets the imports of a given ontology. * * @param ont The ontology whose (transitive) imports are to be retrieved. * @param result A place to store the result - the transitive closure of the imports will be * stored in this result set. * @return modified result */ private Set<OWLOntology> getImports(OWLOntology ont, Set<OWLOntology> result) { readLock.lock(); try { directImports(ont).filter(result::add).forEach(o -> getImports(o, result)); return result; } finally { readLock.unlock(); } }
/** * A method that gets the imports of a given ontology. * * @param ont The ontology whose (transitive) imports are to be retrieved. * @param result A place to store the result - the transitive closure of the imports will be * stored in this result set. * @return modified result */ private Set<OWLOntology> getImports(OWLOntology ont, Set<OWLOntology> result) { readLock.lock(); try { directImports(ont).filter(result::add).forEach(o -> getImports(o, result)); return result; } finally { readLock.unlock(); } }
/** * A method that gets the imports of a given ontology. * * @param ont The ontology whose (transitive) imports are to be retrieved. * @param result A place to store the result - the transitive closure of the imports will be * stored in this result set. * @return modified result */ private Set<OWLOntology> getImports(OWLOntology ont, Set<OWLOntology> result) { readLock.lock(); try { directImports(ont).filter(result::add).forEach(o -> getImports(o, result)); return result; } finally { readLock.unlock(); } }
/** * Gets the set of ontologies that are in the transitive closure of the directly imports relation. * * @param ontology The ontology whose imports are to be retrieved. * @return A set of <code>OWLOntology</code>ies that are in the transitive closure of the directly imports relation * of this ontology. If, for what ever reason, an imported ontology could not be loaded, then it will not be contained in the * returned set of ontologies. * * @throws org.semanticweb.owlapi.model.UnknownOWLOntologyException * if there isn't an ontology in this manager which has the specified IRI. */ public Set<OWLOntology> getImports(OWLOntology ontology) throws UnknownOWLOntologyException { if (!contains(ontology)) { throw new UnknownOWLOntologyException(ontology.getOntologyID()); } Set<OWLOntology> result = new HashSet<OWLOntology>(); getImports(ontology, result); return result; }