query: SELECT ?item ?itemLabel ?district ?region ?party ?propOrder ?age ?assumedOffice (COUNT(?terms) AS ?Nelected)  WHERE {
      ?item p:P39 ?position .
      ?position ps:P39 wd:Q14850694 ;
                pq:P2937 ?terms
    {SELECT ?item ?district ?region ?propOrder ?assumedOffice WHERE {
      ?item p:P39 ?position .
    ?position ps:P39 wd:Q14850694 ; # 대한민국의 국회의원
              pq:P2937 wd:Q90759969. # 입법기: 21대 국회
    OPTIONAL { ?position pq:P580 ?assumedOffice. } # 임기시작일
    MINUS { ?position pq:P582 ?endTime. } # 의원직 상실 제외
    OPTIONAL { ?position pq:P768 ?district
             OPTIONAL { ?district wdt:P131* ?region .
                      ?region wdt:P31/wdt:P279 wd:Q10864048 .}
             } # 선거구
    OPTIONAL { ?position pq:P1268 ?propParty ;
                         pq:P1545 ?propOrder . } #비례대표
    } }
    OPTIONAL { ?item p:P102 ?par .
               ?par ps:P102 ?party. 
             MINUS { ?party wdt:P576 ?dissolved } #정당 소멸 제외
             MINUS { ?par pq:P582 ?exitParty } #탈당
             } # 소속 정당
    OPTIONAL { ?item wdt:P569 ?dateOfBirth .
              BIND (ROUND(FLOOR( (now() - ?dateOfBirth)/365.2425 )) as ?age) #연령
              }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
  }
  GROUP BY ?item ?itemLabel ?district ?region ?party ?propOrder ?age ?assumedOffice