Skip to content
Permalink
Browse files

[#1303] Move GraphCollection operators to BaseGraphCollection (#1316)

fixes #1303
  • Loading branch information...
timo95 authored and ChrizZz110 committed Aug 9, 2019
1 parent e489782 commit 87224ea893ccdd563e4aa58ff5b616becaa5442c
Showing with 1,231 additions and 1,128 deletions.
  1. +1 −1 gradoop-flink/src/main/java/org/gradoop/flink/io/impl/csv/indexed/IndexedCSVDataSource.java
  2. +1 −1 gradoop-flink/src/main/java/org/gradoop/flink/io/impl/deprecated/json/JSONDataSource.java
  3. +1 −1 gradoop-flink/src/main/java/org/gradoop/flink/io/impl/edgelist/EdgeListDataSource.java
  4. +1 −1 gradoop-flink/src/main/java/org/gradoop/flink/io/impl/edgelist/VertexLabeledEdgeListDataSource.java
  5. +1 −1 gradoop-flink/src/main/java/org/gradoop/flink/io/impl/tlf/TLFDataSource.java
  6. +41 −0 gradoop-flink/src/main/java/org/gradoop/flink/model/api/epgm/BaseGraphCollection.java
  7. +307 −0 gradoop-flink/src/main/java/org/gradoop/flink/model/api/epgm/BaseGraphCollectionOperators.java
  8. +0 −255 gradoop-flink/src/main/java/org/gradoop/flink/model/api/epgm/GraphCollectionOperators.java
  9. +5 −3 gradoop-flink/src/main/java/org/gradoop/flink/model/api/functions/GraphHeadReduceFunction.java
  10. +0 −26 ...link/src/main/java/org/gradoop/flink/model/api/operators/ApplicableUnaryGraphToGraphOperator.java
  11. +5 −10 ...ollectionToCollectionOperator.java → BinaryBaseGraphCollectionToBaseGraphCollectionOperator.java}
  12. +9 −7 .../operators/{BinaryCollectionToValueOperator.java → BinaryBaseGraphCollectionToValueOperator.java}
  13. +1 −0 ...oop-flink/src/main/java/org/gradoop/flink/model/api/operators/BinaryBaseGraphToValueOperator.java
  14. +9 −5 ...ors/{UnaryGraphCollectionToValueOperator.java → ReducibleBinaryBaseGraphToBaseGraphOperator.java}
  15. +0 −24 ...link/src/main/java/org/gradoop/flink/model/api/operators/ReducibleBinaryGraphToGraphOperator.java
  16. +2 −4 .../org/gradoop/flink/model/api/operators/UnaryBaseGraphCollectionToBaseGraphCollectionOperator.java
  17. +1 −2 .../main/java/org/gradoop/flink/model/api/operators/UnaryBaseGraphCollectionToBaseGraphOperator.java
  18. +1 −0 gradoop-flink/src/main/java/org/gradoop/flink/model/api/operators/UnaryBaseGraphToValueOperator.java
  19. +0 −26 ...oop-flink/src/main/java/org/gradoop/flink/model/api/operators/UnaryCollectionToGraphOperator.java
  20. +18 −198 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/epgm/GraphCollection.java
  21. +2 −2 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/functions/epgm/ByDifferentId.java
  22. +2 −2 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/functions/epgm/BySameId.java
  23. +6 −7 ...oop-flink/src/main/java/org/gradoop/flink/model/impl/functions/epgm/ElementsOfSelectedGraphs.java
  24. +2 −2 ...ava/org/gradoop/flink/model/impl/functions/graphcontainment/GraphsContainmentFilterBroadcast.java
  25. +2 −4 ...k/src/main/java/org/gradoop/flink/model/impl/functions/graphcontainment/InAllGraphsBroadcast.java
  26. +2 −2 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/functions/graphcontainment/InAnyGraph.java
  27. +2 −2 ...nk/src/main/java/org/gradoop/flink/model/impl/functions/graphcontainment/InAnyGraphBroadcast.java
  28. +2 −2 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/functions/graphcontainment/InGraph.java
  29. +2 −2 ...k/src/main/java/org/gradoop/flink/model/impl/functions/graphcontainment/NotInGraphsBroadcast.java
  30. +4 −6 ...k/src/main/java/org/gradoop/flink/model/impl/functions/graphcontainment/PairVertexWithGraphs.java
  31. +28 −17 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/aggregation/ApplyAggregation.java
  32. +3 −3 ...ain/java/org/gradoop/flink/model/impl/operators/aggregation/functions/ApplyAggregateElements.java
  33. +8 −6 ...ain/java/org/gradoop/flink/model/impl/operators/aggregation/functions/SetAggregateProperties.java
  34. +28 −19 ...in/java/org/gradoop/flink/model/impl/operators/base/BinaryCollectionToCollectionOperatorBase.java
  35. +24 −15 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/base/SetOperatorBase.java
  36. +22 −7 ...oop-flink/src/main/java/org/gradoop/flink/model/impl/operators/combination/ReduceCombination.java
  37. +28 −13 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/difference/Difference.java
  38. +23 −12 ...op-flink/src/main/java/org/gradoop/flink/model/impl/operators/difference/DifferenceBroadcast.java
  39. +2 −2 ...link/src/main/java/org/gradoop/flink/model/impl/operators/difference/functions/IdOf0InTuple2.java
  40. +21 −5 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/distinction/DistinctById.java
  41. +21 −8 ...flink/src/main/java/org/gradoop/flink/model/impl/operators/distinction/DistinctByIsomorphism.java
  42. +29 −15 ...op-flink/src/main/java/org/gradoop/flink/model/impl/operators/distinction/GroupByIsomorphism.java
  43. +8 −6 ...k/src/main/java/org/gradoop/flink/model/impl/operators/distinction/functions/CountGraphHeads.java
  44. +5 −4 ...nk/src/main/java/org/gradoop/flink/model/impl/operators/distinction/functions/FirstGraphHead.java
  45. +6 −5 ...nk/src/main/java/org/gradoop/flink/model/impl/operators/distinction/functions/GraphHeadGroup.java
  46. +29 −21 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/equality/CollectionEquality.java
  47. +22 −9 ...k/src/main/java/org/gradoop/flink/model/impl/operators/equality/CollectionEqualityByGraphIds.java
  48. +22 −9 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/exclusion/ReduceExclusion.java
  49. +22 −8 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/intersection/Intersection.java
  50. +22 −10 ...link/src/main/java/org/gradoop/flink/model/impl/operators/intersection/IntersectionBroadcast.java
  51. +25 −28 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/limit/Limit.java
  52. +30 −19 ...a/org/gradoop/flink/model/impl/operators/matching/transactional/TransactionalPatternMatching.java
  53. +2 −2 ...a/org/gradoop/flink/model/impl/operators/matching/transactional/function/AddGraphsToElements.java
  54. +8 −6 ...rg/gradoop/flink/model/impl/operators/matching/transactional/function/AddMatchesToProperties.java
  55. +3 −3 ...op/flink/model/impl/operators/matching/transactional/function/BuildIdWithCandidatesAndGraphs.java
  56. +4 −4 ...link/model/impl/operators/matching/transactional/function/BuildTripleWithCandidatesAndGraphs.java
  57. +11 −9 .../gradoop/flink/model/impl/operators/matching/transactional/function/InitGraphHeadWithLineage.java
  58. +10 −9 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/overlap/OverlapBase.java
  59. +24 −11 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/overlap/ReduceOverlap.java
  60. +24 −42 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/selection/Selection.java
  61. +26 −15 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/selection/SelectionBase.java
  62. +29 −16 ...rc/main/java/org/gradoop/flink/model/impl/operators/tostring/CanonicalAdjacencyMatrixBuilder.java
  63. +2 −2 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/tostring/api/EdgeToString.java
  64. +2 −2 ...op-flink/src/main/java/org/gradoop/flink/model/impl/operators/tostring/api/GraphHeadToString.java
  65. +2 −2 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/tostring/api/VertexToString.java
  66. +6 −4 ...ink/src/main/java/org/gradoop/flink/model/impl/operators/tostring/functions/EdgeToDataString.java
  67. +6 −7 ...flink/src/main/java/org/gradoop/flink/model/impl/operators/tostring/functions/EdgeToIdString.java
  68. +4 −3 .../src/main/java/org/gradoop/flink/model/impl/operators/tostring/functions/ElementToDataString.java
  69. +6 −4 ...rc/main/java/org/gradoop/flink/model/impl/operators/tostring/functions/GraphHeadToDataString.java
  70. +5 −3 ...c/main/java/org/gradoop/flink/model/impl/operators/tostring/functions/GraphHeadToEmptyString.java
  71. +7 −5 ...k/src/main/java/org/gradoop/flink/model/impl/operators/tostring/functions/VertexToDataString.java
  72. +6 −4 ...ink/src/main/java/org/gradoop/flink/model/impl/operators/tostring/functions/VertexToIdString.java
  73. +43 −29 ...link/src/main/java/org/gradoop/flink/model/impl/operators/transformation/ApplyTransformation.java
  74. +40 −23 ...va/org/gradoop/flink/model/impl/operators/transformation/functions/TransformGraphTransaction.java
  75. +24 −12 gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/union/Union.java
  76. +1 −1 gradoop-flink/src/test/java/org/gradoop/flink/io/impl/csv/indexed/IndexedCSVDataSourceTest.java
  77. +1 −1 gradoop-flink/src/test/java/org/gradoop/flink/model/impl/operators/aggregation/AggregationTest.java
  78. +42 −42 ...-flink/src/test/java/org/gradoop/flink/model/impl/operators/aggregation/ApplyAggregationTest.java
  79. +3 −2 ...k/src/test/java/org/gradoop/flink/model/impl/operators/base/ReducibleBinaryOperatorsTestBase.java
  80. +1 −1 gradoop-flink/src/test/java/org/gradoop/flink/model/impl/operators/combination/CombinationTest.java
  81. +1 −1 ...link/src/test/java/org/gradoop/flink/model/impl/operators/distinction/GroupByIsomorphismTest.java
  82. +1 −1 gradoop-flink/src/test/java/org/gradoop/flink/model/impl/operators/exclusion/ExclusionTest.java
  83. +2 −2 gradoop-flink/src/test/java/org/gradoop/flink/model/impl/operators/fusion/VertexFusionTest.java
  84. +1 −1 gradoop-flink/src/test/java/org/gradoop/flink/model/impl/operators/overlap/OverlapTest.java
  85. +4 −4 gradoop-flink/src/test/java/org/gradoop/flink/model/impl/operators/rollup/RollUpTest.java
  86. +14 −10 ...est/java/org/gradoop/flink/model/impl/operators/tostring/CanonicalAdjacencyMatrixBuilderTest.java
  87. +6 −6 .../src/test/java/org/gradoop/flink/model/impl/operators/transformation/ApplyTransformationTest.java
  88. +1 −1 ...store/gradoop-accumulo/src/main/java/org/gradoop/storage/accumulo/impl/io/AccumuloDataSource.java
  89. +1 −1 gradoop-store/gradoop-hbase/src/main/java/org/gradoop/storage/hbase/impl/io/HBaseDataSource.java
@@ -84,7 +84,7 @@ public IndexedCSVDataSource(String csvPath, GradoopFlinkConfig conf, Configurati

@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -71,7 +71,7 @@ public JSONDataSource(String graphHeadPath, String vertexPath,

@Override
public LogicalGraph getLogicalGraph() {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -78,7 +78,7 @@ public EdgeListDataSource(String edgeListPath, String tokenSeparator,

@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -76,7 +76,7 @@ public VertexLabeledEdgeListDataSource(String edgeListPath, String tokenSeparato

@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -90,7 +90,7 @@ public TLFDataSource(String tlfPath, String tlfVertexDictionaryPath,

@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -15,10 +15,17 @@
*/
package org.gradoop.flink.model.api.epgm;

import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.java.DataSet;
import org.gradoop.common.model.api.entities.Edge;
import org.gradoop.common.model.api.entities.GraphHead;
import org.gradoop.common.model.api.entities.Vertex;
import org.gradoop.common.model.impl.id.GradoopId;
import org.gradoop.common.model.impl.id.GradoopIdSet;
import org.gradoop.flink.model.api.layouts.GraphCollectionLayout;
import org.gradoop.flink.model.impl.functions.epgm.BySameId;
import org.gradoop.flink.model.impl.functions.graphcontainment.InAnyGraph;
import org.gradoop.flink.model.impl.functions.graphcontainment.InGraph;
import org.gradoop.flink.util.GradoopFlinkConfig;

/**
@@ -37,6 +44,7 @@
LG extends BaseGraph<G, V, E, LG, GC>,
GC extends BaseGraphCollection<G, V, E, LG, GC>>
extends GraphCollectionLayout<G, V, E>, BaseGraphCollectionOperators<G, V, E, LG, GC> {

/**
* Returns the Gradoop Flink configuration.
*
@@ -57,4 +65,37 @@
* @return a factory that can be used to create a {@link LG} instance
*/
BaseGraphFactory<G, V, E, LG, GC> getGraphFactory();

//----------------------------------------------------------------------------
// Base Graph / Graph Head Getters
//----------------------------------------------------------------------------

@Override
default LG getGraph(final GradoopId graphID) {
// filter vertices and edges based on given graph id
DataSet<G> graphHead = getGraphHeads()
.filter(new BySameId<>(graphID));
DataSet<V> vertices = getVertices()
.filter(new InGraph<>(graphID));
DataSet<E> edges = getEdges()
.filter(new InGraph<>(graphID));

return getGraphFactory().fromDataSets(graphHead, vertices, edges);
}

@Override
default GC getGraphs(final GradoopIdSet identifiers) {
DataSet<G> newGraphHeads = this.getGraphHeads()
.filter((FilterFunction<G>) graphHead -> identifiers.contains(graphHead.getId()));

// build new vertex set
DataSet<V> vertices = getVertices()
.filter(new InAnyGraph<>(identifiers));

// build new edge set
DataSet<E> edges = getEdges()
.filter(new InAnyGraph<>(identifiers));

return getFactory().fromDataSets(newGraphHeads, vertices, edges);
}
}

0 comments on commit 87224ea

Please sign in to comment.
You can’t perform that action at this time.