/** * @param s stream to turn to map. The stream is consumed by this operation. * @param f function to create the key * @param <T> type of key * @param <Q> type of input and value * @return map including all elements in the stream, keyed by f */ public static <T, Q> Map<T, Q> asMap(Stream<Q> s, Function<Q, T> f) { return asMap(s, f, v -> v); }
/** * @param s stream to turn to map. The stream is consumed by this operation. * @param f function to create the key * @param <T> type of key * @param <Q> type of input and value * @return map including all elements in the stream, keyed by f */ public static <T, Q> Map<T, Q> asMap(Stream<Q> s, Function<Q, T> f) { return asMap(s, f, v -> v); }
/** * @param s stream to turn to map. The stream is consumed by this operation. * @param f function to create the key * @param <T> type of key * @param <Q> type of input and value * @return map including all elements in the stream, keyed by f */ public static <T, Q> Map<T, Q> asMap(Stream<Q> s, Function<Q, T> f) { return asMap(s, f, v -> v); }
/** * Instantiates a new coerce constants into data property range. * * @param m The manager providing data factory and config to be used for the duplication. * @param ontologies the ontologies to use */ public CoerceConstantsIntoDataPropertyRange(OWLOntologyManager m, Collection<OWLOntology> ontologies) { super(m.getOWLDataFactory()); checkNotNull(ontologies, "ontologies cannot be null"); Map<OWLDataPropertyExpression, OWLDatatype> map = asMap(datatypes(ontologies), ax -> ax.getProperty(), ax -> ax .getRange().asOWLDatatype()); OWLConstantReplacer replacer = new OWLConstantReplacer(m, map); ontologies.forEach(o -> o.logicalAxioms().forEach(ax -> duplicate(replacer, o, ax))); }
/** * Instantiates a new coerce constants into data property range. * * @param m The manager providing data factory and config to be used for the duplication. * @param ontologies the ontologies to use */ public CoerceConstantsIntoDataPropertyRange(OWLOntologyManager m, Collection<OWLOntology> ontologies) { super(m.getOWLDataFactory()); checkNotNull(ontologies, "ontologies cannot be null"); Map<OWLDataPropertyExpression, OWLDatatype> map = asMap(datatypes(ontologies), ax -> ax.getProperty(), ax -> ax .getRange().asOWLDatatype()); OWLConstantReplacer replacer = new OWLConstantReplacer(m, map); ontologies.forEach(o -> o.logicalAxioms().forEach(ax -> duplicate(replacer, o, ax))); }
/** * Instantiates a new coerce constants into data property range. * * @param m The manager providing data factory and config to be used for the duplication. * @param ontologies the ontologies to use */ public CoerceConstantsIntoDataPropertyRange(OWLOntologyManager m, Collection<OWLOntology> ontologies) { super(m.getOWLDataFactory()); checkNotNull(ontologies, "ontologies cannot be null"); Map<OWLDataPropertyExpression, OWLDatatype> map = asMap(datatypes(ontologies), ax -> ax.getProperty(), ax -> ax .getRange().asOWLDatatype()); OWLConstantReplacer replacer = new OWLConstantReplacer(m, map); ontologies.forEach(o -> o.logicalAxioms().forEach(ax -> duplicate(replacer, o, ax))); }