@Test(dataProvider = "parameters") public void runTest(TemporalPredicate predicate, TimeDimension dimension, String[] expectedVertices, String[] expectedEdges) throws Exception { TemporalGraph inputGraph = getTestGraphWithValues(); Collection<TemporalVertex> resultVertices = new HashSet<>(); Collection<TemporalEdge> resultEdges = new HashSet<>(); TemporalGraph resultGraph = inputGraph.callForGraph(new Snapshot(predicate, dimension)); resultGraph.getVertices().output(new LocalCollectionOutputFormat<>(resultVertices)); resultGraph.getEdges().output(new LocalCollectionOutputFormat<>(resultEdges)); getConfig().getExecutionEnvironment().execute(); List<String> resultVertexLabels = resultVertices.stream().map(EPGMElement::getLabel).collect(Collectors.toList()); List<String> resultEdgeLabels = resultEdges.stream().map(EPGMElement::getLabel).collect(Collectors.toList()); assertEquals(expectedVertices.length, resultVertices.size()); assertEquals(expectedEdges.length, resultEdges.size()); Arrays.stream(expectedVertices).map(resultVertexLabels::contains).forEach(AssertJUnit::assertTrue); Arrays.stream(expectedEdges).map(resultEdgeLabels::contains).forEach(AssertJUnit::assertTrue); }
@Override public TemporalGraph execute(TemporalGraph superGraph) { DataSet<TemporalVertex> vertices = superGraph.getVertices() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); DataSet<TemporalEdge> edges = superGraph.getEdges() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); return superGraph.getFactory().fromDataSets(superGraph.getGraphHead(), vertices, edges); }
Snapshot implements UnaryBaseGraphToBaseGraphOperator<TemporalGraph> { @Override public TemporalGraph execute(TemporalGraph superGraph) { DataSet<TemporalVertex> vertices = superGraph.getVertices() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); DataSet<TemporalEdge> edges = superGraph.getEdges() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); return superGraph.getFactory().fromDataSets(superGraph.getGraphHead(), vertices, edges); } }
Snapshot implements UnaryBaseGraphToBaseGraphOperator<TemporalGraph> { @Override public TemporalGraph execute(TemporalGraph superGraph) { DataSet<TemporalVertex> vertices = superGraph.getVertices() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); DataSet<TemporalEdge> edges = superGraph.getEdges() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); return superGraph.getFactory().fromDataSets(superGraph.getGraphHead(), vertices, edges); } Snapshot(TemporalPredicate predicate);  Snapshot(TemporalPredicate predicate, TimeDimension dimension); }
Snapshot implements UnaryBaseGraphToBaseGraphOperator<TemporalGraph> { @Override public TemporalGraph execute(TemporalGraph superGraph) { DataSet<TemporalVertex> vertices = superGraph.getVertices() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); DataSet<TemporalEdge> edges = superGraph.getEdges() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); return superGraph.getFactory().fromDataSets(superGraph.getGraphHead(), vertices, edges); } Snapshot(TemporalPredicate predicate);  Snapshot(TemporalPredicate predicate, TimeDimension dimension); @Override TemporalGraph execute(TemporalGraph superGraph); }
Snapshot implements UnaryBaseGraphToBaseGraphOperator<TemporalGraph> { @Override public TemporalGraph execute(TemporalGraph superGraph) { DataSet<TemporalVertex> vertices = superGraph.getVertices() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); DataSet<TemporalEdge> edges = superGraph.getEdges() .filter(new ByTemporalPredicate<>(temporalPredicate, dimension)); return superGraph.getFactory().fromDataSets(superGraph.getGraphHead(), vertices, edges); } Snapshot(TemporalPredicate predicate);  Snapshot(TemporalPredicate predicate, TimeDimension dimension); @Override TemporalGraph execute(TemporalGraph superGraph);  }