@Override public void setup(final Reducer.Context context) throws IOException, InterruptedException { this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION)); if (!this.direction.equals(BOTH)) this.direction = this.direction.opposite(); this.labels = context.getConfiguration().getStrings(LABELS); this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false)); }
public static Configuration createConfiguration(final Direction direction) { final Configuration configuration = new EmptyConfiguration(); configuration.set(DIRECTION, direction.name()); return configuration; }
@Override public void setup(final Reducer.Context context) throws IOException, InterruptedException { this.direction = Direction.valueOf(context.getConfiguration().get(LinkMapReduce.DIRECTION)); this.direction = this.direction.opposite(); this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false)); }
public Object processEdge(final Range annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Edge edge, final Direction direction) { return framedGraph.frame(edge.getVertex(direction.opposite()), method.getReturnType()); }
@Override public void setup(final Mapper.Context context) throws IOException, InterruptedException { this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION)); }
public Object processEdge(final Range annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Edge edge, final Direction direction) { return framedGraph.frame(edge.getVertex(direction.opposite()), method.getReturnType()); }
@Override public void setup(final Reducer.Context context) throws IOException, InterruptedException { this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION)); this.direction = this.direction.opposite(); this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false)); }
@Override public void setup(final Mapper.Context context) throws IOException, InterruptedException { this.step = context.getConfiguration().getInt(STEP, -1); this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION)); this.label = context.getConfiguration().get(LABEL); this.mergeDuplicates = context.getConfiguration().getBoolean(MERGE_DUPLICATES, false); this.mergeWeightKey = context.getConfiguration().get(MERGE_WEIGHT_KEY, NO_WEIGHT_KEY); this.pathEnabled = context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false); if (!this.pathEnabled) throw new IllegalStateException(LinkMapReduce.class.getSimpleName() + " requires that paths be enabled"); }
private LinkPipe(final Direction direction, final String label) { this.direction = direction; this.label = label; if (direction.equals(Direction.BOTH)) this.sideEffect = new ArrayList<Edge>(); }
private void removeEdges(final Direction direction, final String label, final Vertex element, final Vertex otherVertex, final FramedGraph framedGraph) { for (final Edge edge : element.getEdges(direction, label)) { if (null == otherVertex || edge.getVertex(direction.opposite()).equals(otherVertex)) { framedGraph.removeEdge(edge); } } } }
public static Configuration createConfiguration(final Direction direction, final String... labels) { final Configuration configuration = new EmptyConfiguration(); configuration.set(DIRECTION, direction.name()); configuration.setStrings(LABELS, labels); return configuration; }
@Override public void setup(final Mapper.Context context) throws IOException, InterruptedException { this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION)); this.labels = context.getConfiguration().getStrings(LABELS, new String[0]); this.pathEnabled = context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false); this.edge = new FaunusEdge(this.pathEnabled); }
private void removeEdges(final Direction direction, final String label, final Vertex element, final Vertex otherVertex, final FramedGraph framedGraph) { for (final Edge edge : element.getEdges(direction, label)) { if (null == otherVertex || edge.getVertex(direction.opposite()).equals(otherVertex)) { framedGraph.removeEdge(edge); } } } }
public static Configuration createConfiguration(final Direction direction, final String... labels) { final Configuration configuration = new EmptyConfiguration(); configuration.set(DIRECTION, direction.name()); configuration.setStrings(LABELS, labels); return configuration; }
@Override public void setup(final Mapper.Context context) throws IOException, InterruptedException { this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION)); this.labels = context.getConfiguration().getStrings(LABELS, new String[0]); this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false)); }
@Override public void reduce(final LongWritable key, final Iterable<Holder<FaunusVertex>> values, final Reducer<LongWritable, Holder<FaunusVertex>, NullWritable, FaunusVertex>.Context context) throws IOException, InterruptedException { long edgesAggregated = 0; this.vertex.reuse(key.get()); for (final Holder<FaunusVertex> holder : values) { if (holder.getTag() == 's') { edgesAggregated = edgesAggregated + ((List) holder.get().getEdges(direction.opposite())).size(); this.vertex.addEdges(direction.opposite(), holder.get()); } else { this.vertex.addAll(holder.get()); } } context.write(NullWritable.get(), this.vertex); context.getCounter(Counters.EDGES_ADDED).increment(edgesAggregated); } }
public String toString() { return PipeHelper.makePipeString(this, direction.name().toLowerCase(), Arrays.asList(labels)); } }