@Test public void testFunction() throws Exception { VertexFactory<EPGMVertex> vertexFactory = getConfig().getLogicalGraphFactory().getVertexFactory(); EPGMVertex v1 = vertexFactory.createVertex("a"); EPGMVertex v2 = vertexFactory.createVertex("a"); v2.setProperty("k1", 1L); v2.setProperty("k2", 1L); EPGMVertex v3 = vertexFactory.createVertex("b"); v3.setProperty("k1", 1L); v3.setProperty("k2", 1L); EPGMVertex v4 = vertexFactory.createVertex(); List<Tuple2<GradoopId, PropertyValue>> result = getExecutionEnvironment() .fromElements(v1, v2, v3, v4).flatMap(new BuildIdPropertyValuePairs<>("a", "k1")) .collect(); assertEquals(1, result.size()); assertEquals(Tuple2.of(v2.getId(), PropertyValue.create(1L)), result.get(0)); }
@Override public void flatMap(E element, Collector<Tuple2<GradoopId, PropertyValue>> out) { if (!label.equals(element.getLabel()) || !element.hasProperty(propertyKey)) { return; } reuse.f0 = element.getId(); reuse.f1 = element.getPropertyValue(propertyKey); out.collect(reuse); }
BuildIdPropertyValuePairs implements FlatMapFunction<E, Tuple2<GradoopId, PropertyValue>> { @Override public void flatMap(E element, Collector<Tuple2<GradoopId, PropertyValue>> out) { if (!label.equals(element.getLabel()) || !element.hasProperty(propertyKey)) { return; } reuse.f0 = element.getId(); reuse.f1 = element.getPropertyValue(propertyKey); out.collect(reuse); } }
BuildIdPropertyValuePairs implements FlatMapFunction<E, Tuple2<GradoopId, PropertyValue>> { @Override public void flatMap(E element, Collector<Tuple2<GradoopId, PropertyValue>> out) { if (!label.equals(element.getLabel()) || !element.hasProperty(propertyKey)) { return; } reuse.f0 = element.getId(); reuse.f1 = element.getPropertyValue(propertyKey); out.collect(reuse); } BuildIdPropertyValuePairs(String label, String propertyKey); }
BuildIdPropertyValuePairs implements FlatMapFunction<E, Tuple2<GradoopId, PropertyValue>> { @Override public void flatMap(E element, Collector<Tuple2<GradoopId, PropertyValue>> out) { if (!label.equals(element.getLabel()) || !element.hasProperty(propertyKey)) { return; } reuse.f0 = element.getId(); reuse.f1 = element.getPropertyValue(propertyKey); out.collect(reuse); } BuildIdPropertyValuePairs(String label, String propertyKey); @Override void flatMap(E element, Collector<Tuple2<GradoopId, PropertyValue>> out); }
BuildIdPropertyValuePairs implements FlatMapFunction<E, Tuple2<GradoopId, PropertyValue>> { @Override public void flatMap(E element, Collector<Tuple2<GradoopId, PropertyValue>> out) { if (!label.equals(element.getLabel()) || !element.hasProperty(propertyKey)) { return; } reuse.f0 = element.getId(); reuse.f1 = element.getPropertyValue(propertyKey); out.collect(reuse); } BuildIdPropertyValuePairs(String label, String propertyKey); @Override void flatMap(E element, Collector<Tuple2<GradoopId, PropertyValue>> out);  }