rules and data base for query system