query: PREFIX wd: <http://www.wikidata.org/entity/>
  PREFIX wdt: <http://www.wikidata.org/prop/direct/>
  PREFIX wikibase: <http://wikiba.se/ontology#>
  PREFIX p: <http://www.wikidata.org/prop/>
  PREFIX v: <http://www.wikidata.org/prop/statement/>
  PREFIX q: <http://www.wikidata.org/prop/qualifier/>
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  PREFIX ps: <http://www.wikidata.org/prop/statement/>
  PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
  
   #  Query to find event-classes and top-level subclasses
   #  for items with country:UK that are P31/P279+ wd:Q1190554 (event)
   #  
   #  Sort 2: by item count in event class
  
  SELECT ?eventclass ?eventclassLabel ?subclass ?subclassLabel ?count WHERE {
    {
      SELECT ?eventclass (COUNT(DISTINCT ?event) AS ?count) WHERE {
          ?eventclass wdt:P279+ wd:Q1190554 .  # event
          ?event wdt:P31 ?eventclass .
          ?event wdt:P17 wd:Q145 .           
      } GROUP BY ?eventclass 
    } .
    ?eventclass wdt:P279* ?subclass .
    ?subclass wdt:P279 wd:Q1190554 .           
  
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en" .
    }
  } ORDER BY DESC(?count) ?subclassLabel