@Test public void sourceAndPatternToSourceFusewithPattern() throws Exception { FlinkAsciiGraphLoader loader = getLoaderFromString("source:G {source : \"graph\"}[" + "(a:A {atype : \"avalue\"})-[alpha:AlphaEdge {alphatype : \"alphavalue\"}]->(b:B {btype : " + "\"bvalue\"}) " + "(a:A {atype : \"avalue\"})-[beta:BetaEdge {betatype : \"betavalue\"}]->(b:B {btype : " + "\"bvalue\"}) " + "(a:A {atype : \"avalue\"})-[l:loop {ltype : \"lvalue\"}]->(c:C {ctype : \"cvalue\"}) " + "(c:C {ctype : \"cvalue\"})-[g:GammaEdge {gtype : \"gvalue\"}]->(d:D {dtype : \"dvalue\"}) " + "]" + "" + "pattern:G {pattern : \"graph\"}[" + "(a:A {atype : \"avalue\"})-[alpha:AlphaEdge {alphatype : \"alphavalue\"}]->(b:B {btype : " + "\"bvalue\"}) " + "]" + "" + "source_fusewith_pattern:G {source : \"graph\"}[" + "(k2:G {pattern : \"graph\"})-[:BetaEdge {betatype : \"betavalue\"}]->(k2:G {pattern : " + "\"graph\"}) " + "(k2:G {pattern : \"graph\"})-[:loop {ltype : \"lvalue\"}]->(c2:C {ctype : \"cvalue\"}) " + "(c2:C {ctype : \"cvalue\"})-[:GammaEdge {gtype : \"gvalue\"}]->(d2:D {dtype : \"dvalue\"})" + " " + "]" + ""); LogicalGraph searchGraph = loader.getLogicalGraphByVariable("source"); LogicalGraph patternGraph = loader.getLogicalGraphByVariable("pattern"); VertexFusion f = new VertexFusion(); LogicalGraph output = f.execute(searchGraph, patternGraph); LogicalGraph expected = loader.getLogicalGraphByVariable("source_fusewith_pattern"); collectAndAssertTrue(output.equalsByData(expected)); if (deepSearch) { collectAndAssertTrue(VertexFusionUtils.myInducedEdgeSubgraphForFusion(searchGraph, expected) .equalsByElementIds(VertexFusionUtils.myInducedEdgeSubgraphForFusion(expected, searchGraph))); } }
@Override public LogicalGraph execute(LogicalGraph searchGraph, LogicalGraph graphPatterns) { return execute(searchGraph, graphPatterns.getCollectionFactory() .fromDataSets( graphPatterns.getGraphHead(), graphPatterns.getVertices(), graphPatterns.getEdges())); }
VertexFusion implements BinaryBaseGraphToBaseGraphOperator<LogicalGraph> { @Override public LogicalGraph execute(LogicalGraph searchGraph, LogicalGraph graphPatterns) { return execute(searchGraph, graphPatterns.getCollectionFactory() .fromDataSets( graphPatterns.getGraphHead(), graphPatterns.getVertices(), graphPatterns.getEdges())); } }
VertexFusion implements BinaryBaseGraphToBaseGraphOperator<LogicalGraph> { @Override public LogicalGraph execute(LogicalGraph searchGraph, LogicalGraph graphPatterns) { return execute(searchGraph, graphPatterns.getCollectionFactory() .fromDataSets( graphPatterns.getGraphHead(), graphPatterns.getVertices(), graphPatterns.getEdges())); }  }
VertexFusion implements BinaryBaseGraphToBaseGraphOperator<LogicalGraph> { @Override public LogicalGraph execute(LogicalGraph searchGraph, LogicalGraph graphPatterns) { return execute(searchGraph, graphPatterns.getCollectionFactory() .fromDataSets( graphPatterns.getGraphHead(), graphPatterns.getVertices(), graphPatterns.getEdges())); }  @Override LogicalGraph execute(LogicalGraph searchGraph, LogicalGraph graphPatterns); LogicalGraph execute(LogicalGraph searchGraph, GraphCollection graphPatterns); }
VertexFusion implements BinaryBaseGraphToBaseGraphOperator<LogicalGraph> { @Override public LogicalGraph execute(LogicalGraph searchGraph, LogicalGraph graphPatterns) { return execute(searchGraph, graphPatterns.getCollectionFactory() .fromDataSets( graphPatterns.getGraphHead(), graphPatterns.getVertices(), graphPatterns.getEdges())); }  @Override LogicalGraph execute(LogicalGraph searchGraph, LogicalGraph graphPatterns); LogicalGraph execute(LogicalGraph searchGraph, GraphCollection graphPatterns);  }