Separated graph query handling from select handling, updated tests