query-e4822e10f75aded4ce20913341513bf2

rq turtle/ttl

(67) Multi-line chart: population and eligible voters in Taiwanese presidential electionsNo.67 (2022.07.07T2213 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 bd: <http://www.bigdata.com/rdf#>
# title of the query (my first time using title)
#title: line chart of population and eligible voters in Taiwanese presidential elections
# viewed as line chart (also viewable as table)
#defaultView:LineChart
# select "?vote ?time ?number ?peopleLabel" to view ?time as X-axis, ?number as Y-axis,
# and ?peopleLabel as groups of coordinates
SELECT DISTINCT ?vote ?time ?number ?peopleLabel
WHERE {
  # ?vote is instance of (P31) "subclass of (P279)" [ZeroOrMorePath (*)] presidential election (Q858439)
  ?vote wdt:P31/wdt:P279* wd:Q858439;
        # ?vote applies to jurisdiction (P1001): Taiwan (Q865)
        wdt:P1001 wd:Q865;
        # ?vote's point in time (P585) is ?time
        wdt:P585 ?time;
        # ?vote's voting system (P8196) is subclass of (P279) [ZeroOrMorePath (*)] direct election (Q1196727)
        wdt:P8196/wdt:P279* wd:Q1196727;
        # ?vote's has the relation (?relation) with ?number
        ?relation ?number
  # define ?relation as population (P1082) or eligible voter (P1867)
  ### Note: Other properties (ballots cast (P1868), total valid votes (P1697), number of spoilt votes (P5044),
  ### number of blank votes (P5045), etc.) can be added to VALUES.
  VALUES ?relation {wdt:P1082 wdt:P1867}
  # get ?relation's property label by ?people
  ?people wikibase:directClaim ?relation
  # show label in auto language as default, and English when no default label exists
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?number"):::projected v5("?people") v5("?relation") v2("?time"):::projected v1("?vote"):::projected a1((" ")) a2((" ")) c3(["wd:Q858439"]):::iri c11(["bd:serviceParam"]):::iri c8(["wd:Q1196727"]):::iri c5(["wd:Q865"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P1001"--> c5 v1 --"wdt:P585"--> v2 v1 --"wdt:P8196"--> a2 a2 --"wdt:P279"--> c8 v1 -->v5--> v4 bind0[/VALUES ?relation/] bind0-->v5 bind00(["wdt:P1082"]) bind00 --> bind0 bind01(["wdt:P1867"]) bind01 --> bind0 v5 --"wikibase:directClaim"--> v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end