A term of the Norwegian Storting always starts on October 1st. When that's a Sunday, the opening is the next day instead (October 2nd), but any memberships of that term do still start on the 1st.
So we want to udpate any P39/P580s which are listed with that October 2nd date to the October 1st date instead.
(See conversation at https://www.wikidata.org/w/index.php?title=Wikidata%3ARequest_a_query&type=revision&diff=1241548292&oldid=1241336300)
In recent years this affects the 2017-2021 and 1989-1993 terms.
We can find these via:
oct2.rq
:
module.exports = year => `
SELECT ?ps ?item ?start
WHERE {
?item p:P39 ?ps .
?ps ps:P39 wd:Q9045502 ; pq:P580 ?start .
FILTER (?start = "${year}-10-02T00:00:00Z"^^xsd:dateTime)
}
`
and then running:
wd sparql oct2.js 2017 | jq -r '.[] | "\(.ps) P580 2017-10-02 2017-10-01"' | wd uq --batch
(And tweaked accordingly for another year)
These went through as: