query: SELECT ?grouping (SAMPLE(?_higher_grouping) as ?higher_grouping) (COUNT(DISTINCT ?entity) as ?count) (SAMPLE(?entity) as ?sample) WHERE { ?entity wdt:P31/wdt:P279* wd:Q55488; wdt:P17 wd:Q408. ?entity wdt:P131/wdt:P131* ?grouping. OPTIONAL { ?grouping wdt:P131  ?_higher_grouping } } GROUP BY ?grouping HAVING (?count > 7) ORDER BY DESC(?count) LIMIT 1000