Hello all,
In the past few months, the development team has mentored a student, Olga, to help us developing a user script https://www.wikidata.org/wiki/User:Jonas_Kress_%28WMDE%29/check_constraints.js that displays the constraints on the item pages.
To use the script, add the following line to your user/common.js:
mw.loader.load( '//www.wikidata.org/w/index.php?title=User:Jonas_Kress_(WMDE)/check_constraints.js&action=raw&ctype=text/javascript' );
You will see an icon [image: Icon used on the user script for constraint reports on Wikidata] https://commons.wikimedia.org/wiki/File:Constraint_icon.png next to violations. When you click it you will see the full report.
[image: Screenshot of the user script checking constraints on Wikidata] https://commons.wikimedia.org/wiki/File:Screenshot_constraint_check_Wikidata_user_script.png
This script is based on a new API module for constraint checks https://www.wikidata.org/wiki/Special:ApiSandbox#action.3Dwbcheckconstraints.26format.3Djson.26id.3DQ2 that one can use to check constraints on items and statements. At the moment, the constraint checks are only derived from the property discussion page constraint templates, not directly from statements. They are then stored in a database table. We are running a script to update this table every now and then or when you ask for it. Also note that some constraint checks are disabled (for example the format check). In the future we will support adding and updating constraints on property statements and we will implement support for some constraints that are currently still missing.
If you try it, feel free to give us feedback! You can also add comments or subtasks on Phabricator (see the ticket for the API module https://phabricator.wikimedia.org/T102757 and the user script https://phabricator.wikimedia.org/T97018).
If there is no major disagreement, we would like to turn this script into a gadget in the next days.
Thanks go to Olga and all the developers that helped her providing this new feature :)
See also:
- API Documentation https://www.mediawiki.org/wiki/Wikibase/API#wbcheckconstraints - Self-documentation for the module https://www.wikidata.org/w/api.php?action=help&modules=wbcheckconstraints
Cheers,