@Override public GraphCollection execute(GraphCollection collection) { config = collection.getConfig(); DataSet<GraphTransaction> input = collection .getGraphTransactions(); DataSet<GraphTransaction> output = execute(input); return config.getGraphCollectionFactory() .fromTransactions(output); }
@Override public GraphCollection execute(GraphCollection collection) { config = collection.getConfig(); DataSet<GraphTransaction> input = collection .getGraphTransactions(); DataSet<GraphTransaction> output = execute(input); return config.getGraphCollectionFactory() .fromTransactions(output); }
@Override public GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> updatedTransactions = collection.getGraphTransactions() .map(new AggregateTransactions(aggregateFunctions)); return collection.getConfig().getGraphCollectionFactory().fromTransactions(updatedTransactions); }
@Override public GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> updatedTransactions = collection.getGraphTransactions() .map(new AggregateTransactions(aggregateFunctions)); return collection.getConfig().getGraphCollectionFactory().fromTransactions(updatedTransactions); }
/** * Executes the operator for collections based on * {@link org.gradoop.flink.model.impl.layouts.transactional.TxCollectionLayout} * * @param collection graph collection * @return result graph collection */ private GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> filteredTransactions = collection.getGraphTransactions() .filter(new FilterTransactions(predicate)); return collection.getConfig().getGraphCollectionFactory() .fromTransactions(filteredTransactions); }
/** * Executes the operator for collections based on * {@link org.gradoop.flink.model.impl.layouts.transactional.TxCollectionLayout} * * @param collection graph collection * @return result graph collection */ private GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> filteredTransactions = collection.getGraphTransactions() .filter(new FilterTransactions(predicate)); return collection.getConfig().getGraphCollectionFactory() .fromTransactions(filteredTransactions); } }
GRADOOP_CONFIG.getGraphCollectionFactory().fromTransactions(frequentPatterns), true); getExecutionEnvironment().execute();
@Override public GraphCollection execute(GraphCollection collection) { // convert Gradoop graph collection to DIMSpan input format DataSet<LabeledGraphStringString> input = collection .getGraphTransactions() .map(new EPGMGraphTransactionToLabeledGraph()); // run DIMSpan DataSet<GraphTransaction> output = dimSpan.execute(input); // convert to Gradoop graph collection return collection.getConfig().getGraphCollectionFactory().fromTransactions(output); }
@Override public GraphCollection execute(GraphCollection collection) { // convert Gradoop graph collection to DIMSpan input format DataSet<LabeledGraphStringString> input = collection .getGraphTransactions() .map(new EPGMGraphTransactionToLabeledGraph()); // run DIMSpan DataSet<GraphTransaction> output = dimSpan.execute(input); // convert to Gradoop graph collection return collection.getConfig().getGraphCollectionFactory().fromTransactions(output); }
GRADOOP_CONFIG.getGraphCollectionFactory().fromTransactions(output), true); getExecutionEnvironment().execute();
@Override public GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> graphTransactions = collection.getGraphTransactions(); GradoopFlinkConfig config = collection.getConfig(); DataSet<GraphTransaction> transformedGraphTransactions = graphTransactions .map(new TransformGraphTransaction( collection.getFactory().getGraphHeadFactory(), graphHeadTransFunc, collection.getFactory().getVertexFactory(), vertexTransFunc, collection.getFactory().getEdgeFactory(), edgeTransFunc )); return config.getGraphCollectionFactory().fromTransactions(transformedGraphTransactions); } }
@Override public GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> graphTransactions = collection.getGraphTransactions(); GradoopFlinkConfig config = collection.getConfig(); DataSet<GraphTransaction> transformedGraphTransactions = graphTransactions .map(new TransformGraphTransaction( collection.getFactory().getGraphHeadFactory(), graphHeadTransFunc, collection.getFactory().getVertexFactory(), vertexTransFunc, collection.getFactory().getEdgeFactory(), edgeTransFunc )); return config.getGraphCollectionFactory().fromTransactions(transformedGraphTransactions); } }
getEdgeDictionary(), TLFConstants.EDGE_DICTIONARY); return getConfig().getGraphCollectionFactory().fromTransactions(transactions);
getEdgeDictionary(), TLFConstants.EDGE_DICTIONARY); return getConfig().getGraphCollectionFactory().fromTransactions(transactions);
@Test public void testTransformation() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); GraphCollection originalCollection = loader.getGraphCollection(); DataSet<GraphTransaction> transactions = originalCollection.getGraphTransactions(); GraphCollection restoredCollection = getConfig().getGraphCollectionFactory() .fromTransactions(transactions); collectAndAssertTrue( originalCollection.equalsByGraphIds(restoredCollection)); collectAndAssertTrue( originalCollection.equalsByGraphElementIds(restoredCollection)); collectAndAssertTrue( originalCollection.equalsByGraphData(restoredCollection)); }
@Test public void testRead() throws Exception { String tlfFile = getFilePath("/data/tlf/io_test_string.tlf"); // create datasource DataSource dataSource = new TLFDataSource(tlfFile, getConfig()); // get transactions DataSet<GraphTransaction> transactions = dataSource.getGraphCollection().getGraphTransactions(); String asciiGraphs = "" + "g1[(v1:A)-[:a]->(v2:B)-[:b]->(v1)]" + "g2[(v1:A)-[:a]->(v2:B)<-[:b]-(v1)]"; FlinkAsciiGraphLoader loader = getLoaderFromString(asciiGraphs); collectAndAssertTrue( loader.getGraphCollectionByVariables("g1", "g2").equalsByGraphData( getConfig().getGraphCollectionFactory().fromTransactions(transactions) ) ); }
@Test public void testReadWithoutEdges() throws Exception { String tlfFile = getFilePath("/data/tlf/io_test_string_without_edges.tlf"); // create datasource DataSource dataSource = new TLFDataSource(tlfFile, getConfig()); // get transactions DataSet<GraphTransaction> transactions = dataSource.getGraphCollection().getGraphTransactions(); String asciiGraphs = "" + "g1[(v1:A),(v2:B)]" + "g2[(v1:A),(v2:B)]"; FlinkAsciiGraphLoader loader = getLoaderFromString(asciiGraphs); collectAndAssertTrue( loader.getGraphCollectionByVariables("g1", "g2").equalsByGraphData( getConfig().getGraphCollectionFactory().fromTransactions(transactions) ) ); }
@Test public void testTransformationWithCustomReducer() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); GraphCollection originalCollection = loader.getGraphCollection(); DataSet<GraphTransaction> transactions = originalCollection.getGraphTransactions(); GraphCollection restoredCollection = getConfig().getGraphCollectionFactory() .fromTransactions(transactions, new First<>(), new First<>()); collectAndAssertTrue( originalCollection.equalsByGraphIds(restoredCollection)); collectAndAssertTrue( originalCollection.equalsByGraphElementIds(restoredCollection)); collectAndAssertTrue( originalCollection.equalsByGraphData(restoredCollection)); }
@Test public void testWithSubsetGraphContainment() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); loader.appendToDatabaseFromString("g1[(eve)]"); GraphCollection originalCollection = loader.getGraphCollectionByVariables("g1"); DataSet<GraphTransaction> transactions = originalCollection.getGraphTransactions(); GraphCollection restoredCollection = getConfig().getGraphCollectionFactory() .fromTransactions(transactions, new First<>(), new First<>()); collectAndAssertTrue( originalCollection.equalsByGraphIds(restoredCollection)); collectAndAssertTrue( originalCollection.equalsByGraphElementIds(restoredCollection)); collectAndAssertTrue( originalCollection.equalsByGraphData(restoredCollection)); } }
@Test public void testReadWithDictionary() throws Exception { String tlfFile = getFilePath("/data/tlf/io_test.tlf"); String tlfVertexDictionaryFile = getFilePath("/data/tlf/io_test_vertex_dictionary.tlf"); String tlfEdgeDictionaryFile = getFilePath("/data/tlf/io_test_edge_dictionary.tlf"); // create datasource DataSource dataSource = new TLFDataSource(tlfFile, tlfVertexDictionaryFile, tlfEdgeDictionaryFile, getConfig()); // get transactions DataSet<GraphTransaction> transactions = dataSource.getGraphCollection().getGraphTransactions(); String asciiGraphs = "" + "g1[(v1:A)-[:a]->(v2:B)-[:b]->(v1)]" + "g2[(v1:A)-[:a]->(v2:B)<-[:b]-(v1)]"; FlinkAsciiGraphLoader loader = getLoaderFromString(asciiGraphs); collectAndAssertTrue( loader.getGraphCollectionByVariables("g1", "g2").equalsByGraphData( getConfig().getGraphCollectionFactory().fromTransactions(transactions) ) ); } }