Page MenuHomePhabricator

#property: parser function tracks titles but doesn't show them
Closed, ResolvedPublic

Description

If you save a page with some {{#property:P123}} call that does show some results and then look into "Wikidata entities used in this page" via action=info, you will see both the labels and the titles are used on that page. However, the result doesn't show any links, so the titles are not actually used.

Perhaps the code that both #property and #statements use does this for both of them but should only for #statements.

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
thiemowmde triaged this task as Medium priority.
thiemowmde moved this task from incoming to ready to go on the Wikidata board.
thiemowmde added subscribers: Lydia_Pintscher, hoo, aude and 2 others.

I tried to reproduce this locally:

  • The first item listed is the wikidata item that is directly connected to the page, via a sitelink.
    • A "Sitelink" usage is listed. This is obvious.
    • An "Other" usage as well as a usage of P123 is listed. This is expected. The "Other" usage is for backwards compatibility and will go away some day.
  • The second item listed is the one used in the P123 relation.
    • The items label is used, because it is really shown. Multiple languages might be listed because of the "language fallback chain" mechanism. This is intended.
    • A "Title" usage is listed. This is not correct for the #property parser function, because it does not show a link.

The reason for this can be seen in UsageTrackingSnakFormatter::formatSnak. A "Title" usage is always tracked, no matter what the format is.

Change 395582 had a related patch set uploaded (by Thiemo Mättig (WMDE); owner: Thiemo Mättig (WMDE)):
[mediawiki/extensions/Wikibase@master] Don't track title usage when {{#property:…}} doesn't link to that title

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

I just realized that this fix will decrease the amount of usages that are tracked. This is superb! I just can't tell what the impact might be. Could be nothing, could be 1%. This will have an effect on all wiki pages that use the old #property parser function with a property of type "wikibase-item" or "wikibase-property". I assume there are still a lot templates out there that either unintentionally continue to use #property, or intentionally use it because they want a label without a link. So the impact could be much more than 1%.

Thanks a lot for reporting this!

Change 396322 had a related patch set uploaded (by Thiemo Mättig (WMDE); owner: Thiemo Mättig (WMDE)):
[mediawiki/extensions/Wikibase@master] Split StatementGroupRendererFactoryTest::testNewRenderer_usageTracking

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

Change 395582 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Don't track title usage when {{#property:…}} doesn't link to that title

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

Change 396322 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Split StatementGroupRendererFactoryTest::testNewRenderer_usageTracking

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