Hi all!
This is an announcement for a breaking change to the output format of the
WikibaseQualityConstraints constraint checking API, to go live on 10
October 2017. It affects all clients that use the *wbcheckconstraints* API
action. (We are not aware of any such clients apart from the
*checkConstraints* gadget, which has been adapted.)
We are soon going to check constraints not just on the main snak of a
statement, but also on qualifiers and references (T168532
<https://phabricator.wikimedia.org/T168532>). However, the current API
output format of the *wbcheckconstraints* API action cannot accommodate any
other constraint check results. To resolve this issue, we are introducing a
new, more flexible output format for the API, which can contain constraint
check results on all kinds of snaks and also leaves room for future
expansion (e. g. for T168626 <https://phabricator.wikimedia.org/T168626>).
The new format is based on the Wikibase JSON format, and documented (along
with the old format) on mw:Wikibase/API#wbcheckconstraints
<https://www.mediawiki.org/wiki/Wikibase/API#wbcheckconstraints>.
If you use the *wbcheckconstraints* API action in your tools, the safest
option is to make them support both output formats for the transitional
period. It’s easy to determine which format the API returned, because the
new format contains the fixed key "claims" on the second level, which will
never happen in the old format. You can see an example of this for the
*checkConstraints* gadget in change I99379a96cd
<https://gerrit.wikimedia.org/r/#/c/373323/>, specifically the new
extractResultsForStatement function.
The new API output format is already enabled on the Wikidata constraints
test system <https://wikidata-constraints.wmflabs.org/>. You can test your
tools or other code there.
Please let us know if you have any comments or objections.
-- Lucas
Relevant tickets:
- T168532 <https://phabricator.wikimedia.org/T168532>
- T174544 <https://phabricator.wikimedia.org/T174544>
Relevant patches:
- https://gerrit.wikimedia.org/r/#/c/369420
- https://gerrit.wikimedia.org/r/#/c/373323/
--
Lucas Werkmeister
Software Developer (Intern)
Wikimedia Deutschland e. V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30 219 158 26-0
https://wikimedia.de
Imagine a world, in which every single human being can freely share in the
sum of all knowledge. That‘s our commitment.
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg unter
der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt für
Körperschaften I Berlin, Steuernummer 27/029/42207.
Hi all!
This is an announcement for a significant change to the Wikibase entity
format, which went live the beginning of September. It potentially affects
clients that process snaks
<https://www.wikidata.org/wiki/Special:MyLanguage/Wikidata:Glossary#Snak>.
Internally, Wikibase assigns a *hash* to each snak (which is just the hash
function (Q183427) <https://www.wikidata.org/wiki/Q183427> of an internal
representation of the snak). Those hashes were previously emitted for snaks
that appeared in qualifiers, but not for the main snak or reference snaks
of a statement. With the change, the hashes are emitted for all snaks,
regardless of where they appear. This means that a snak can now look like
this:
{
"snaktype": "value",
"property": "P370",
"hash": "682fdb448ef68669a1b728a5076836da9ac3ffae",
"datavalue": {
"value": "some text",
"type": "string"
},
"datatype": "string"}
The hashes are also added to the HTML output, as an additional class
similar to the statement ID class on statements:
<div class="wikibase-statementview
wikibase-statement-Q4115189$29acf9c6-450a-7612-d206-049f5fe58328">
<!-- … -->
<div class="wikibase-statementview-mainsnak">
<div class="wikibase-snakview
wikibase-snakview-682fdb448ef68669a1b728a5076836da9ac3ffae">
<!-- … -->
</div>
</div></div>
The ultimate goal of this is to make any snak addressable in the DOM, which
is necessary for checking constraints on qualifiers and references (T168532
<https://phabricator.wikimedia.org/T168532>).
It should be noted that unlike statement IDs, snak hashes are not
identifiers. They are not stable, and may change at any time with the
internal format.
Please let us know if you have any comments or objections.
-- Lucas
Relevant tickets:
- T171607 <https://phabricator.wikimedia.org/T171607>
- T171725 <https://phabricator.wikimedia.org/T171725>
Relevant patches:
- https://github.com/wmde/WikibaseDataModelSerialization/pull/233
- https://gerrit.wikimedia.org/r/#/c/374835/
--
Lucas Werkmeister
Software Developer (Intern)
Wikimedia Deutschland e. V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30 219 158 26-0
https://wikimedia.de
Imagine a world, in which every single human being can freely share in the
sum of all knowledge. That‘s our commitment.
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg unter
der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt für
Körperschaften I Berlin, Steuernummer 27/029/42207.