query: SELECT ?grouping (SAMPLE(?_higher_grouping) as ?higher_grouping) (COUNT(DISTINCT ?entity) as ?count) (SAMPLE(?entity) as ?sample) WHERE { ?entity wdt:P882 []. ?entity wdt:P31 ?grouping. OPTIONAL { ?grouping wdt:P17/p:P1813 ?st0 . ?st0 pq:P31 wd:Q28840786 . ?st0 ps:P1813  ?_higher_grouping } } GROUP BY ?grouping HAVING (?count > 0) ORDER BY DESC(?count) LIMIT 1000