public class MapReducerIgniteLocalPeek<X> extends MapReducer<X>
It accepts a list of filters, transformation `map` functions a produces a result when calling the `reduce` method (or one of its shorthand versions like `sum`, `count`, etc.).
You can set a list of filters that are applied on the raw OSM data, for example you can filter:
Depending on the used data "view", the MapReducer produces either "snapshots" or evaluated all modifications ("contributions") of the matching raw OSM data.
These data can then be transformed arbitrarily by user defined `map` functions (which take one of these entity snapshots or modifications as input an produce an arbitrary output) or `flatMap` functions (which can return an arbitrary number of results per entity snapshot/contribution). It is possible to chain together any number of transformation functions.
Finally, one can either use one of the pre-defined result-generating functions (e.g. `sum`, `count`, `average`, `uniq`), or specify a custom `reduce` procedure.
If one wants to get results that are aggregated by timestamp (or some other index), one can use the `aggregateByTimestamp` or `aggregateBy` functionality that automatically handles the grouping of the output data.
For more complex analyses, it is also possible to enable the grouping of the input data by the respective OSM ID. This can be used to view at the whole history of entities at once.
The "LocalPeek" implementation is the a very versatile implementation of the oshdb mapreducer on Ignite: It offers high performance, scalability and cancelable queries. It should be used in most situations when running oshdb- analyses on ignite.
bboxFilter, keytables, oshdb, timeout, tstamps, typeFilter| Constructor and Description |
|---|
MapReducerIgniteLocalPeek(OSHDBDatabase oshdb,
Class<? extends OSHDBMapReducible> forClass) |
| Modifier and Type | Method and Description |
|---|---|
protected MapReducer<X> |
copy() |
protected <R,S> S |
flatMapReduceCellsOSMContributionGroupedById(SerializableFunction<List<OSMContribution>,Iterable<R>> mapper,
SerializableSupplier<S> identitySupplier,
SerializableBiFunction<S,R,S> accumulator,
SerializableBinaryOperator<S> combiner)
Generic "flat" version of the map-reduce used by the `OSMContributionView`, with by-osm-id
grouped input to the `mapper` function.
|
protected <R,S> S |
flatMapReduceCellsOSMEntitySnapshotGroupedById(SerializableFunction<List<OSMEntitySnapshot>,Iterable<R>> mapper,
SerializableSupplier<S> identitySupplier,
SerializableBiFunction<S,R,S> accumulator,
SerializableBinaryOperator<S> combiner)
Generic "flat" version of the map-reduce used by the `OSMEntitySnapshotView`, with by-osm-id
grouped input to the `mapper` function.
|
boolean |
isCancelable()
Returns if the current backend can be canceled (e.g.
|
protected <R,S> S |
mapReduceCellsOSMContribution(SerializableFunction<OSMContribution,R> mapper,
SerializableSupplier<S> identitySupplier,
SerializableBiFunction<S,R,S> accumulator,
SerializableBinaryOperator<S> combiner)
Generic map-reduce used by the `OSMContributionView`.
|
protected <R,S> S |
mapReduceCellsOSMEntitySnapshot(SerializableFunction<OSMEntitySnapshot,R> mapper,
SerializableSupplier<S> identitySupplier,
SerializableBiFunction<S,R,S> accumulator,
SerializableBinaryOperator<S> combiner)
Generic map-reduce used by the `OSMEntitySnapshotView`.
|
default M |
osmType(OSMType type1,
OSMType... otherTypes)
Limits the analysis to the given osm entity types.
|
default M |
osmTypes(EnumSet<OSMType> typeFilter)
Deprecated.
replaced by
osmType(OSMType, OSMType...) |
default M |
osmTypes(OSMType type1,
OSMType... otherTypes)
Deprecated.
replaced by
osmType(OSMType, OSMType...) |
default M |
where(Collection<OSMTag> keyValuePairs)
Deprecated.
replaced by
osmTag(Collection) |
default M |
where(OSMTag tag)
Deprecated.
replaced by
osmTag(OSMTagInterface) |
default M |
where(OSMTagKey key)
Deprecated.
replaced by
osmTag(OSMTagInterface) |
default M |
where(SerializablePredicate<OSMEntity> f)
|
default M |
where(String key)
Deprecated.
replaced by
osmTag(String) |
default M |
where(String key,
Collection<String> values)
Deprecated.
replaced by
osmTag(String, Collection) |
default M |
where(String key,
Pattern valuePattern)
Deprecated.
replaced by
osmTag(String, Pattern) |
default M |
where(String key,
String value)
Deprecated.
replaced by
osmTag(String, String) |
aggregateBy, aggregateBy, aggregateByGeometry, aggregateByTimestamp, aggregateByTimestamp, areaOfInterest, areaOfInterest, average, average, collect, count, countUniq, estimatedMedian, estimatedMedian, estimatedQuantile, estimatedQuantile, estimatedQuantiles, estimatedQuantiles, estimatedQuantiles, estimatedQuantiles, filter, flatMap, flatMapStreamCellsOSMContributionGroupedById, flatMapStreamCellsOSMEntitySnapshotGroupedById, forEach, getCellIdRanges, getFilter, getPolyFilter, getPreFilter, getTagInterpreter, getTagTranslator, groupByEntity, keytables, map, mapStreamCellsOSMContribution, mapStreamCellsOSMEntitySnapshot, osmEntityFilter, osmTag, osmTag, osmTag, osmTag, osmTag, osmTag, osmType, reduce, reduce, stream, sum, sum, tagInterpreter, timestamps, timestamps, timestamps, timestamps, timestamps, uniq, uniq, weightedAveragepublic MapReducerIgniteLocalPeek(OSHDBDatabase oshdb, Class<? extends OSHDBMapReducible> forClass)
@NotNull protected MapReducer<X> copy()
copy in class MapReducer<X>public boolean isCancelable()
MapReducerisCancelable in class MapReducer<X>protected <R,S> S mapReduceCellsOSMContribution(SerializableFunction<OSMContribution,R> mapper, SerializableSupplier<S> identitySupplier, SerializableBiFunction<S,R,S> accumulator, SerializableBinaryOperator<S> combiner) throws Exception
MapReducerThe combination of the used types and identity/reducer functions must make "mathematical" sense:
Functionally, this interface is similar to Java8 Stream's reduce(identity,accumulator,combiner) interface.
mapReduceCellsOSMContribution in class MapReducer<X>R - the data type returned by the `mapper` functionS - the data type used to contain the "reduced" (intermediate and final) resultsmapper - a function that's called for each `OSMContribution`identitySupplier - a factory function that returns a new starting value to reduce results
into (e.g. when summing values, one needs to start at zero)accumulator - a function that takes a result from the `mapper` function (type <R>)
and an accumulation value (type <S>, e.g. the result of `identitySupplier()`) and
returns the "sum" of the two; contrary to `combiner`, this function is allowed to alter
(mutate) the state of the accumulation value (e.g. directly adding new values to an
existing Set object)combiner - a function that calculates the "sum" of two <S> values; this function
must be pure (have no side effects), and is not allowed to alter the state of the two
input objects it gets!Exceptionprotected <R,S> S flatMapReduceCellsOSMContributionGroupedById(SerializableFunction<List<OSMContribution>,Iterable<R>> mapper, SerializableSupplier<S> identitySupplier, SerializableBiFunction<S,R,S> accumulator, SerializableBinaryOperator<S> combiner) throws Exception
MapReducerContrary to the "normal" map-reduce, the "flat" version adds the possibility to return any number of results in the `mapper` function. Additionally, this interface provides the `mapper` function with a list of all `OSMContribution`s of a particular OSM entity. This is used to do more complex analyses that require the full edit history of the respective OSM entities as input.
The combination of the used types and identity/reducer functions must make "mathematical" sense:
Functionally, this interface is similar to Java8 Stream's reduce(identity,accumulator,combiner) interface.
flatMapReduceCellsOSMContributionGroupedById in class MapReducer<X>R - the data type returned by the `mapper` functionS - the data type used to contain the "reduced" (intermediate and final) resultsmapper - a function that's called for all `OSMContribution`s of a particular OSM entity;
returns a list of results (which can have any number of entries).identitySupplier - a factory function that returns a new starting value to reduce results
into (e.g. when summing values, one needs to start at zero)accumulator - a function that takes a result from the `mapper` function (type <R>)
and an accumulation value (type <S>, e.g. the result of `identitySupplier()`) and
returns the "sum" of the two; contrary to `combiner`, this function is allowed to alter
(mutate) the state of the accumulation value (e.g. directly adding new values to an
existing Set object)combiner - a function that calculates the "sum" of two <S> values; this function
must be pure (have no side effects), and is not allowed to alter the state of the two
input objects it gets!Exceptionprotected <R,S> S mapReduceCellsOSMEntitySnapshot(SerializableFunction<OSMEntitySnapshot,R> mapper, SerializableSupplier<S> identitySupplier, SerializableBiFunction<S,R,S> accumulator, SerializableBinaryOperator<S> combiner) throws Exception
MapReducerThe combination of the used types and identity/reducer functions must make "mathematical" sense:
Functionally, this interface is similar to Java8 Stream's reduce(identity,accumulator,combiner) interface.
mapReduceCellsOSMEntitySnapshot in class MapReducer<X>R - the data type returned by the `mapper` functionS - the data type used to contain the "reduced" (intermediate and final) resultsmapper - a function that's called for each `OSMEntitySnapshot`identitySupplier - a factory function that returns a new starting value to reduce results
into (e.g. when summing values, one needs to start at zero)accumulator - a function that takes a result from the `mapper` function (type <R>)
and an accumulation value (type <S>, e.g. the result of `identitySupplier()`) and
returns the "sum" of the two; contrary to `combiner`, this function is allowed to alter
(mutate) the state of the accumulation value (e.g. directly adding new values to an
existing Set object)combiner - a function that calculates the "sum" of two <S> values; this function
must be pure (have no side effects), and is not allowed to alter the state of the two
input objects it gets!Exceptionprotected <R,S> S flatMapReduceCellsOSMEntitySnapshotGroupedById(SerializableFunction<List<OSMEntitySnapshot>,Iterable<R>> mapper, SerializableSupplier<S> identitySupplier, SerializableBiFunction<S,R,S> accumulator, SerializableBinaryOperator<S> combiner) throws Exception
MapReducerContrary to the "normal" map-reduce, the "flat" version adds the possibility to return any number of results in the `mapper` function. Additionally, this interface provides the `mapper` function with a list of all `OSMContribution`s of a particular OSM entity. This is used to do more complex analyses that require the full list of snapshots of the respective OSM entities as input.
The combination of the used types and identity/reducer functions must make "mathematical" sense:
Functionally, this interface is similar to Java8 Stream's reduce(identity,accumulator,combiner) interface.
flatMapReduceCellsOSMEntitySnapshotGroupedById in class MapReducer<X>R - the data type returned by the `mapper` functionS - the data type used to contain the "reduced" (intermediate and final) resultsmapper - a function that's called for all `OSMEntitySnapshot`s of a particular OSM entity;
returns a list of results (which can have any number of entries)identitySupplier - a factory function that returns a new starting value to reduce results
into (e.g. when summing values, one needs to start at zero)accumulator - a function that takes a result from the `mapper` function (type <R>)
and an accumulation value (type <S>, e.g. the result of `identitySupplier()`) and
returns the "sum" of the two; contrary to `combiner`, this function is allowed to alter
(mutate) the state of the accumulation value (e.g. directly adding new values to an
existing Set object)combiner - a function that calculates the "sum" of two <S> values; this function
must be pure (have no side effects), and is not allowed to alter the state of the two
input objects it gets!Exceptionpublic M osmType(OSMType type1, OSMType... otherTypes)
type1 - the set of osm types to filter (e.g. `OSMType.NODE`)otherTypes - more osm types which should be analyzed@Deprecated public M osmTypes(EnumSet<OSMType> typeFilter)
osmType(OSMType, OSMType...)@Deprecated public M osmTypes(OSMType type1, OSMType... otherTypes)
osmType(OSMType, OSMType...)@Deprecated public M where(SerializablePredicate<OSMEntity> f)
osmEntityFilter(org.heigit.bigspatialdata.oshdb.api.generic.function.SerializablePredicate<org.heigit.bigspatialdata.oshdb.osm.OSMEntity>)@Deprecated public M where(OSMTagKey key)
osmTag(OSMTagInterface)@Deprecated public M where(String key)
osmTag(String)@Deprecated public M where(OSMTag tag)
osmTag(OSMTagInterface)@Deprecated public M where(String key, String value)
osmTag(String, String)@Deprecated public M where(String key, Collection<String> values)
osmTag(String, Collection)@Deprecated public M where(String key, Pattern valuePattern)
osmTag(String, Pattern)@Deprecated public M where(Collection<OSMTag> keyValuePairs)
osmTag(Collection)Copyright © 2016–2020 HeiGIT. All rights reserved.