/** * {@inheritDoc} */ @Override @Deprecated public GraphCollection cypher(String query, String constructionPattern, boolean attachData, MatchStrategy vertexStrategy, MatchStrategy edgeStrategy, GraphStatistics graphStatistics) { return callForCollection(new CypherPatternMatching(query, constructionPattern, attachData, vertexStrategy, edgeStrategy, graphStatistics)); }
@Override public GraphCollection groupEdgesByRollUp( List<String> vertexGroupingKeys, List<AggregateFunction> vertexAggregateFunctions, List<String> edgeGroupingKeys, List<AggregateFunction> edgeAggregateFunctions) { if (edgeGroupingKeys == null || edgeGroupingKeys.isEmpty()) { throw new IllegalArgumentException("Missing edge grouping key(s)."); } return callForCollection(new EdgeRollUp(vertexGroupingKeys, vertexAggregateFunctions, edgeGroupingKeys, edgeAggregateFunctions)); }
@Override public GraphCollection groupVerticesByRollUp( List<String> vertexGroupingKeys, List<AggregateFunction> vertexAggregateFunctions, List<String> edgeGroupingKeys, List<AggregateFunction> edgeAggregateFunctions) { if (vertexGroupingKeys == null || vertexGroupingKeys.isEmpty()) { throw new IllegalArgumentException("Missing vertex grouping key(s)."); } return callForCollection(new VertexRollUp(vertexGroupingKeys, vertexAggregateFunctions, edgeGroupingKeys, edgeAggregateFunctions)); }
/** * {@inheritDoc} */ @Override public GraphCollection query(String query, String constructionPattern, boolean attachData, MatchStrategy vertexStrategy, MatchStrategy edgeStrategy, GraphStatistics graphStatistics) { return callForCollection(new CypherPatternMatching(query, constructionPattern, attachData, vertexStrategy, edgeStrategy, graphStatistics)); }
@Override public GraphCollection groupVerticesByRollUp( List<String> vertexGroupingKeys, List<AggregateFunction> vertexAggregateFunctions, List<String> edgeGroupingKeys, List<AggregateFunction> edgeAggregateFunctions) { if (vertexGroupingKeys == null || vertexGroupingKeys.isEmpty()) { throw new IllegalArgumentException("Missing vertex grouping key(s)."); } return callForCollection(new VertexRollUp(vertexGroupingKeys, vertexAggregateFunctions, edgeGroupingKeys, edgeAggregateFunctions)); }
@Override @Deprecated public GraphCollection cypher(String query, String constructionPattern, boolean attachData, MatchStrategy vertexStrategy, MatchStrategy edgeStrategy, GraphStatistics graphStatistics) { return callForCollection(new CypherPatternMatching(query, constructionPattern, attachData, vertexStrategy, edgeStrategy, graphStatistics)); }
@Override public GraphCollection query(String query, String constructionPattern, boolean attachData, MatchStrategy vertexStrategy, MatchStrategy edgeStrategy, GraphStatistics graphStatistics) { return callForCollection(new CypherPatternMatching(query, constructionPattern, attachData, vertexStrategy, edgeStrategy, graphStatistics)); }
@Override public GraphCollection groupEdgesByRollUp( List<String> vertexGroupingKeys, List<AggregateFunction> vertexAggregateFunctions, List<String> edgeGroupingKeys, List<AggregateFunction> edgeAggregateFunctions) { if (edgeGroupingKeys == null || edgeGroupingKeys.isEmpty()) { throw new IllegalArgumentException("Missing edge grouping key(s)."); } return callForCollection(new EdgeRollUp(vertexGroupingKeys, vertexAggregateFunctions, edgeGroupingKeys, edgeAggregateFunctions)); }
/** * {@inheritDoc} */ @Override public GraphCollection splitBy(String propertyKey) { return callForCollection(new Split(new PropertyGetter<>(Lists.newArrayList(propertyKey)))); }
@Override public GraphCollection splitBy(String propertyKey) { return callForCollection(new Split(new PropertyGetter<>(Lists.newArrayList(propertyKey)))); }
.callForCollection(new BusinessTransactionGraphs());
.setTraverserStrategy(TraverserStrategy.SET_PAIR_BULK_ITERATION) .setTraverser(new DFSTraverser()).build(); GraphCollection matches = logicalGraph.callForCollection(patternMatchingOperator);
@Test public void testByElementIds() throws Exception { String graph = "input[" + // First component "(v0 {id:0, component:1})" + // Second component "(v1 {id:1, component:2})-[e0]->(v2 {id:2, component:2})" + "(v1)-[e1]->(v3 {id:3, component:2})" + "(v2)-[e2]->(v3)" + "(v3)-[e3]->(v4 {id:4, component:2})" + "(v4)-[e4]->(v5 {id:5, component:2})" + "]"; FlinkAsciiGraphLoader loader = getLoaderFromString(graph); LogicalGraph input = loader.getLogicalGraphByVariable("input"); GraphCollection result = input .callForCollection(new WeaklyConnectedComponentsAsCollection(propertyKey, 10)); GraphCollection components = input.splitBy("component"); collectAndAssertTrue(result.equalsByGraphElementIds(components)); } }
@Test public void testSplitWithMultipleKeys() throws Exception { FlinkAsciiGraphLoader loader = getLoaderFromString("" + "input[" + "(v0 {key1 : 0})" + "(v1 {key1 : 1})" + "(v2 {key1 : 1, key2 : 0})" + "(v3 {key1 : 0})" + "(v1)-[e1]->(v2)" + "(v3)-[e2]->(v0)" + "(v2)-[e3]->(v0)" + "]" + "graph1[" + "(v1)-[e1]->(v2)" + "]" + "graph2[" + "(v2)-[e3]->(v0)" + "(v3)-[e2]->(v0)" + "]" ); LogicalGraph input = loader.getLogicalGraphByVariable("input"); GraphCollection result = input .callForCollection(new Split(SplitTest::getSplitValues)); collectAndAssertTrue(result.equalsByGraphElementIds( loader.getGraphCollectionByVariables("graph1", "graph2"))); }
@Test public void testExecute() throws Exception { FlinkAsciiGraphLoader loader = new FlinkAsciiGraphLoader(getConfig()); loader.initDatabaseFromFile(getFilePath("/data/gdl/iig_btgs.gdl")); LogicalGraph iig = loader.getLogicalGraphByVariable("iig"); GraphCollection expectation = loader .getGraphCollectionByVariables("btg1", "btg2", "btg3", "btg4"); GraphCollection result = iig .callForCollection(new BusinessTransactionGraphs()); collectAndAssertTrue(expectation.equalsByGraphElementData(result)); } }
@Test public void testSplit() throws Exception { FlinkAsciiGraphLoader loader = getLoaderFromString( "input[" + "(v0 {key1 : 0})" + "(v1 {key1 : 1})" + "(v2 {key1 : 1})" + "(v3 {key1 : 0})" + "(v1)-[e1]->(v2)" + "(v3)-[e2]->(v0)" + "(v2)-[e3]->(v0)" + "]" + "graph1[" + "(v1)-[e1]->(v2)" + "]" + "graph2[" + "(v3)-[e2]->(v0)" + "]" ); LogicalGraph input = loader.getLogicalGraphByVariable("input"); GraphCollection result = input.callForCollection(new Split(SplitTest::getSplitValues)); collectAndAssertTrue(result.equalsByGraphElementIds( loader.getGraphCollectionByVariables("graph1", "graph2"))); }
.callForCollection(new Split(SplitTest::getSplitValues));
.callForCollection(new BusinessTransactionGraphs());