Introduced abstract query base class and unified predicate generation.