query: # Query to find the classes of items that are
    # most often connected by the property ?p = P1441
    # Query generated by [[Template:MostConnectedClasses]]
  
  SELECT ?a_class ?a_classLabel ?b_class ?b_classLabel ?count WHERE {
    {
      SELECT ?a_class ?b_class (COUNT(*) AS ?count) WHERE {
         ?a wdt:P31 ?a_class .
         ?b wdt:P31 ?b_class .
         ?a ?p ?b .
         BIND (wdt:P1441 AS ?p)
      } GROUP BY ?a_class ?b_class
    } . 
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "en" .
    }
  }
  # HAVING (?count > 1)
  ORDER BY DESC(?count) ?b_classLabel ?a_classLabel
  LIMIT 100