Adding ordered ancestor query