VarDependencies { public List<Var> getUsedVars(ClauseId clauseId) { return Collections.unmodifiableList(this.usedVariablesInClause.get(clauseId)); } VarDependencies(final Statement statement); List<Var> getUsedVars(ClauseId clauseId); Set<Var> getAllVariables(); List<Var> getUsedAndIndirectUsedVars(ClauseId clauseId); AvailableVariables getReachableVars(ClauseId clauseId); List<Relationship> getRelationships(ClauseId clauseId); List<Expr> getReturnExprs();  }
@Test public void testVariablesMatchCommaReturn() { String cypher = "" + "MATCH (a), (b)\n" + "RETURN a.firstName"; Statement st = PassAvailables.parseCypher(cypher); SingleQuery sq = (SingleQuery) st.query.part; VarDependencies dependencies = new VarDependencies(st); Match match = ((Match) sq.clauses.iterator().next()); Iterator<PatternPart> iter = this.getPatternPart(match); List<Var> match0 = dependencies.getUsedVars(this.genClauseForASTNode(iter.next())); List<Var> comma1 = dependencies.getUsedVars(this.genClauseForASTNode(iter.next())); Assert.assertEquals(match0.size(), 1); Assert.assertEquals(comma1.size(), 1); Assert.assertEquals(match0.get(0).name, "a"); Assert.assertEquals(comma1.get(0).name, "b"); }