query: # parties elected in the 1997-2001 Parliament - 659 members.
  # Labour and Labour Co-Op are merged
  SELECT DISTINCT ?party1 ?party1Label (count(DISTINCT(?item)) as ?count) 
  {
   ?item p:P39 ?positionStatement . ?positionStatement ps:P39 wd:Q36634044 .
   ?positionStatement ps:P39 ?term . 
   ?positionStatement pq:P768 ?constituency . 
   ?positionStatement pq:P2715 ?election .     # relevant general election
   ?positionStatement pq:P4100 ?party . 
   wd:Q36634044 wdt:P2715 ?election .
   BIND(IF(?party = wd:Q6467393, wd:Q9630 , ?party) AS ?party1) .
   SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
  } group by ?party1 ?party1Label order by desc(?count)