Page MenuHomePhabricator

Lua: Make it possible to load only specific Statements using mw.wikibase
Closed, ResolvedPublic

Description

If one wants to access the raw statements from a certain Entity in Lua right now, they need to load the whole entity (mw.wikibase.getEntity). This poses two main problems: a) The whole entity needs to be serialized for Lua and b) we can't (without rather nasty hacks) tell which Statement(s) have been used.

Getting this new function in place will fix the aforementioned problems and also allow us to use more efficient storage mechanisms for loading individual Statements later on (so that the backend also doesn't need to load the full entity).

I propose:
mw.wikibase.getBestStatements( 'entity id', 'property id of statements to load' ). It returns a table like a call to mw.wikibase.getEntity( 'entity id' ):getBestStatements( 'property id of statements to load' ) would.

This new functionality should track statement usages (C.P123), but for now also other usages (O).

Details

Related Gerrit Patches:
mediawiki/extensions/Wikibase : masterAdding a new mw.wikibase.getBestStatements

Event Timeline

hoo created this task.Aug 9 2017, 3:48 PM

Related: https://gerrit.wikimedia.org/r/336542

This adds statement specific usage tracking to entity tables.

Change 370956 had a related patch set uploaded (by Eranroz; owner: Eranroz):
[mediawiki/extensions/Wikibase@master] Adding a new mw.wikibase.getStatements

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

hoo updated the task description. (Show Details)Aug 12 2017, 3:52 AM

Change 370956 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Adding a new mw.wikibase.getBestStatements

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

hoo closed this task as Resolved.Aug 12 2017, 2:37 PM

This will be part of the next Wikibase deployment, thanks for doing this @eranroz.