Factorize RESOURCE-ITERATOR out of HAS-MANY and HAS-ONE :HAVING. Also implement HAS-MANY :HAVING.