User:Lucas Werkmeister/Ranker

Ranker is a tool to edit the rank of multiple Wikidata statements at once. (Test Wikidata, Wikimedia Commons and Test Wikimedia Commons are also supported.)

Usage edit

To start using the tool, go to its index page, enter the wiki you want to edit, the ID of the entity you want to edit (usually an item ID like Q42, but can also be some other kind of entity), and the ID of the property selecting the statement group you want to edit, then click the Select statements button. (Alternatively, you can use the user script to directly go to the tool from a page on Wikidata, see below.) The tool will then load and show you all the statements using that property on the given entity. If the statements have qualifiers, or a rank other than normal rank, those will be shown as well. You can select the statements that you want to edit using the checkboxes on the left, optionally select a reason (reason for preferred rank (P7452) or reason for deprecated rank (P2241)) or add an edit summary to explain your change, then click one of the buttons at the bottom: Set to preferred rank, Set to normal rank, or Set to deprecated rank to set all selected statements to the given rank, or Increment rank to change deprecated-rank statements to normal and normal-rank ones to preferred.

The “reason” input, if it is used, should contain a single item ID; some suggestions of common reasons are available (on most desktop browsers, by pressing the Down arrow key), but any item can be used. The given item will be used as the value of the reason for preferred rank (P7452) qualifier when you select Set to preferred rank, or as the reason for deprecated rank (P2241) value when you select Set to deprecated rank; for Set to normal rank and Increment rank, the “reason” input cannot be used. (It is also not available on test wikis.)

If the tool is used with a MediaInfo entity (i.e. on Wikimedia Commons), then the two available buttons are instead labeled Mark as prominent and Mark as not prominent, to reflect the different usage of ranks in Structured Data on Commons. (Increment rank is not available in this mode, since it would be no different from Mark as prominent.)

Batch mode edit

The tool also features several batch modes. All of them let you edit the rank of many statements across different edits; they differ by whether statements are provided as a list or via a SPARQL query, and whether they perform the same action (set or increment rank) for all statements or specify a target rank for each individual statement.

Batch edits are made as soon as you submit the web form with the statements to edit, and the page will keep “loading” until the edits are done. This can take a while if you listed a lot of statements – it’s probably best not to close the tab, even if it appears “stuck”. (Closing the tab won’t affect how the batch runs, but then you won’t see the results at the end.) Once a batch has been submitted, it can’t be aborted.

List statements, same action for all edit

This batch mode (Wikidata link) specifies the statements as a plain-text list, and performs the same action for all of them, selected with one of the buttons at the bottom: set to preferred/normal/deprecated rank, or increment rank. (These are the same buttons as in non-batch mode, see above for details.) Statements are identified by their statement ID, which looks like an entity ID, a dollar sign, and then a GUID; the list contains one statement ID per line. (Note that, depending on when the statement was created, both the entity ID and the GUID part may be in upper- or lowercase; specify each statement’s ID exactly as it appears in the entity, even if the case looks inconsistent between different statements.)

List statements, individual rank per statement edit

This batch mode (Wikidata link) specifies statements, ranks, and optionally reasons as a plain-text list. In each line, statement and rank are separated either by a pipe character (|) or by a tab; the pipe is more convenient for manual input, while the tab allows you to prepare the statement IDs and ranks in a spreadsheet or table, and then copy them into rank mode. (This is similar to QuickStatements.) The rank should be one of the words deprecated, normal, or preferred, and can optionally be followed by an item ID (separated by another pipe character or tab), which is used as the reason for preferred rank (P7452) or reason for deprecated rank (P2241) qualifier depending on the rank.

Query statements, same action for all edit

This batch mode (Wikidata link) selects the statements via a SPARQL query, and performs the same action for all of them, as in the list version. The SPARQL query should select a variable named ?statement (other variables can also be included, and will simply be ignored), which should select statement nodes, such as wds:Q474472-dcf39f47-4275-6529-96f5-94808c2a81ac.

This mode is only available for wikis that have a usable query service, i.e. Wikidata; the Commons query service requires authentication, and the test wikis have no query service at all.

Query statements, individual rank per statement edit

This batch mode (Wikidata link) selects the statements, ranks, and optionally reasons via a SPARQL query. The query should select variables named ?statement and ?rank (most other variables are ignored); ?statement should be a statement node as in the other query mode, while ?rank should be one of the constants wikibase:DeprecatedRank, wikibase:NormalRank, or wikibase:PreferredRank. The query may also select variables ?reason, ?reasonForPreferredRank and/or ?reasonForDeprecatedRank; ?reasonForPreferredRank and ?reasonForDeprecatedRank specify the reason for preferred rank (P7452) or reason for deprecated rank (P2241), respectively, and are only used if the ?rank matches, while ?reason specifies either qualifier, depending on the ?rank, if the rank-specific variable is not specified. In any case, the reason should be specified as an entity node, such as wd:Q71533355.

This mode is also only available for wikis with a query service.

User script edit

The user script User:Nikki/Ranker.js adds links to go to Ranker directly from an entity page on Wikidata. To use it, add the following line to your common.js:

mw.loader.load( '//www.wikidata.org/w/index.php?title=User:Nikki/Ranker.js&action=raw&ctype=text/javascript' );

Then, you can look for the links which the script adds to each statement group (at the end of the property name), and click them to start editing that statement group using Ranker.

Monitoring edit

You can see edits made using this tool on the recent changes list.