/** * Gets the ontologies that are managed by this manager that contain the specified axiom. * * @param axiom The axioms * @return The set of ontologies such that for each ontology, O the specified axiom is contained * in O. */ default Stream<OWLOntology> ontologies(OWLAxiom axiom) { return ontologies().filter(o -> o.containsAxiom(axiom)); }
/** * Gets the ontologies that are managed by this manager that contain the specified axiom. * * @param axiom The axioms * @return The set of ontologies such that for each ontology, O the specified axiom is contained * in O. * @deprecated use the stream method */ @Deprecated default Set<OWLOntology> getOntologies(OWLAxiom axiom) { return asSet(ontologies(axiom)); }
/** * Gets the ontologies that are managed by this manager that contain the specified axiom. * * @param axiom The axioms * @return The set of ontologies such that for each ontology, O the specified axiom is contained * in O. * @deprecated use the stream method */ @Deprecated default Set<OWLOntology> getOntologies(OWLAxiom axiom) { return asSet(ontologies(axiom)); }
/** * @Deprecated 2.5.1 use the stream version */ @Deprecated public Set<OWLOntology> getAllOntologies() { return asSet(_manager.ontologies()); }
/** * @param ontologyManager ontologyManager * @return existing pattern names */ public static Set<String> getExistingPatternNames(OWLOntologyManager ontologyManager) { return asSet( ontologyManager.ontologies().map(Utils::getExistingPatternNames).flatMap(Set::stream)); }
/** * Gets the ontologies that are managed by this manager that contain the specified axiom. * * @param axiom The axioms * @return The set of ontologies such that for each ontology, O the specified axiom is contained * in O. * @deprecated use the stream method */ @Deprecated default Set<OWLOntology> getOntologies(OWLAxiom axiom) { return asSet(ontologies(axiom)); }
/** * Gets the ontologies that are managed by this manager that contain the specified axiom. * * @param axiom The axioms * @return The set of ontologies such that for each ontology, O the specified axiom is contained * in O. */ default Stream<OWLOntology> ontologies(OWLAxiom axiom) { return ontologies().filter(o -> o.containsAxiom(axiom)); }
/** * Gets the ontologies that are managed by this manager that contain the specified axiom. * * @param axiom The axioms * @return The set of ontologies such that for each ontology, O the specified axiom is contained * in O. */ default Stream<OWLOntology> ontologies(OWLAxiom axiom) { return ontologies().filter(o -> o.containsAxiom(axiom)); }
/** * @param patternName patternName * @param ontologyManager ontologyManager * @param factory factory * @return pattern */ public static PatternModel find(String patternName, OWLOntologyManager ontologyManager, AbstractPatternModelFactory factory) { return ontologyManager.ontologies().map(p -> find(patternName, p, factory)) .filter(Objects::nonNull).findAny().orElse(null); }
/** * Gets the versions (if any) of the ontology that have the specified IRI * * @param ontology The ontology IRI * @return The set of ontologies that have the specified ontology IRI. */ default Stream<OWLOntology> versions(IRI ontology) { return ontologies().filter(o -> o.getOntologyID().matchOntology(ontology)); }
/** * Gets the versions (if any) of the ontology that have the specified IRI * * @param ontology The ontology IRI * @return The set of ontologies that have the specified ontology IRI. */ default Stream<OWLOntology> versions(IRI ontology) { return ontologies().filter(o -> o.getOntologyID().matchOntology(ontology)); }
/** * Gets the versions (if any) of the ontology that have the specified IRI * * @param ontology The ontology IRI * @return The set of ontologies that have the specified ontology IRI. */ default Stream<OWLOntology> versions(IRI ontology) { return ontologies().filter(o -> o.getOntologyID().matchOntology(ontology)); }
default Stream<OWLHelper> getPersistentsHelper() { if (!havePersistentManager()) return Stream.empty(); final OWLOntologyManager vm = getPersistentManager(); return vm.ontologies().map(ontology -> new OWLGenericTools(this, vm, ontology)); }
default Stream<OWLHelper> getVolatilesHelper() { if (!haveVolatileManager()) return Stream.empty(); final OWLOntologyManager vm = getVolatileManager(); return vm.ontologies().map(ontology -> new OWLGenericTools(this, vm, ontology)); }
/** * @return originating ontology */ public OWLOntology getOriginatingOntology() { return ontologyManager.ontologies() .filter(o -> o.annotations().anyMatch(a -> a.getProperty().getIRI().equals(iri))) .findFirst().orElse(null); }
default Stream<OWLHelper> getVolatilesHelper() { if (!haveVolatileManager()) return Stream.empty(); final OWLOntologyManager vm = getVolatileManager(); return vm.ontologies().map(ontology -> new OWLGenericTools(this, vm, ontology)); }
default Stream<OWLHelper> getVolatilesHelper() { if (!haveVolatileManager()) return Stream.empty(); final OWLOntologyManager vm = getVolatileManager(); return vm.ontologies().map(ontology -> new OWLGenericTools(this, vm, ontology)); }
default Stream<OWLHelper> getPersistentsHelper() { if (!havePersistentManager()) return Stream.empty(); final OWLOntologyManager vm = getPersistentManager(); return vm.ontologies().map(ontology -> new OWLGenericTools(this, vm, ontology)); }
private OWLOntologyManager mergeOntologiesInNewManager(final OWLOntologyManager manager) throws OWLOntologyCreationException { final OWLOntologyManager newManager = OWLManager.createOWLOntologyManager(); final OWLOntology merged = newManager.createOntology(); final List<OWLOntologyChange> changes = new ArrayList<>(); manager.ontologies().forEach(ontology -> ontology.axioms().forEach(ax -> changes.add(new AddAxiom(merged, ax)))); newManager.applyChanges(changes); return newManager; }
protected Set<OWLAnnotation> getVisitedAnnotations() { Set<OWLAnnotation> toReturn = new HashSet<>(); for (String visitedPatternName : this.visited) { IRI iri = IRI.create(PatternModel.NAMESPACE + visitedPatternName); this.getConstraintSystem().getOntologyManager().ontologies() .flatMap(OWLOntology::annotations).filter(a -> a.getProperty().getIRI().equals(iri)) .forEach(toReturn::add); } return toReturn; }