query-c78565215456b327dbc9f40892fcb2ed
(30) Map of electoral districts layered by parliamentary group: members of Parliament elected in the 2019 United Kingdom general electionNo.30 (2020.01.08T0453 created)
Use at
- https://query.wikidata.org/sparql
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 Parliament (MPs) elected in the 2019 United Kingdom general election
# querying qualifiers
# viewed as map of MPs' electoral districts, layered by parliamentary group (also viewable as table)
#defaultView:Map{"layer":"?parliamentary_groupLabel"}
SELECT ?member ?memberLabel ?image ?genderLabel ?birth_date ?parliamentary_groupLabel ?electoral_districtLabel ?coord
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) UK members of Parliament (Q16707842)
?y wdt:P279* wd:Q16707842.
# the value of ?x's qualifier "elected in" (P2715) is 2019 UK general election (Q30173038)
?x pq:P2715 wd:Q30173038
# optional: show ?member's image (P18) as ?image
OPTIONAL {?member wdt:P18 ?image}
# 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 ?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;
v7("?birth_date"):::projected
v10("?coord"):::projected
v9("?electoral_district")
v6("?gender")
v5("?image"):::projected
v2("?member"):::projected
v8("?parliamentary_group")
v1("?parliamentary_groupLabel"):::projected
v3("?x")
v4("?y")
c4(["wd:Q16707842"]):::iri
c16(["zh-hans,en"]):::literal
c6(["wd:Q30173038"]):::iri
c14(["bd:serviceParam"]):::iri
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> v4
v4 --"p:direct/P279"--> c4
v3 --"p:qualifier/P2715"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P18".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P21".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P569".-> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P4100".-> v8
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P768".-> v9
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v9 -."p:direct/P625".-> v10
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end