Wrapping a compound query around a loop.
From semantic-mediawiki.org
Fragment of a discussion from Semantic MediaWiki Community Portal
I should mention that I've tried the usual suspects of escaping a loop. The compound queries work fine too, unless I combine it with a loop.
It do not think that this is possible. However I may be wrong. The better place to seek help in this case appears to be the Semantic Compound Queries extension help page or the Semantic MediaWiki mailing lists. Cheers