Class Neo4jPatternExpander

java.lang.Object
org.evomaster.client.java.controller.neo4j.heuristics.Neo4jPatternExpander

public class Neo4jPatternExpander extends Object
Flattens a MatchPattern into one with no variable-length relationships and no quantified path patterns (QPPs), so the rest of the calculator only ever deals with plain nodes and edges. Two independent expansions run in sequence, each to the construct's lower bound L (if the lower bound is satisfied the query succeeds, so the upper bound is irrelevant):
  1. expandQuantifiedPaths(org.evomaster.client.java.controller.neo4j.operations.MatchPattern, java.util.List<org.evomaster.client.java.controller.neo4j.conditions.CypherCondition>): every QPP (((a)-[]->(b)){1,3}) is replaced by L clones of its sub-pattern, chained end to end and spliced onto the outer nodes it sits between (see QuantifiedPathPattern.getEntryVariable()/QuantifiedPathPattern.getExitVariable()). Runs first so its output — plain nodes/edges, some possibly still variable-length — feeds the next step.
  2. The pre-existing variable-length-edge expansion (*, +, *n..m): a lower bound L ≥ 2 becomes a chain of L cloned edges with L-1 fresh intermediate nodes inheriting both endpoints' labels/properties; L == 1 is a single ordinary edge; L == 0 merges the two endpoints (a zero-length path identifies them) and drops the edge. This also expands variable-length edges that were themselves inside a QPP's sub-pattern, since step 1 clones them unchanged (min/max preserved) into the flat edge list.