Km query builder