query-9ecc961f6d68a7355c9fa2bff4fd2778
12:17, 9 June 2017 (UTC)) talk (MisterSynergy in good shape? It seems doable to import from there, but if others already work to import this table to Wikidata, I don’t want to interfere… —en:List of MPs elected in the United Kingdom general election, 2017 Is 12:22, 9 June 2017 (UTC)) talk (Andrew Gray. So if you do an import, that would be the best approach. I'm going to work through all of these at the weekend to double-check & make sure it's accurate, but if you want to do a first run, feel free and I'll tidy up later :-) Wikidata:WikiProject British Politicians - see (P39)position held qualifier on (P2937)parliamentary term :[parliament] as a primary property is now deprecated; we're slowly working on moving this across to be a (P463)member of Also worth noting that NB "Start time: 2017" will pick up anyone elected in a byelection earlier in 2017 (were there any who were't re-elected? Can't recall.)20:18, 9 June 2017 (UTC)) talk (Andrew GrayAn import/migration will happen, but at the moment doing it by hand is safest. The "member of" properties can't automatically be added to P39, as Oravrattas says, because a lot of people have multiple different P39s due to representing different seats. It's going to be a long grind! 18:06, 9 June 2017 (UTC)) talk (Oravrattas (the last one strictly doesn't belong here, but unless/until we have individual election items for each constituency, it seemed more useful to capture it whilst it was to hand, and migrate it later if needed) --(P1111)votes received , and (P102)member of political party , (P768)electoral district to them all, along with (Q25052149)2017 United Kingdom general election = (P2715)elected in , it was fairly slow going, so I only got the first 100 or so results declared. Unfortunately most of the tools for bulk import don't handle adding a new P39 without interfering with existing ones, so short of writing a custom bot, I don't know of a way to automate this. (FWIW I've also been adding s(P2937)parliamentary term with relevant s(P39)position held to (P463)member of I was adding results most of last night, but as I was using it as a chance to migrate all the old records from 12:41, 9 June 2017 (UTC)) talk (MisterSynergy— I am aware that the first query is more precise to deliver what was originally requested. However, the other one was requested as an alternative as well, but it is not that simple to exclude former MPs in that way. Do you happen to know whether someone plans to import this data? Andy mentioned that there could be an editathon.Thanks for your comment. : I adapted the query to the model proposed by Andrew. Not all new MPs are already updated, but this lists of new MPs already populates: Andrew Gray, Pigsonthewing @
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#>
SELECT ?item ?itemLabel ?itemDescription ?website ?twitter ?image ?startTime ?endTime ?party ?election ?electoralDistrict ?replaces ?replacedBy {
?item p:P39 ?positionStatement .
?positionStatement ps:P39 wd:Q16707842; pq:P2937 wd:Q29974940 .
MINUS { ?item p:P39 [ ps:P39 wd:Q16707842; pq:P2937 [ ^(wdt:P155+) wd:Q29974940 ] ] . }
MINUS { ?item wdt:P463 [ ^(wdt:P155+) wd:Q29974940 ] . }
OPTIONAL { ?positionStatement pq:P580 ?startTime . }
OPTIONAL { ?positionStatement pq:P582 ?endTime . }
OPTIONAL { ?positionStatement pq:P768 ?electoralDistrict . }
OPTIONAL { ?positionStatement pq:P102 ?party . }
OPTIONAL { ?positionStatement pq:P2715 ?election . }
OPTIONAL { ?positionStatement pq:1365 ?replaces . }
OPTIONAL { ?positionStatement pq:1365 ?replacedBy . }
OPTIONAL { ?item wdt:P18 ?image . }
OPTIONAL { ?item wdt:P856 ?website . }
OPTIONAL { ?item wdt:P2002 ?twitter . }
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
}