Note: This repo is largely a snapshop record of bring Wikidata information in line with Wikipedia, rather than code specifically deisgned to be reused.
The code and queries etc here are unlikely to be updated as my process evolves. Later repos will likely have progressively different approaches and more elaborate tooling, as my habit is to try to improve at least one part of the process each time around.
The Wikidata item — https://www.wikidata.org/wiki/Q4976591 — contains all the data expected already.
PositionHolderHistory already exists — starting version is https://www.wikidata.org/w/index.php?title=Talk:Q4976591&oldid=1256827100 with 25 dated memberships, 2 undated; and 11 warnigs.
The first step in the repo is always to edit add_P39.js script to configure the Item ID and source URL.
wd ee --dry add_P39.js | jq -r '.claims.P39.value' |
xargs wd sparql existing-p39s.js > wikidata.json
Comparison/source = https://en.wikipedia.org/wiki/Shadow_Home_Secretary
wb ee --dry add_P39.js | jq -r '.claims.P39.references.P4656' |
xargs bundle exec ruby scraper.rb | tee wikipedia.csv
bundle exec ruby new-P39s.rb wikipedia.csv wikidata.json |
wd ee --batch --summary "Add missing P39s, from $(wb ee --dry add_P39.js | jq -r '.claims.P39.references.P4656')"
6 additions made as https://tools.wmflabs.org/editgroups/b/wikibase-cli/8151547c29fd6
bundle exec ruby new-qualifiers.rb wikipedia.csv wikidata.json |
wd aq --batch --summary "Add missing qualifiers, from $(wb ee --dry add_P39.js | jq -r '.claims.P39.references.P4656')"
13 additions made as https://tools.wmflabs.org/editgroups/b/wikibase-cli/04cce5450cbe2
New version at https://www.wikidata.org/w/index.php?title=Talk:Q4976591&oldid=1257381946