Page MenuHomePhabricator

The property parser function and mw.wikibase.entity.formatPropertyValues should resolve item redirects when formatting Snak values
Closed, ResolvedPublic

Description

When a redirected item is being used in a Statement, both the {{#property:…}} parser function and mw.wikibase.entity.formatPropertyValues don't resolve the redirect but just show the entity id.
It seems more desirable to resolve redirects there and use the label of the redirect target if possible… also that's consistent with how the repo UI works.

Event Timeline

hoo raised the priority of this task from to Needs Triage.
hoo updated the task description. (Show Details)
hoo added subscribers: hoo, Lydia_Pintscher, aude.
hoo added a subscriber: TomT0m.
Lydia_Pintscher moved this task from incoming to ready to go on the Wikidata board.

This seems partially redundant with T157868, however I am not sure about mw.wikibase.entity.formatPropertyValues. I agree that Wikibase parser functions like {{#property:…}} should probably properly redirect, however, from Scribunto I would rather see mw.wikibase.getEntity and add a mw.wikibase.resolveEntityId implemented or perhaps also have mw.wikibase.getAllStatements and mw.wikibase.getBestStatements redirect.

If mw.wikibase.getEntity, mw.wikibase.getAllStatements and mw.wikibase.getBestStatements redirect one can at least determine which entity ID is the redirection target via returned "id" field.

This might get resolved by T112658, at least for the parser function.

This did not get fixed by what was done for T157868 so far. On my local wiki, Q6 is a redirect:

= mw.wikibase.getLabel('Q6')
hello

mw.logObject(mw.wikibase.getEntity('Q2'):formatPropertyValues('P38'))
table#1 {
  ["label"] = "wikibase-item property",
  ["value"] = "Q6",
}

The parser function does not resolve redirects either.

Change 684431 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] Show redirect target label on formatted entity values

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

Change 684431 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Show redirect target label on formatted entity values

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