nonForwardedSecond = ((NonForwardedFieldsSecond) ann).value(); } else if (ann instanceof ReadFieldsFirst) { readFirst = ((ReadFieldsFirst) ann).value(); } else if (ann instanceof ReadFieldsSecond) { readSecond = ((ReadFieldsSecond) ann).value();
@FunctionAnnotation.ReadFieldsFirst("f1.f1") @FunctionAnnotation.ReadFieldsSecond("f0;f2") @FunctionAnnotation.ForwardedFieldsFirst("f1.f0")
@FunctionAnnotation.ReadFieldsFirst("f1.f0") @FunctionAnnotation.ReadFieldsSecond("f0") public class UpdateVertexMapping<K>
@FunctionAnnotation.ReadFieldsFirst("f1.f1") @FunctionAnnotation.ReadFieldsSecond("f0;f2") @FunctionAnnotation.ForwardedFieldsFirst("f1.f0")
@FunctionAnnotation.ReadFieldsFirst("f1.f0") @FunctionAnnotation.ReadFieldsSecond("f0") public class UpdateVertexMapping<K>
nonForwardedSecond = ((NonForwardedFieldsSecond) ann).value(); } else if (ann instanceof ReadFieldsFirst) { readFirst = ((ReadFieldsFirst) ann).value(); } else if (ann instanceof ReadFieldsSecond) { readSecond = ((ReadFieldsSecond) ann).value();
@FunctionAnnotation.ReadFieldsFirst("f1") public class GraphElementsHeadsToTransaction implements CoGroupFunction <Tuple2<GradoopId, GraphElement>, GraphHead, GraphTransaction> {
nonForwardedSecond = ((NonForwardedFieldsSecond) ann).value(); } else if (ann instanceof ReadFieldsFirst) { readFirst = ((ReadFieldsFirst) ann).value(); } else if (ann instanceof ReadFieldsSecond) { readSecond = ((ReadFieldsSecond) ann).value();
@FunctionAnnotation.ReadFieldsFirst("f1") public class GraphElementsHeadsToTransaction implements CoGroupFunction <Tuple2<GradoopId, GraphElement>, GraphHead, GraphTransaction> {
/** * CoGroups tuples containing gradoop ids and gradoop id sets with graph * elements with the same gradoop ids and adds the gradoop id sets to each * element. * @param <EL> epgm graph element type */ @FunctionAnnotation.ReadFieldsFirst("f1") @FunctionAnnotation.ForwardedFieldsSecond("id;label;properties") public class AddGraphsToElementsCoGroup<EL extends GraphElement> implements CoGroupFunction<Tuple2<GradoopId, GradoopIdSet>, EL, EL> { @Override public void coGroup( Iterable<Tuple2<GradoopId, GradoopIdSet>> graphs, Iterable<EL> elements, Collector<EL> collector) throws Exception { boolean wasGraphSetEmpty = true; for (EL element : elements) { for (Tuple2<GradoopId, GradoopIdSet> graphSet : graphs) { element.getGraphIds().addAll(graphSet.f1); wasGraphSetEmpty = false; } if (!wasGraphSetEmpty) { collector.collect(element); } } } }
@FunctionAnnotation.ReadFieldsFirst("f1") public class LPVertexJoin implements JoinFunction <org.apache.flink.graph.Vertex<GradoopId, PropertyValue>, Vertex, Vertex> {
/** * CoGroups tuples containing gradoop ids and gradoop id sets with graph * elements with the same gradoop ids and adds the gradoop id sets to each * element. * @param <EL> epgm graph element type */ @FunctionAnnotation.ReadFieldsFirst("f1") @FunctionAnnotation.ForwardedFieldsSecond("id;label;properties") public class AddGraphsToElementsCoGroup<EL extends GraphElement> implements CoGroupFunction<Tuple2<GradoopId, GradoopIdSet>, EL, EL> { @Override public void coGroup( Iterable<Tuple2<GradoopId, GradoopIdSet>> graphs, Iterable<EL> elements, Collector<EL> collector) throws Exception { boolean wasGraphSetEmpty = true; for (EL element : elements) { for (Tuple2<GradoopId, GradoopIdSet> graphSet : graphs) { element.getGraphIds().addAll(graphSet.f1); wasGraphSetEmpty = false; } if (!wasGraphSetEmpty) { collector.collect(element); } } } }
@FunctionAnnotation.ReadFieldsFirst("f1") public class LPVertexJoin implements JoinFunction <org.apache.flink.graph.Vertex<GradoopId, PropertyValue>, Vertex, Vertex> {
/** * Updates an EPGM edge with the given target vertex identifier. * * @param <E> EPGM edge type * @param <K> Import Edge/Vertex identifier type */ @FunctionAnnotation.ReadFieldsFirst("f1") @FunctionAnnotation.ForwardedFieldsSecond("f1->targetId") public class UpdateEdge<E extends Edge, K extends Comparable<K>> implements JoinFunction<Tuple2<K, E>, Tuple2<K, GradoopId>, E> { /** * Updates the target vertex identifier of the given EPGM edge. * * @param targetIdEdgePair import target id and EPGM edge * @param vertexIdPair import target vertex id and EPGM vertex id * @return EPGM edge with updated target vertex id * @throws Exception */ @Override public E join(Tuple2<K, E> targetIdEdgePair, Tuple2<K, GradoopId> vertexIdPair) throws Exception { targetIdEdgePair.f1.setTargetId(vertexIdPair.f1); return targetIdEdgePair.f1; } }
/** * Updates an EPGM edge with the given target vertex identifier. * * @param <E> EPGM edge type * @param <K> Import Edge/Vertex identifier type */ @FunctionAnnotation.ReadFieldsFirst("f1") @FunctionAnnotation.ForwardedFieldsSecond("f1->targetId") public class UpdateEdge<E extends Edge, K extends Comparable<K>> implements JoinFunction<Tuple2<K, E>, Tuple2<K, GradoopId>, E> { /** * Updates the target vertex identifier of the given EPGM edge. * * @param targetIdEdgePair import target id and EPGM edge * @param vertexIdPair import target vertex id and EPGM vertex id * @return EPGM edge with updated target vertex id * @throws Exception */ @Override public E join(Tuple2<K, E> targetIdEdgePair, Tuple2<K, GradoopId> vertexIdPair) throws Exception { targetIdEdgePair.f1.setTargetId(vertexIdPair.f1); return targetIdEdgePair.f1; } }
/** * Adds new graph ids to the initial vertex set * * @param <V> EPGM vertex type */ @FunctionAnnotation.ReadFieldsFirst("graphIds") @FunctionAnnotation.ReadFieldsSecond("f1") public class AddNewGraphsToVertex<V extends Vertex> implements JoinFunction<V, Tuple2<GradoopId, GradoopIdSet>, V> { /** * {@inheritDoc} */ @Override public V join(V vertex, Tuple2<GradoopId, GradoopIdSet> vertexWithGraphIds) { vertex.getGraphIds().addAll(vertexWithGraphIds.f1); return vertex; } }
/** * Add all gradoop ids in the second field of the first tuple to the element. * id:el{id1} join (id, {id2, id3}) -> id:el{id1, id2, id3} * @param <EL> epgm graph element type */ @FunctionAnnotation.ReadFieldsFirst("f1") @FunctionAnnotation.ForwardedFieldsSecond("id;label;properties") public class AddGraphsToElements<EL extends GraphElement> implements JoinFunction<Tuple2<GradoopId, GradoopIdSet>, EL, EL> { @Override public EL join( Tuple2<GradoopId, GradoopIdSet> left, EL right) { right.getGraphIds().addAll(left.f1); return right; } }
/** * Adds new graph ids to the initial vertex set * * @param <V> EPGM vertex type */ @FunctionAnnotation.ReadFieldsFirst("graphIds") @FunctionAnnotation.ReadFieldsSecond("f1") public class AddNewGraphsToVertex<V extends Vertex> implements JoinFunction<V, Tuple2<GradoopId, GradoopIdSet>, V> { @Override public V join(V vertex, Tuple2<GradoopId, GradoopIdSet> vertexWithGraphIds) { vertex.getGraphIds().addAll(vertexWithGraphIds.f1); return vertex; } }
/** * Add all gradoop ids in the second field of the first tuple to the element. * id:el{id1} join (id, {id2, id3}) -> id:el{id1, id2, id3} * @param <EL> epgm graph element type */ @FunctionAnnotation.ReadFieldsFirst("f1") @FunctionAnnotation.ForwardedFieldsSecond("id;label;properties") public class AddGraphsToElements<EL extends GraphElement> implements JoinFunction<Tuple2<GradoopId, GradoopIdSet>, EL, EL> { @Override public EL join( Tuple2<GradoopId, GradoopIdSet> left, EL right) { right.getGraphIds().addAll(left.f1); return right; } }
@FunctionAnnotation.ForwardedFieldsFirst("0->4;1;1->3") @FunctionAnnotation.ForwardedFieldsSecond("2;4->0") @FunctionAnnotation.ReadFieldsFirst("0;2;4") @FunctionAnnotation.ReadFieldsSecond("1;3") private static class DummyTestJoinFunction1 implements JoinFunction<Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>> { @Override public Tuple5<Integer, Long, String, Long, Integer> join( Tuple5<Integer, Long, String, Long, Integer> first, Tuple5<Integer, Long, String, Long, Integer> second) throws Exception { return new Tuple5<Integer, Long, String, Long, Integer>(); } }