Performance optimisation: subquery to fetch all compound URIs based on the class requested