Directory

⚓ T237107 Extend mw.wikibase lua functions to allow accessing Structured Data on Commons items
Page MenuHomePhabricator

Extend mw.wikibase lua functions to allow accessing Structured Data on Commons items
Closed, ResolvedPublic

Description

Extend mw.wikibase lua functions to allow accessing Structured Data on Commons (SDC) items (M-codes) in addition to Wikidata items (Q-codes). T223792 managed to extend mw.wikibase.getEntity function to work with SDC, but that is not true for other functions. For example mw.wikibase.getBestStatements does not work for SDC items (it might be related to the fact that SDC statements are stored in entity.statements structure while on Wikidata entity.claims is used). Other functions which do not seem to work on SDC:

In general all mw.wikibase lua functions should be tested with SDC, even if some functions like mw.wikibase.getSitelink might make no sense on SDC. mw:Extension:Wikibase_Client/Lua should be updated with SDC info.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

There is some overlap between this task and T236691, which I just noticed. Specifically that mw.wikibase.getEntityIdForCurrentPage is not working, and possibly issues with mw.wikibase.getEntity() without input parameters. However issues with getBestStatements is likey not related.

Change 553128 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] MediaInfo specific Lua modules

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

Change 553128 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] MediaInfo specific Lua modules

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

As far as I can tell, all (relevant) methods where a MediaInfo implementation was missing now work.

And since it's now possible to resolve page titles to MediaInfo ids (with functional mw.wikibase.getEntity(), mw.wikibase.getEntityUrl(), mw.wikibase.getEntityIdForCurrentPage() and their mw.wikibase.mediainfo.* counterparts), we now also no longer need to use hacks like "M" .. mw.title.getCurrentTitle().id in Lua.

I believe all work in this ticket is now complete.

Great I will start replacing hacks like "M" .. mw.title.getCurrentTitle().id with "clean" code