query-9ecc961f6d68a7355c9fa2bff4fd2778

rq turtle/ttl

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

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' }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?election"):::projected v5("?electoralDistrict"):::projected v4("?endTime"):::projected v10("?image"):::projected v1("?item"):::projected v6("?party"):::projected v2("?positionStatement") v9("?replacedBy"):::projected v8("?replaces"):::projected v3("?startTime"):::projected v12("?twitter"):::projected v11("?website"):::projected a1((" ")) a2((" ")) a3((" ")) c3(["wd:Q16707842"]):::iri c20(["en"]):::literal c5(["wd:Q29974940"]):::iri c18(["bd:serviceParam"]):::iri v1 --"p:P39"--> v2 v2 --"p:statement/P39"--> c3 v2 --"p:qualifier/P2937"--> c5 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; a1 --"p:statement/P39"--> c3 c5 --"p:direct/P155"--> a2 a1 --"p:qualifier/P2937"--> a2 v1 --"p:P39"--> a1 end subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; c5 --"p:direct/P155"--> a3 v1 --"p:direct/P463"--> a3 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P580".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P582".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P768".-> v5 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P102".-> v6 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P2715".-> v7 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/1365".-> v8 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/1365".-> v9 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P18".-> v10 end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P856".-> v11 end subgraph optional9["(optional)"] style optional9 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P2002".-> v12 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c18 --"wikibase:language"--> c20 end