query: SELECT ?item ?itemLabel ?start ?end ?term ?termLabel ?district ?districtLabel ?group ?groupLabel WHERE { 
    ?item p:P39 ?ps .
    ?ps ps:P39 [ wdt:P279* wd:Q18526194 ].
    OPTIONAL { ?ps pq:P580 ?start }
    OPTIONAL { ?ps pq:P582 ?end }
    OPTIONAL { ?ps pq:P2937 ?term }
    OPTIONAL { ?ps pq:P768 ?district }
    OPTIONAL { ?ps pq:P4100 ?group }
    
    FILTER NOT EXISTS { ?ps pq:P768 [] }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
  }