Refactor Cypher query grammar to sequence of clauses