Wikidata:Requests for permissions/Bot/William Avery Bot 2
The following discussion is closed. Please do not modify it. Subsequent comments should be made in a new section. A summary of the conclusions reached follows.
- Approved --Lymantria (talk) 06:09, 29 October 2021 (UTC)[reply]
William Avery Bot 2[edit]
William Avery Bot (talk • contribs • new items • new lexemes • SUL • Block log • User rights log • User rights • xtools)
Operator: William Avery (talk • contribs • logs)
Task/s: A change in usage of recombination (Q14594740) as a qualifier on taxon name (P225). The bot replaces instance of (P31) with object has role (P3831).
For background discussion see:
- Wikidata talk:WikiProject Taxonomy#Guidelines for adding references for taxonomic names
- Wikidata talk:WikiProject Taxonomy#Recombinations
Code: taxonRecombinationFixer.py
SPARQL query to feed it items:
SELECT ?item
WHERE
{
?item p:P225 ?name.
?name pq:P31 wd:Q14594740.
}
Function details:
For each item:
- Perform sanity checks to ensure that:
- The item has a property taxon name (P225) with a single value
- The taxon name (P225) has a qualifier instance of (P31) with a single value, and that value is recombination (Q14594740)
- When either of the above conditions is not met a warning is output and the item is not processed further.
- Remove the existing instance of (P31) qualifier from the taxon name (P225).
- Create a new object has role (P3831) qualifier with value recombination (Q14594740) and add it to the taxon name (P225).
- Save the changes with an editEntity API call.
There is a diff from a trial here. It uses different values in the qualifiers, as the actual ones don't exist on test. --William Avery (talk) 15:07, 27 October 2021 (UTC)[reply]
- Guess this will work. --Succu (talk) 20:09, 28 October 2021 (UTC)[reply]