query-10dc98aa84f84f9feb1cce4e58c9749f
Merging two known values together 20:35, 7 April 2019 (UTC)) talk (Andrew Gray, so they show up in the Labour count (giving them a total of 301) and don't have a line of their own. Is it possible to do this by hard-coding something in as a BIND line? (Q9630)Labour Party as part of (Q6467393)Labour Co-operative . Everyone treats them as the same when doing things like counting total numbers of seats, even though they're officially distinct. I'd like to count any (Q6467393)Labour Co-operative and (Q9630)Labour Party I'm working on a query to show parties after an election. At the moment, it gets all the results and shows them with the right colours. However, the UK has two parties that are in effectively a permanent very close coalition -
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 ?party ?partyLabel ?rgb (count(?party1) 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 .
optional { ?party wdt:P465 ?rgb } . # colour if known
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} group by ?party ?partyLabel ?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")
v6("?party"):::projected
v8("?party1"):::projected
v3("?positionStatement")
v7("?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
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:direct/P465".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind1[/"count(?party1)"/]
v8 --o bind1
bind1 --as--o v9