Page MenuHomePhabricator

Use wikidata entity selector in OOUI input field
Open, HighPublic

Description

In the current draft of the Special Page


(source http://beta.math.wmflabs.org/w/index.php/Special:MathWikidata)

the Wikidata input field has no auto-completion feature.
Based on my experience from
https://github.com/ag-gipp/node-codemirror-wikidata
I have the feeling that it should be rather easy to enable autocompletion for Wikidata entries.

Update: This has been implemented and deployed. However, the current approach

https://en.wikipedia.org/wiki/Special:MathWikibase

does not work and shows the following error:

Skipped unresolvable module ext.math.wikibase.scripts
Unknown module: jquery.wikibase.entityselector

Details

Related Gerrit Patches:

Event Timeline

Physikerwelt renamed this task from Use wikidata autocompletion information field in wikidata OOUI input field to Use wikidata entity selector in OOUI input field.Aug 6 2019, 4:35 PM

@Physikerwelt an autocompletion on wiki data IDs? I would understand if we allow textual inputs here and then activate auto-completion based on the words. Such as "mass-energy" and the first suggestion would be "equivalence". But I cannot imagine an auto-completion just based on the IDs. The only use case I can imagine is that the auto-completion only shows IDs that actually contain mathematical expressions. But I have no clue how to implement that now.

@Andreg-p I mean this selector

I think @hoo might now if this can be used in your form.

hoo added a comment.Aug 8 2019, 11:53 PM

Please have a look at jQuery.wikibase.entityselector (can be loaded via the jquery.wikibase.entityselector RL module). I didn't test it, but that should just work.

Thank you for the hint. Patch set 5 should include all necessary changes to close this task: https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Math/+/527556/

Change 527556 had a related patch set uploaded (by AndreG-P; owner: AndreG-P):
[mediawiki/extensions/Math@master] Added support for popups for annotated math

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

Andreg-p closed this task as Resolved.Oct 18 2019, 8:22 AM

Change 527556 merged by jenkins-bot:
[mediawiki/extensions/Math@master] Add special page and API endpoint that show information from math Wikibase items

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

Change 551215 had a related patch set uploaded (by AndreG-P; owner: AndreG-P):
[mediawiki/extensions/Math@master] Delete Wikibase repository dependency in Math extension

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

Physikerwelt reopened this task as Open.Nov 27 2019, 5:42 PM

from the JS console in https://www.mediawiki.org/wiki/Special:MathWikibase

Error: "Unknown module: jquery.wikibase.entityselector"
Physikerwelt triaged this task as High priority.Nov 27 2019, 5:43 PM

I checked, and the module "jquery.wikibase.entityselector" still exists. But it might be that it is not loaded by default any more. You need to request it, either via "dependencies" in the definition of your ResourceLoader module, or via $parserOutput->addModules( … ) in your PHP code, or via mw.loader.using( … ) in your JavaScript code. Without knowing much about your code, I assume the last option would be the best.

@thiemowmde Thank you. The problem is, I thought I did that already. I load the modules in the special page:
https://github.com/wikimedia/mediawiki-extensions-Math/blob/master/src/SpecialMathWikibase.php#L64

		$output->addModules( [ 'ext.math.wikibase.scripts' ] );

And the module is defined in Math's extension extension.json:
https://github.com/wikimedia/mediawiki-extensions-Math/blob/668892f33b118e1d3970e2ff73ea64dbfaf8eb3d/extension.json#L148-L153

		"ext.math.wikibase.scripts": {
			"scripts": "ext.math.wikibase.js",
			"dependencies": [
				"jquery.wikibase.entityselector"
			]
		},

That looks right.

It might be that the module is not available on a client any more, only in a Repository context. However, when I look at the code it looks like it should always be available. Maybe @Ladsgroup or somebody else currently working on Wikibase can have a look?

Well, that module is part of the WikibaseView extension, which we don’t load on client wikis – I don’t think this has changed recently, at least it’s also the case on English Wikipedia, which is currently running Wikibase code from 4/5 November (1.35.0-wmf.5).

Edit: ah, the thing that changed recently would be this:

Change 551215 had a related patch set uploaded (by AndreG-P; owner: AndreG-P):
[mediawiki/extensions/Math@master] Delete Wikibase repository dependency in Math extension
https://gerrit.wikimedia.org/r/551215

Well, that module is part of the WikibaseView extension, which we don’t load on client wikis – I don’t think this has changed recently, at least it’s also the case on English Wikipedia, which is currently running Wikibase code from 4/5 November (1.35.0-wmf.5).

I guess the code is still deployed. Is there a way to manually load the module for the specialpage?

Edit: ah, the thing that changed recently would be this:

This explains why we don't see it in our local dev setup.

Physikerwelt removed Andreg-p as the assignee of this task.Dec 13 2019, 11:05 AM

I don't see that there is anything that can be done from within the math extension.

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptDec 13 2019, 11:08 AM

I am seeing similar problems on test.wikidata.org

Also T228641 might be related.

I am seeing similar problems on test.wikidata.org


Also T228641 might be related.

Test wikidatawiki is a repo so it should not be related to this.

Physikerwelt updated the task description. (Show Details)Dec 28 2019, 8:05 PM

I am not sure how to move forward here. @Esanders, do you have a hypothesis? What might be the problem here? I think the approach to use $output->addModules and specify the dependencies there is not fundamentally incorrect as outlined here
https://phabricator.wikimedia.org/T229939#5699422 but maybe the loader does not load all dependencies recursively? Or are other sources for the problem more likely?