query-8006ec86be628138744115c71af75d8b
TODO
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 the 1974-74 Parliament -635 seats.
SELECT DISTINCT ?party1 ?party1Label ?rgb (count(DISTINCT(?item)) as ?count)
{
?item p:P39 ?positionStatement . ?positionStatement ps:P39 ?term . ?term wdt:P279* wd:Q16707842 .
?positionStatement ps:P39 wd:Q41582615 .
?positionStatement pq:P768 ?constituency .
?positionStatement pq:P2715 wd:Q119524 . # feb 74 general election
?positionStatement pq:P4100 ?party .
BIND(IF(?party = wd:Q6467393, wd:Q9630 , ?party) AS ?party1) .
optional { ?party1 wdt:P465 ?rgb } . # colour if known
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} group by ?party1 ?party1Label ?rgb order by desc(?count)
#defaultView:BubbleChart
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?constituency")
v9("?count")
v2("?item"):::projected
v6("?party")
v7("?party1"):::projected
v3("?positionStatement")
v8("?rgb"):::projected
v4("?term")
c4(["wd:Q16707842"]):::iri
c14(["en"]):::literal
c12(["bd:serviceParam"]):::iri
c8(["wd:Q119524"]):::iri
c5(["wd:Q41582615"]):::iri
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> v4
v4 --"p:direct/P279"--> c4
v3 --"p:statement/P39"--> c5
v3 --"p:qualifier/P768"--> v5
v3 --"p:qualifier/P2715"--> c8
v3 --"p:qualifier/P4100"--> v6
bind0[/"if(?party = 'wd:Q6467393','wd:Q9630',?party)"/]
v6 --o bind0
bind0 --as--o v7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P465".-> v8
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind2[/"count(?item)"/]
v2 --o bind2
bind2 --as--o v9