User:Oravrattas/daynotes/2017-06-25

From Wikidata
Jump to navigation Jump to search

Scottish Parliament by-elections

[edit]

Andrew Gray has created Scottish Parliament by-election (Q30572165), and migrated all the relevant items to be instances of it, so I've helped by making sure each of them has a correct point in time (P585) (previously they all only had the year). We also need to split up 2000 Glasgow Anniesland by-elections (Q5566745), which was elections to both the Scottish Parliament and Westminster.

Married couples who are parliamentarians in different countries to each other

[edit]

Inspired by discovering that Stephen Kinnock (Q3377178), a Stephen Kinnock (Q3377178), is married to Helle Thorning-Schmidt (Q57652) (Prime Minister of Denmark (Q795477)) — a query to find all cross-border parliamentarian couples:

SELECT DISTINCT ?person1 ?person1Label ?position1 ?position1Label ?person2 ?person2Label ?position2 ?position2Label
WHERE { 
  ?position1 wdt:P279* wd:Q4175034 ; wdt:P1001 ?country1 .
  ?position2 wdt:P279* wd:Q4175034 ; wdt:P1001 ?country2 .
  
  ?country1 wdt:P31 wd:Q6256.
  ?country2 wdt:P31 wd:Q6256.
  
  ?person1 wdt:P39 ?position1 ; wdt:P21 wd:Q6581072 .
  ?person2 wdt:P39 ?position2 ; wdt:P26 ?person1 .
  FILTER (?country1 != ?country2)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
Try it!

Membership Grids for Scottish Parliament terms

[edit]

Also, to help find cases where two memberships have been combined, and need split:

SELECT DISTINCT ?who ?whoLabel ?positionLabel ?start1 ?start2 {
  ?position wdt:P279* wd:Q1711695 .
  ?who p:P39 [ ps:P39 ?position ; pq:P580 ?start1 ; pq:P580 ?start2 ] .
  FILTER (?start2 > ?start1) 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?start1 ?whoLabel
Try it!