fixed query generator, some needed graph as argument