@Test public void testFunction() throws Exception { CreateVertexFromEdges<EPGMVertex, EPGMEdge> function = new CreateVertexFromEdges<>("test", getConfig().getLogicalGraphFactory().getVertexFactory()); GradoopId dummy = GradoopId.get(); EdgeFactory<EPGMEdge> edgeFactory = getConfig().getLogicalGraphFactory().getEdgeFactory(); EPGMEdge withoutProperties = edgeFactory.createEdge(dummy, dummy); EPGMEdge withProperties = edgeFactory.createEdge("TestEdge2", dummy, dummy); withProperties.setProperty("TestProperty", 1L); List<EPGMEdge> edges = Arrays.asList(withoutProperties, withProperties); List<Tuple3<EPGMVertex, GradoopId, GradoopId>> result = getExecutionEnvironment() .fromCollection(edges).map(function).collect(); assertEquals(edges.size(), result.size()); long idCount = result.stream().map(t -> t.f0.getId()).distinct().count(); assertEquals("EPGMVertex IDs are not unique.", edges.size(), idCount); for (Tuple3<EPGMVertex, GradoopId, GradoopId> resultTuple : result) { if (resultTuple.f0.getPropertyCount() > 0) { assertEquals(withProperties.getProperties(), resultTuple.f0.getProperties()); } } }
@Override public Tuple3<V, GradoopId, GradoopId> map(E e) { reuse.f0.setId(GradoopId.get()); reuse.f0.setProperties(e.getProperties()); reuse.f1 = e.getSourceId(); reuse.f2 = e.getTargetId(); return reuse; }
CreateVertexFromEdges implements MapFunction<E, Tuple3<V, GradoopId, GradoopId>>,
  ResultTypeQueryable<Tuple3<V, GradoopId, GradoopId>> { @Override public Tuple3<V, GradoopId, GradoopId> map(E e) { reuse.f0.setId(GradoopId.get()); reuse.f0.setProperties(e.getProperties()); reuse.f1 = e.getSourceId(); reuse.f2 = e.getTargetId(); return reuse; } }
CreateVertexFromEdges implements MapFunction<E, Tuple3<V, GradoopId, GradoopId>>,
  ResultTypeQueryable<Tuple3<V, GradoopId, GradoopId>> { @Override public Tuple3<V, GradoopId, GradoopId> map(E e) { reuse.f0.setId(GradoopId.get()); reuse.f0.setProperties(e.getProperties()); reuse.f1 = e.getSourceId(); reuse.f2 = e.getTargetId(); return reuse; } CreateVertexFromEdges(String newVertexLabel, VertexFactory<V> factory); }
CreateVertexFromEdges implements MapFunction<E, Tuple3<V, GradoopId, GradoopId>>,
  ResultTypeQueryable<Tuple3<V, GradoopId, GradoopId>> { @Override public Tuple3<V, GradoopId, GradoopId> map(E e) { reuse.f0.setId(GradoopId.get()); reuse.f0.setProperties(e.getProperties()); reuse.f1 = e.getSourceId(); reuse.f2 = e.getTargetId(); return reuse; } CreateVertexFromEdges(String newVertexLabel, VertexFactory<V> factory); @Override Tuple3<V, GradoopId, GradoopId> map(E e); @Override TypeInformation<Tuple3<V, GradoopId, GradoopId>> getProducedType(); }
CreateVertexFromEdges implements MapFunction<E, Tuple3<V, GradoopId, GradoopId>>,
  ResultTypeQueryable<Tuple3<V, GradoopId, GradoopId>> { @Override public Tuple3<V, GradoopId, GradoopId> map(E e) { reuse.f0.setId(GradoopId.get()); reuse.f0.setProperties(e.getProperties()); reuse.f1 = e.getSourceId(); reuse.f2 = e.getTargetId(); return reuse; } CreateVertexFromEdges(String newVertexLabel, VertexFactory<V> factory); @Override Tuple3<V, GradoopId, GradoopId> map(E e); @Override TypeInformation<Tuple3<V, GradoopId, GradoopId>> getProducedType();  }