Lucas_Werkmeister_WMDE added a comment.

  I ended up looking into this task as part of T255110 
<https://phabricator.wikimedia.org/T255110> and wondered why this ambiguity 
should only affect the pageterms API and not the Lua code. But the situation 
there is slightly different; rather than pageterms’ “give me the terms for this 
page/title”, Lua has different functions:
  
  - “give me the terms for this //Entity ID//” (`getLabel`, 
`getDescriptionWithLang` etc.)
  - “give me the //Entity ID// for this page/title” (`getEntityIdForTitle`)
  - “give me the terms for //the current page//” (`getLabel`, 
`getDescriptionWithLang` etc. without Entity ID argument)
  
  Only the last one is potentially ambiguous, and if you’re running Lua that 
looks at the current page, then the current page can’t be an Entity page, since 
Items, Properties etc. don’t contain wikitext, so it’s never ambiguous (it can 
only mean “terms of the linked Entity”, because the current page can’t be an 
Entity).
  
  …Unless you use the action=parse API, specify the title of an Entity, but set 
the contentmodel=wikitext and the text to some wikitext that calls a Lua 
module. Then you can ask for the terms of the current Item page, and the API 
will return the terms of the Item linked to that Item (rather than, like 
pageterms with the hack mentioned in T115117#1719166 
<https://phabricator.wikimedia.org/T115117#1719166>, the terms of the Item you 
specified in the title).
  
  And also, the “Entity pages don’t contain wikitext” assumption is in fact 
violated by WikibaseMediaInfo. For the pageterms API, this was reported at 
T215292 <https://phabricator.wikimedia.org/T215292>; I don’t know if anyone has 
so far tried to use the Lua term functions on File/MediaInfo pages and 
found+reported unexpected results. (Testing locally, it seems that 
`mw.wikibase.getLabel()` never returns a label on a File/MediaInfo page, 
regardless of whether it’s linked to an item or not.)

TASK DETAIL
  https://phabricator.wikimedia.org/T115117

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: daniel, Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, aude, Lydia_Pintscher, StudiesWorld, Tobi_WMDE_SW, 
JanZerebecki, Aklapper, daniel, darthmon_wmde, Nandana, lucamauri, Lahi, Gq86, 
GoranSMilovanovic, QZanden, LawExplorer, TomT0m, _jensen, rosalieper, 
Scott_WUaS, Wong128hk, Luke081515, Wikidata-bugs, fbstj, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to