Added QueryGraph and its related things.