Look for items that are set as the 'elected in' for a UK MP, but have instance of: 'by-election', rather than 'UK Parliamentary by-election'
SELECT DISTINCT ?item ?itemLabel
WHERE
{
?person p:P39 [ps:P39/wdt:P279 wd:Q16707842; pq:P2715 ?item].
?item wdt:P31 wd:Q1057954 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Petscan -> QuickStatements: batch https://tools.wmflabs.org/editgroups/b/QSv2T/1595836635055
Find by-elections with no 'successful candidate', but which have been set as someone's 'elected in'
SELECT DISTINCT ?item ?itemLabel ?person ?personLabel
WHERE {
?person p:P39 [ps:P39/wdt:P279 wd:Q16707842; pq:P2715 ?item].
?item wdt:P31/wdt:P279* wd:Q1057954 .
MINUS { ?item wdt:P991 [] }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Fetch with:
wd sparql derive-successful-candidate.rq | jq -r '.[] | "\(.item.value)\tP991\t\(.person.value)"' | tee >(pbcopy)
And sent to QuickStatements as https://editgroups.toolforge.org/b/QSv2T/1595838252734/