@FunctionalInterface public interface Reducer
A Reducer object is used in a MapReduce job (see
RDFProcessors.mapReduce(Mapper, Reducer, boolean)) to process a partition of statements
associated to a certain Value key produced by a Mapper in a previous map phase
(e.g., all the statements having a specific subject).
Implementations of this interface should be thread-safe, as multiple reduce jobs can be fired
in parallel with method reduce() being invoked concurrently by different threads on
different statement partitions.
| Modifier and Type | Field and Description |
|---|---|
static Reducer |
IDENTITY
The identity reducer that emits all the quads of a partition unchanged.
|
| Modifier and Type | Method and Description |
|---|---|
static Reducer |
concat(Reducer... reducers)
Returns a
Reducer that emits the output of multiple reductions on the same quad
partition. |
static Reducer |
filter(Reducer reducer,
Predicate<org.openrdf.model.Statement> existsPredicate,
Predicate<org.openrdf.model.Statement> forallPredicate)
Returns a filtered version of the input reducer that operates only on partitions satisfying
the existential and forall predicates supplied.
|
static Mapper |
parse(String expression)
Parses a
Reducer out of the supplied expression string. |
void |
reduce(org.openrdf.model.Value key,
org.openrdf.model.Statement[] statements,
org.openrdf.rio.RDFHandler handler)
Processes the statement partition associated to a certain key, emitting output statements
to the supplied
RDFHandler. |
static final Reducer IDENTITY
static Reducer filter(Reducer reducer, @Nullable Predicate<org.openrdf.model.Statement> existsPredicate, @Nullable Predicate<org.openrdf.model.Statement> forallPredicate)
reducer - the reducer to filterexistsPredicate - the exists predicate, that must be satisfied by at least a partition quad in
order for the partition to be processed; if null no existential filtering is
doneforallPredicate - the forall predicate, that must be satisfied by all the quads of a partition in
order for it to be processed; if null, no forall filtering is appliedstatic Reducer concat(Reducer... reducers)
Reducer that emits the output of multiple reductions on the same quad
partition.reducers - the reducers whose output has to be concatenatedReducer@Nullable static Mapper parse(@Nullable String expression)
Reducer out of the supplied expression string. The expression must be a
language: expression script.expression - the expression to parsevoid reduce(@Nullable org.openrdf.model.Value key, org.openrdf.model.Statement[] statements, org.openrdf.rio.RDFHandler handler) throws org.openrdf.rio.RDFHandlerException
RDFHandler.key - the partition key, possibly nullstatements - a modifiable array with the statements belonging to the partition, not nullhandler - the RDFHandler where to emit output statements, not nullorg.openrdf.rio.RDFHandlerException - on errorCopyright © 2015–2016 FBK-irst. All rights reserved.