query-fc41701c4e5a29e15666ea4c24b61725

rq turtle/ttl

(31) Map of electoral districts layered by parliamentary group: members of the 10th Legislative Yuan, TaiwanNo.31 (2020.01.20T0523 created)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# members of the 10th Legislative Yuan, Taiwan
# querying qualifiers (in comparison, adding parliamentary_term/start_time/end_time/replaces/replaced_by to elected_in/parliamentary_group/electoral_district)
# viewed as map of electoral districts, layered by parliamentary group (also viewable as table)
#defaultView:Map{"layer":"?parliamentary_groupLabel"}
SELECT ?member ?memberLabel ?genderLabel ?birth_date ?image ?start_time ?elected_inLabel ?parliamentary_groupLabel ?electoral_districtLabel ?coord ?replacesLabel ?end_time ?replaced_byLabel
WHERE {
  # ?member's "position held" (P39) statement is ?x
  ?member p:P39 ?x.
  # ?x's value is ?y
  ?x ps:P39 ?y.
  # ?y is any subclass of (P279) member of the Legislative Yuan (Q6310593)
  ?y wdt:P279* wd:Q6310593.
  # the value of ?x's qualifier "parliamentary term" (P2937) is 10th Legislative Yuan (Q25186942)
  ?x pq:P2937 wd:Q25186942
  # optional: show ?member's gender (P21) as ?gender
  OPTIONAL {?member wdt:P21 ?gender}
  # optional: show ?member's birth date (P569) as ?birth_date
  OPTIONAL {?member wdt:P569 ?birth_date}
  # optional: show ?member's image (P18) as ?image
  OPTIONAL {?member wdt:P18 ?image}
  # optional: show ?x's qualifier "elected in" (P2715) as ?elected_in
  ### Note: besides the 2020 Taiwanese legislative election, may also be elected in by-elections in the future
  OPTIONAL {?x pq:P2715 ?elected_in}
  # optional: show ?x's qualifier "start time" (P580) as ?start_time
  OPTIONAL {?x pq:P580 ?start_time}
  # optional: show ?x's qualifier "end time" (P582) as ?end_time
  OPTIONAL {?x pq:P582 ?end_time}
  # optional: show ?x's qualifier "replaces" (P1365) as ?replaces
  ### Note: 1. member from regional district replaces/replaced_by the one of the previous/next parliamentary term (or same parliamentary term for by-election) from the same regional district
  ### 2. member from party list, if applicable, replaces/replaced_by the one of the same parliamentary term from the same party list
  OPTIONAL {?x pq:P1365 ?replaces}
  # optional: show ?x's qualifier "replaced by" (P1366) as ?replaced_by
  OPTIONAL {?x pq:P1366 ?replaced_by}
  # optional: show ?x's qualifier "parliamentary group" (P4100) as ?parliamentary_group
  OPTIONAL {?x pq:P4100 ?parliamentary_group}
  # optional: show ?x's qualifier "electoral district" (P768) as ?electoral_district
  OPTIONAL {?x pq:P768 ?electoral_district
            # optional: show ?electoral_district's coordinate location (P625) as ?coord
            OPTIONAL {?electoral_district wdt:P625 ?coord}
            }
  # show label in simplified Chinese (zh-hans) as default, and English when no default label exists
  SERVICE wikibase:label { bd:serviceParam wikibase:language "zh-hans,en". } 
}
# order layer by ?parliamentary_groupLabel
order by ?parliamentary_groupLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?birth_date"):::projected v15("?coord"):::projected v8("?elected_in") v14("?electoral_district") v10("?end_time"):::projected v5("?gender") v7("?image"):::projected v2("?member"):::projected v13("?parliamentary_group") v1("?parliamentary_groupLabel"):::projected v12("?replaced_by") v11("?replaces") v9("?start_time"):::projected v3("?x") v4("?y") c21(["zh-hans,en"]):::literal c19(["bd:serviceParam"]):::iri c6(["wd:Q25186942"]):::iri c4(["wd:Q6310593"]):::iri v2 --"p:P39"--> v3 v3 --"p:statement/P39"--> v4 v4 --"p:direct/P279"--> c4 v3 --"p:qualifier/P2937"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P21".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P569".-> v6 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P18".-> v7 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P2715".-> v8 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P580".-> v9 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P582".-> v10 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P1365".-> v11 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P1366".-> v12 end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P4100".-> v13 end subgraph optional9["(optional)"] style optional9 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P768".-> v14 subgraph optional10["(optional)"] style optional10 fill:#bbf,stroke-dasharray: 5 5; v14 -."p:direct/P625".-> v15 end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c19 --"wikibase:language"--> c21 end