@Test public void testFromDataSets() throws Exception { DataSet<TemporalVertex> mappedVertexDataSet = vertexDataSet.map(v -> { v.resetGraphIds(); return v; }); DataSet<TemporalEdge> mappedEdgeDataSet = edgeDataSet.map(e -> { e.resetGraphIds(); return e; }); final LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> layout = factory.fromDataSets(mappedVertexDataSet, mappedEdgeDataSet); Collection<TemporalGraphHead> loadedGraphHeads = Lists.newArrayList(); Collection<TemporalVertex> loadedVertices = Lists.newArrayList(); Collection<TemporalEdge> loadedEdges = Lists.newArrayList(); layout.getGraphHead().output(new LocalCollectionOutputFormat<>(loadedGraphHeads)); layout.getVertices().output(new LocalCollectionOutputFormat<>(loadedVertices)); layout.getEdges().output(new LocalCollectionOutputFormat<>(loadedEdges)); getExecutionEnvironment().execute(); TemporalGraphHead newGraphHead = loadedGraphHeads.iterator().next(); validateElementCollections(vertices, loadedVertices); validateElementCollections(edges, loadedEdges); List<TemporalGraphElement> tpgmElements = new ArrayList<>(); tpgmElements.addAll(loadedVertices); tpgmElements.addAll(loadedEdges); for (TemporalGraphElement loadedElement : tpgmElements) { assertEquals(1, loadedElement.getGraphCount()); assertTrue(loadedElement.getGraphIds().contains(newGraphHead.getId())); } }
@Override public LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets( DataSet<TemporalVertex> vertices) { return fromDataSets(vertices, createEdgeDataSet(Collections.emptyList())); }
TemporalGraphLayoutFactory extends TemporalBaseLayoutFactory implements LogicalGraphLayoutFactory<TemporalGraphHead, TemporalVertex, TemporalEdge> { @Override public LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets( DataSet<TemporalVertex> vertices) { return fromDataSets(vertices, createEdgeDataSet(Collections.emptyList())); } }
TemporalGraphLayoutFactory extends TemporalBaseLayoutFactory implements LogicalGraphLayoutFactory<TemporalGraphHead, TemporalVertex, TemporalEdge> { @Override public LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets( DataSet<TemporalVertex> vertices) { return fromDataSets(vertices, createEdgeDataSet(Collections.emptyList())); }  }
TemporalGraphLayoutFactory extends TemporalBaseLayoutFactory implements LogicalGraphLayoutFactory<TemporalGraphHead, TemporalVertex, TemporalEdge> { @Override public LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets( DataSet<TemporalVertex> vertices) { return fromDataSets(vertices, createEdgeDataSet(Collections.emptyList())); }  @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets(
    DataSet<TemporalVertex> vertices); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets(
    DataSet<TemporalVertex> vertices, DataSet<TemporalEdge> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets(
    DataSet<TemporalGraphHead> graphHead,
    DataSet<TemporalVertex> vertices,
    DataSet<TemporalEdge> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromIndexedDataSets(
    Map<String, DataSet<TemporalVertex>> vertices, Map<String, DataSet<TemporalEdge>> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromIndexedDataSets(
    Map<String, DataSet<TemporalGraphHead>> graphHeads,
    Map<String, DataSet<TemporalVertex>> vertices, Map<String, DataSet<TemporalEdge>> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromCollections(
    TemporalGraphHead graphHead, Collection<TemporalVertex> vertices,
    Collection<TemporalEdge> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromCollections(
    Collection<TemporalVertex> vertices, Collection<TemporalEdge> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> createEmptyGraph(); }
TemporalGraphLayoutFactory extends TemporalBaseLayoutFactory implements LogicalGraphLayoutFactory<TemporalGraphHead, TemporalVertex, TemporalEdge> { @Override public LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets( DataSet<TemporalVertex> vertices) { return fromDataSets(vertices, createEdgeDataSet(Collections.emptyList())); }  @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets(
    DataSet<TemporalVertex> vertices); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets(
    DataSet<TemporalVertex> vertices, DataSet<TemporalEdge> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromDataSets(
    DataSet<TemporalGraphHead> graphHead,
    DataSet<TemporalVertex> vertices,
    DataSet<TemporalEdge> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromIndexedDataSets(
    Map<String, DataSet<TemporalVertex>> vertices, Map<String, DataSet<TemporalEdge>> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromIndexedDataSets(
    Map<String, DataSet<TemporalGraphHead>> graphHeads,
    Map<String, DataSet<TemporalVertex>> vertices, Map<String, DataSet<TemporalEdge>> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromCollections(
    TemporalGraphHead graphHead, Collection<TemporalVertex> vertices,
    Collection<TemporalEdge> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> fromCollections(
    Collection<TemporalVertex> vertices, Collection<TemporalEdge> edges); @Override LogicalGraphLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> createEmptyGraph();  }