Skip to content

Instantly share code, notes, and snippets.

@tmtmtmtm
Last active July 23, 2020 08:21
Show Gist options
  • Save tmtmtmtm/0e44790c9e9813829da0026297fdc256 to your computer and use it in GitHub Desktop.
Save tmtmtmtm/0e44790c9e9813829da0026297fdc256 to your computer and use it in GitHub Desktop.
Migrate 'quantity' of seats won by a party in an election to 'number of representatives'

Per discussion at https://www.wikidata.org/wiki/Property_talk:P1410

election-winner-quantity.rq:

SELECT DISTINCT ?st 
WHERE {
  ?st ps:P991 ?winner ; pq:P1114 ?quantity .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

This gives 3919 results.

Ran as:

wd sparql election-winner-quantity.rq | awk '{ print $1,"P1114","P1410" }' | 
  wd mq --batch --summary "Move P991/P1114 to P991/P1410 per https://www.wikidata.org/wiki/Property_talk:P1410"

-> batches https://tools.wmflabs.org/editgroups/b/wikibase-cli/d1e31dd833b33 + https://tools.wmflabs.org/editgroups/b/wikibase-cli/dd98c6ba7220b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment