Added GetQuery() and GetRules()

Major functions GetQuery() and GetRules() added. The first returns
query, the second returns all the rules.