Page MenuHomePhabricator

[ES-M2]: Create new EntitySchema "expert"
Open, Needs TriagePublic

Description

Problem:
For our users to be able to make statements that use EntitySchema values we need an "expert" that accepts EntitySchema IDs.

Example:
The expert should:

  • Accept EntitySchema IDs (E10)
  • Display the label and description of that EntitySchema

Acceptance criteria:

  • An expert is implemented for statements using an EntitySchema Property that accepts EntitySchema IDs and displays the label and description of that EntitySchema

Notes
Ideally, searching for EntitySchemas by label and alias would also be supported, but will be investigated and developed in a separate task.

Event Timeline

Change #1021378 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/EntitySchema@master] Add 'expert' for Entity-Schema typed properties

https://gerrit.wikimedia.org/r/1021378

Tested this with the latest patches from @Lucas_Werkmeister_WMDE . It mostly works - the expert is there and does the correct search and finds results by ID - but when you click a value from the dropdown, the call to wbparsevalue fails:

curl 'http://wikidatawikidev.mediawiki.mwdd.localhost:8080/w/api.php?action=wbparsevalue&format=json&parser=wikibase-entityid&values=%1FE31&errorformat=plaintext&uselang=en&options=%7B%22lang%22%3A%22en%22%7D'

(vs. the comparable call from the Lexeme expert, which succeeds:

curl 'http://wikidatawikidev.mediawiki.mwdd.localhost:8080/w/api.php?action=wbparsevalue&format=json&parser=wikibase-entityid&values=%1FL1&errorformat=plaintext&uselang=en&options=%7B%22lang%22%3A%22en%22%7D'

I had a chat with @Jakob_WMDE about this, and we agreed a plan:

  • Override the ValueParser for the EntitySchema expert so that it supplies different parameters to the wbparsevalue API call:
    • drop the parser parameter (which is deprecated)
    • supply the datatype or property parameter
  • Refactor the entity schema value parser (introduced in 994206) to expect strings instead of arrays and adjust all places that call it accordingly

I'll take a look at these and update my patch.

Change #1028768 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[wikibase/javascript-api@master] Use 'datatype' parameter for 'wbparsevalue' calls if configured

https://gerrit.wikimedia.org/r/1028768

Change #1028780 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Bump Wikibase API version for EntitySchema parsevalue support

https://gerrit.wikimedia.org/r/1028780

Change #1028768 abandoned by Arthur taylor:

[wikibase/javascript-api@master] Use 'datatype' parameter for 'wbparsevalue' calls if configured

Reason:

No longer required - moved this handling to the caller in 1028780

https://gerrit.wikimedia.org/r/1028768