Page MenuHomePhabricator

[ES-M2]: Create new EntitySchema "expert"
Closed, ResolvedPublic

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

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

[mediawiki/extensions/EntitySchema@master] Add end-to-end test for EntitySchema statements

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

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

[mediawiki/extensions/Wikibase@master] Create PropertyInfoDataTypeLookup repo service for testing

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

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

[mediawiki/extensions/WikibaseQualityConstraints@master] Mock PropertyInfoDataTypeLookup for some tests

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

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

[data-values/value-view@master] Add additional API Options to allow configuration of value parsers

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

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

[mediawiki/extensions/Wikibase@master] Process `useApiDataType` option from expert to override datatype

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

Change #1032755 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/1032755

Change #1034865 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Clean up PropertyDataTypeLookup service wiring

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

Change #1028780 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Use typeId as parserId in ValueParserStore

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

Change #1032754 abandoned by Arthur taylor:

[mediawiki/extensions/Wikibase@master] Process `useApiDataType` option from expert to override datatype

Reason:

Prefer solution from I8ef13eccfc355276d88a048ca60a081e03ab111d

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

Change #1032755 abandoned by Arthur taylor:

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

Reason:

Prefer approach in I49a041bb1fd04857c0377b2a99a4aa2b73a53b4d

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

Change #1032751 abandoned by Arthur taylor:

[data-values/value-view@master] Add additional API Options to allow configuration of value parsers

Reason:

No longer needed as a result of I8ef13eccfc355276d88a048ca60a081e03ab111d

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

Change #1031400 abandoned by Arthur taylor:

[mediawiki/extensions/Wikibase@master] Create PropertyInfoDataTypeLookup repo service for testing

Reason:

Abandoned in favour of I031c34827e

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

Also created a PR for DataValues to make it clearer that we are only using the dataTypeId codepath: https://github.com/wmde/DataValuesJavaScript/pull/155

Change #1034865 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Clean up PropertyDataTypeLookup service wiring

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

Change #1031401 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Mock PropertyDataTypeLookup for some tests

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

Change #1021378 merged by jenkins-bot:

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

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

Arian_Bozorg claimed this task.

Thank you so much!

Change #1030919 merged by jenkins-bot:

[mediawiki/extensions/EntitySchema@master] Add end-to-end test for EntitySchema statements

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