Refactor GraphController:queryAction