query-cf38a8029cdcb37e90ce08e70541b800

rq turtle/ttl

(68) Multi-area/bar chart: parties' votes received in Taiwanese presidential electionsNo.68 (2022.07.08T1457 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#>
# title of the query
#title: bar chart of parties' votes received in Taiwanese presidential elections
# viewed as bar chart (also viewable as area chart, line chart, and table)
#defaultView:BarChart
# select "?election ?party ?time ?votes ?partyLabel" to view ?time as X-axis, ?votes as Y-axis,
# and ?partyLabel as groups of coordinates
SELECT DISTINCT ?election ?party ?time ?votes ?partyLabel
WHERE {
  # ?election is instance of (P31) "subclass of (P279)" [ZeroOrMorePath (*)] presidential election (Q858439)
  ?election wdt:P31/wdt:P279* wd:Q858439;
            # ?election applies to jurisdiction (P1001): Taiwan (Q865)
            wdt:P1001 wd:Q865;
            # ?election's voting system (P8196) is subclass of (P279) [ZeroOrMorePath (*)] direct election (Q1196727)
            wdt:P8196/wdt:P279* wd:Q1196727;
            # ?election's point in time (P585) is ?time
            wdt:P585 ?time;
            # ?election's "candidate" (P726) statement is ?x_candidate
            p:P726 ?x_candidate.
  # ?x_candidate's value is ?candidate
  ?x_candidate ps:P726 ?candidate;
               # ?x_candidate's qualifier "represents" (P1268) is ?party
               pq:P1268 ?party;
               # ?x_candidate's qualifier "votes received" (P1111) is ?votes
               pq:P1111 ?votes
  # 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("?candidate") v1("?election"):::projected v5("?party"):::projected v2("?time"):::projected v6("?votes"):::projected v3("?x_candidate") a1((" ")) a2((" ")) c3(["wd:Q858439"]):::iri c14(["bd:serviceParam"]):::iri c7(["wd:Q1196727"]):::iri c5(["wd:Q865"]):::iri c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v1 --"p:direct/P1001"--> c5 v1 --"p:direct/P8196"--> a2 a2 --"p:direct/P279"--> c7 v1 --"p:direct/P585"--> v2 v1 --"p:P726"--> v3 v3 --"p:statement/P726"--> v4 v3 --"p:qualifier/P1268"--> v5 v3 --"p:qualifier/P1111"--> v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end