Move node labels from node patterns to WHERE using ast rewriting