Module talk:WikidataIB/Archive 6: Difference between revisions

Content deleted Content added
m Archiving 1 discussion(s) from Module talk:WikidataIB) (bot
Replace per TfD outcome
 
(5 intermediate revisions by 2 users not shown)
Line 205:
: Hope that helps. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 18:28, 9 May 2020 (UTC)
::Thank you, RexxS. Works like a charm! [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 02:09, 10 May 2020 (UTC)
 
== Getting the ''n''th value and the last value ==
 
Hi RexxS. Suppose we have a list of values:
 
:{{demo|br=|<nowiki>{{#invoke:WikidataIB |getValue |ps=1 |P8011 |qid=Q84055514}}</nowiki>}}
 
To get the ''n''th value, you have previously [[Module talk:WikidataIB/Archive 6#Retrieving nth value using %23invoke%3AWikidataIB|recommended]] the following solution:
 
:{{demo|br=|<nowiki>{{#invoke:String2 |split |txt={{#invoke:WikidataIB |getValue |ps=1 |P8011 |qid=Q84055514}} |sep=", " |idx=3}}</nowiki>}}
 
Later you have introduced <kbd><nowiki>{{stringsplit}}</nowiki></kbd> and <kbd><nowiki>{{wdib}}</nowiki></kbd> templates to simplify the task:
 
:{{demo|br=|<nowiki>{{stringsplit |txt={{wdib|ps=1|P8011|qid=Q84055514}} |sep=", " |idx=3}}</nowiki>}}
 
Which, of course, is better written as:
 
:{{demo|br=|<nowiki>{{stringsplit|{{wdib|ps=1|P8011|qid=Q84055514}}|", "|3}}</nowiki>}}
 
I have come up with an even better, more natural way of writing it using the <kbd><nowiki>list</nowiki></kbd> parameter and <kbd>[[Template:P1|<nowiki>{{p</nowiki>''n''<nowiki>}}</nowiki>]]</kbd> templates:
 
:<nowiki>{{wdib|ps=1|P8011|qid=Q84055514|list=p3}}</nowiki>
 
Unfortunately, there is no good analogue to get the last value. There's <kbd>[[Template:Lastbut0|<nowiki>{{lastbut0}}</nowiki>]]</kbd>, but it is [https://en.wikipedia.org/wiki/Special:WhatLinksHere/Template:Lastbut0 not used anywhere] and has a very inefficient implementation that stops working if the list has more than a hundred items:
 
{{pre|<nowiki>{{{100|{{{99|{{{98|{{{97|{{{96|{{{95|{{{94|{{{93|{{{92|{{{91|{{{90|{{{89|{{{88|{{{87|{{{86|{{{85|{{{84|{{{83|{{{82|{{{81|{{{80|{{{79|{{{78|{{{77|{{{76|{{{75|{{{74|{{{73|{{{72|{{{71|{{{70|{{{69|{{{68|{{{67|{{{66|{{{65|{{{64|{{{63|{{{62|{{{61|{{{60|{{{59|{{{58|{{{57|{{{56|{{{55|{{{54|{{{53|{{{52|{{{51|{{{50|{{{49|{{{48|{{{47|{{{46|{{{45|{{{44|{{{43|{{{42|{{{41|{{{40|{{{39|{{{38|{{{37|{{{36|{{{35|{{{34|{{{33|{{{32|{{{31|{{{30|{{{29|{{{28|{{{27|{{{26|{{{25|{{{24|{{{23|{{{22|{{{21|{{{20|{{{19|{{{18|{{{17|{{{16|{{{15|{{{14|{{{13|{{{12|{{{11|{{{10|{{{9|{{{8|{{{7|{{{6|{{{5|{{{4|{{{3|{{{2|{{{1|no input}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}</nowiki>}}
 
May I ask you to please create <kbd>[[Template:P-1|<nowiki>{{p-1}}</nowiki>]]</kbd> that would return its last unnamed parameter? Then we would be able to write:
 
:<pre>{{wdib|ps=1|P8011|qid=Q84055514|list=p-1}}</pre>
 
And stop worrying about <kbd><nowiki>{{stringsplit}}</nowiki></kbd>'s separators potentially clashing with data. Thank you. —&nbsp;[[User:UnladenSwallow|UnladenSwallow]] ([[User talk:UnladenSwallow|talk]]) 02:39, 15 May 2020 (UTC)
 
: {{re|UnladenSwallow}} That's a neat idea. I had forgotten that the list parameter actually pipes the output through an arbitrary template.
: We already have support for negative indices in {{tl|stringsplit}}:
:* <code><nowiki>{{stringsplit|{{wdib|ps=1|P8011|qid=Q84055514}}|", "|-1}}</nowiki></code> → {{stringsplit|{{wdib|ps=1|P8011|qid=Q84055514}}|", "|-1}}
: But I like the idea of a utility that returns a given parameter from a list of those provided, so I've created [[Module:Pn]] to return a given positional parameter, and [[Template:P-1]] as you requested. The module can generate as many wrappers as desired simply by supplying an index. For example, setting idx=-2 would make a template {last but one}, etc. Check to see if the behaviour is what you want (I've arbitrarily set idx=0 and any idx beyond the number of parameters to return the last one). Do you think indices outside the range should return nothing instead? Cheers --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 18:21, 15 May 2020 (UTC)
 
::{{re|RexxS}} You're awesome! Thank you! Now I will be able to greatly simplify Indian rows in [[Template:COVID-19 testing by country subdivision]].
::Yes, indices outside the range should definitely return nothing. For example, if we have a custom 3-column table for displaying a 3-value property, but a certain Wikidata item only has two values for that property, we want the third table cell to be empty, not repeat the second value.
::Also, <kbd><nowiki>{{wdib|…|maxvals=</nowiki>''n''<nowiki>|list=p-1}}</nowiki></kbd> can now be used to get the ''n''th value for any ''n''. Is it okay if I add this to <kbd><nowiki>{{wdib}}</nowiki></kbd>'s documentation? —&nbsp;[[User:UnladenSwallow|UnladenSwallow]] ([[User talk:UnladenSwallow|talk]]) 20:22, 15 May 2020 (UTC)
::: {{re|UnladenSwallow}} I've made the changes to return nothing if idx=0 or idx>(number of parameters). The only default behaviour left is when idx has a value that can't be recognised as a number (when it returns the first value). You can edit the documentation freely; it's not protected, and I have no feelings of ownership over it.
::: I've just realised that wdib may return an empty list, so it's better not to throw an error in Module:Pn, but just gracefully return nothing. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 21:22, 15 May 2020 (UTC)
 
== Tracking function ==
 
[[:Template:Track fallback]] is a newly created template which I recently came across. Does it makes sense to integrate this within WikidataIB so that it can be used with more complex calls? I'm not sure if such a function/template already exists though. Just posting here for better visibility. [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 07:49, 6 May 2020 (UTC)
 
: {{re|Rehman}} I've just added a logic table to the template's documentation so folks can see what outputs they can get, and how to get them. It would probably benefit from being re-written in Lua to improve the logic, but I don't think it should be subsumed into WikidataIB, as it presently can make a call to any module and I don't want to disturb that option. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 21:14, 6 May 2020 (UTC)
 
:: Thank you RexxS! [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 23:54, 6 May 2020 (UTC)
 
=== Feature request ===
Hello [[User:RexxS|RexxS]]. I'm currently working on getting {{tl|Infobox mountain}} on track for a Wikidata-enabled future. In order to support this, one of the WikiProject members require all articles which does not have a local value ''and'' uses a value from Wikidata, to be added to a tracking category, for each parameter separately. If you look at [[Template:Infobox mountain/sandbox]] (parameter <code>parent_peak</code>, for example) , you can see that it is possible to do this, but still a bit manual and messy.
 
Would it be possible to add a <code>|track=true</code> function to this module, such that if the above condition is met, the article would simply be added to a generic category:
* [Template name] using Wikidata value for [parameter name based on <code>|name=</code>] ([[:Category:Infobox mountain using Wikidata value for elevation|example]])
 
The categories are of course temporary, and once the necessary checks are done, <code>|track=true</code> could simply be removed from {{tl|Infobox mountain}}. Would it be possible to implement this? [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 15:27, 9 May 2020 (UTC)
:
: Sorry, {{u|Rehman}} but I think that's the wrong logic for doing checks. No infobox should become wikidata-enabled without consensus to do so. Most infoboxes need to be opt-in, that is, editors have to enable the wikidata functionality on an article-by-article basis by adding {{para|fetchwikidata|all}} in each article. That ensures that the display of the infobox is checked by an editor, who takes the blame if the infobox contains erroneous information. If they want to add a tracking category at the same time, that's fine, but I don't want to repeat the unpleasant time I endured at [[Wikipedia:Village pump (policy)/Archive 128 #RfC: Wikidata in infoboxes, opt-in or opt-out?]]. I think my comment at the time is just as relevant now: {{talkquote|1=... the problem may arise if a normal infobox is changed (I'd say upgraded) to a Wikidata-enabled infobox. At that point, the display in each article using the infobox has the potential to draw in additional information from Wikidata without that additional information showing on the watchlists containing those articles (subsequently, any changes to Wikidata will show on watchlists as D and will be spotted). The problem can only happen if the infobox implements a scheme where it fetches Wikidata for fields that are not already filled-in an article - the so-called "opt-out" scheme. Most of the time it is likely to be something obscure like an OCLC number that nobody will worry about, but Sarah gives an example of where she had deliberately omitted the genre field as problematic, but the Wikidata-enabled infobox re-inserted it without warning. It's a genuine concern, but banning 'opt-out' schemes wholescale in response is using a sledgehammer on a walnut. Infobox template editors will need to implement fetching Wikidata values carefully when they upgrade infoboxes. Where the number of transclusions is small, it should be sufficient to monitor the effect on the affected articles, so using an 'opt-out' template should be manageable. Where the number of transclusions is larger, I'd recommend using a more flexible implementation, for example like the demo at [[Template:Infobox book/Wikidata/Sandbox]], which only fetches Wikidata when that is specifically enabled on an article-by-article basis by adding a {{para|fetchwikidata|}}parameter. Since that also allows fetching Wikidata on a field-by-field basis, if required, it should enable editors to make use of it in their articles in the manner they choose. The bonus is that it can also suppress any field(s) with a {{para|suppressfields}}, so Sarah could explicitly ensure that 'genre' was never displayed in Night (book) by adding {{para|suppressfields|genre}}.}} It's a huge debate, but it demonstrates the misconceptions and the issues that face anyone wanting to make Wikidata-aware infoboxes on Wikipedia. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 17:01, 9 May 2020 (UTC)
::
::Thanks for taking the time to explain this, [[User:RexxS|RexxS]]. Yes, it makes sense. We have consensus, but tracking and article-by-article checks is requirement. I will take your comment regarding trackers back to discussions, and see how it goes. Before I do that, I have one more question. From above, it seems like we are still in a deadlock in terms of tracking "which articles don't have a local value and thus uses/would use a Wikidata value".
::While {{para|fetchwikidata|NONE}} is set on the infobox as the default (as a start), would it be possible to add the above tracker without showing Wikidata values? We could then look up that tracking category, check the Wikidata contents of an article (although it is not displaying wd values yet), then add {{para|fetchwikidata|ALL}} to the article. Once all articles in that tracking category is checked, we can remove <code>|track=true</code> and change the default for that particular parameter in the template to {{para|fetchwikidata|ALL}}. The {{para|fetchwikidata|ALL}} in the articles can be left as it is (as it now does nothing) and removed casually. What do you think? [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 02:07, 10 May 2020 (UTC)
::: I'll be as clear as I can, {{u|Rehman}}. I don't accept that [[Module:WikidataIB]] is the right place to do field-by-field tracking, nor that such tracking is a reasonable prerequisite for enabling Wikidata in infoboxes. I've already put a lot of effort into creating a mechanism that can ensure every deployment is checked, and I won't spend any time in changing the module to meet unnecessary demands. Anyone is free to get consensus to make changes, or to fork their own version that works the way they want it to, of course.
::: The alternative to the tracker scheme is to use a Wikidata-enabled infobox where the template is coded like this: <code><nowiki>| fwd = {{{fetchwikidata|}}} | spf = {{{suppressfields|}}}</nowiki></code> in every call to WikidataIB. In each article to be checked, it is only necessary to add <code><nowiki>| fetchwikidata = ALL</nowiki></code> to the infobox, thus enabling Wikidata for the entire infobox, and previewing it. Any unwanted fields can be suppressed or a local value substituted before saving. That achieves exactly the same result without the complication of tracking. There are no downsides to working like that. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 21:30, 10 May 2020 (UTC)
::::I hear you, [[User:RexxS|RexxS]]. I'm not a fan of such trackers myself, and I only ask as it seems to be the key requirement of a WikiProject editor, before I am allowed to enable Wikidata there. The solution you suggested above works, but the problem I'm trying to address is slightly different. Please do correct me if I'm not following you correctly.
::::{{tl|Infobox mountain}} is used by roughly 25,000 articles (via local parameters). Only a maximum of roughly 1,500 articles have local values missing ''and'' have the corresponding properties populated on Wikidata (i.e. 1,500 articles ''will'' display a Wikidata value in a given parameter ''if'' Wikidata is enabled, as there is no local value stated currently), the rest of the articles have assigned local values and/or barely has any data populated on Wikidata.
::::So instead of going through all 25,000 articles and enabling them by adding {{para|fetchwikidata|ALL}} (which cause no change to about 23,500), I'm looking for a way to track articles that ''would'' use Wikidata before actually enabling Wikidata, and apply the {{para|fetchwikidata|ALL}} for those only, before actually enabling Wikidata as default at the infobox-level (we have consensus for this).
::::Please let me know if you feel that I'm looking to solve this problem in the wrong way, or if you know of any solution to this without amending the module. The discussion at the mountain infobox is still ongoing, so I'm simply getting things clarified here before commenting there. Kind regards, [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 02:46, 11 May 2020 (UTC)
::::: {{re|Rehman}} It's going to take you a long time to check 1,500 articles. If I had to have a tracking category, my solution would be to code the it into a temporary version of the template, of course, something like:
::::: <code><nowiki>{{#if:{{{paraname|}}}|{{{paraname}}} | | {{#if:{{wdib|...}} | [[Category:Wikidata value available for paraname]] }} }}</nowiki></code>
::::: whenever you would normally use
::::: <code><nowiki>{{wdib|... |paraname}}</nowiki></code>
::::: You are still going to have to check and apply {{para|fetchwikidata|ALL}} for the other 23,500 articles before you return the template to its non-tracking version, though. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 17:17, 11 May 2020 (UTC)
::::: {{re|Rehman}} I've thought about this some more. I could simply add a parameter that would contain text to be returned instead of whatever is returned from Wikidata. That would have a general functionality, rather than a narrow use. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 18:33, 11 May 2020 (UTC)
::::: {{re|Rehman}} New parameter {{para|replacetext}} (alias {{para|rt}}) I've set this up in [[Module:WikidataIB/sandbox]]:
::::: {{q|P610}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P610 |qid=Q1286}}</nowiki></code> → {{wdib/sandbox |ps=1 |P610 |qid=Q1286}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P610 |qid=Q1286 |replacetext=}}</nowiki></code> → {{wdib/sandbox |ps=1 |P610 |qid=Q1286 |replacetext=}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P610 |qid=Q1286 |replacetext=[[:Category:Wikidata available for highest point]]}}</nowiki></code> → {{wdib/sandbox |ps=1 |P610 |qid=Q1286 |replacetext=[[:Category:Wikidata available for highest point]]}}
::::: {{q|P2044}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P2044 |qid=Q1286}}</nowiki></code> → {{wdib/sandbox |ps=1 |P2044 |qid=Q1286}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P2044 |qid=Q1286 |rt=}}</nowiki></code> → {{wdib/sandbox |ps=1 |P2044 |qid=Q1286 |rt=}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P2044 |qid=Q1286 |rt=[[:Category:Wikidata available for elevation]]}}</nowiki></code> → {{wdib/sandbox |ps=1 |P2044 |qid=Q1286 |rt=[[:Category:Wikidata available for elevation]]}}
::::: {{q|P1943}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P1943 |qid=Q1286}}</nowiki></code> → {{wdib/sandbox |ps=1 |P1943 |qid=Q1286}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P1943 |qid=Q1286 |rt=}}</nowiki></code> → {{wdib/sandbox |ps=1 |P1943 |qid=Q1286 |rt=}}
:::::* <code><nowiki>{{wdib/sandbox |ps=1 |P1943 |qid=Q1286 |rt=[[:Category:Wikidata available for ___location map]]}}</nowiki></code> → {{wdib/sandbox |ps=1 |P1943 |qid=Q1286 |rt=[[:Category:Wikidata available for ___location map]]}}
::::: Optionally you could just use something like [[:Category:Wikidata available for Infobox mountain]]. If that does what you want, I can update the main module to implement the functionality. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 19:01, 11 May 2020 (UTC)
::::::Yes a broader feature such as above is definitely a much better approach than what I proposed. After testing the above for <code>parent_peak</code>/{{Property|P3137}} at [[Template:Infobox mountain/sandbox]] by <code><nowiki>{{Infobox mountain/sandbox|qid=Q15397819|parent_peak=abc}}</nowiki></code> it seems like the only bug is that the pen icon (alone) is still displayed when the text is replaced and no local value is present, other than that, it works great. Using a single tracking category also makes a lot of sense, in the way that we don't have to visit the same article over and over for different parameters. I will pass these to the discussion there. Please do go ahead and enable this when you feel it's ready. Thank you for this, [[User:RexxS|RexxS]]. [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 02:24, 12 May 2020 (UTC)
::::::Would it make sense/be possible to ignore <code>|fetchwikidata=</code> if <code>|replacetext=</code> is non-blank? This would allow me do run the code as follows:
::::::*<code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|1=P3137|2={{{parent_peak|}}}|name=parent_peak|qid={{{qid|}}}|rank=best|fetchwikidata={{{fetchwikidata|NONE}}}|suppressfields={{{suppressfields|none}}}|onlysourced={{{onlysourced|no}}}|replacetext={{#ifeq:{{{fetchwikidata|}}}|ALL||[[Category:Wikidata available for Infobox mountain]]}}}}</nowiki></code>
::::::Allowing the person(s) checking and enabling Wikidata to simply add <code>|fetchwikidata=ALL</code> once the check is done, while reducing a lot of code. What do you think? [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 04:06, 12 May 2020 (UTC)
::::::: {{re|Rehman}} I've moved the replacement to the output module so that the replacetext also replaces the pen icon.
:::::::* <code><nowiki>{{wdib/sandbox |fwd=ALL |osd=n |P610 |qid=Q1286}}</nowiki></code> → {{wdib/sandbox |fwd=ALL |osd=n |P610 |qid=Q1286}}
:::::::* <code><nowiki>{{wdib/sandbox |fwd=ALL |osd=n |P610 |qid=Q1286 |replacetext=[[:Category:Wikidata available for Infobox mountain]]}}</nowiki></code> → {{wdib/sandbox |fwd=ALL |osd=n |P610 |qid=Q1286 |replacetext=[[:Category:Wikidata available for Infobox mountain]]}}
::::::: The above will work for all the usual functions. I've only set {{para|fetchwikidata|ALL}} when <code>replacetext</code> exists in <code>getValue</code>, but that should still find almost all of the articles for you.
:::::::* <code><nowiki>{{wdib/sandbox |fwd=none |osd=n |P610 |qid=Q1286}}</nowiki></code> → {{wdib/sandbox |fwd=none |osd=n |P610 |qid=Q1286}}
:::::::* <code><nowiki>{{wdib/sandbox |fwd=none |osd=n |P610 |qid=Q1286 |replacetext=[[:Category:Wikidata available for Infobox mountain]]}}</nowiki></code> → {{wdib/sandbox |fwd=none |osd=n |P610 |qid=Q1286 |replacetext=[[:Category:Wikidata available for Infobox mountain]]}}
::::::: You'll still have to have two versions of the infobox template available, I think. One will need <code><nowiki>|replacetext=[[Category:Wikidata available for Infobox mountain]]</nowiki></code> coded in to each call, which will replace the current infobox template and generate the list of articles in the category. Then you'll need a second version without <code>replacetext</code>, so that you can use it in each article for checking what is actually returned from Wikidata when you add {{para|fetchwikidata|ALL}} to the article. After you've finished all of the checking, you can simply replace the tracking version of the template with the second version. Cheers --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 17:59, 12 May 2020 (UTC)
::::::::Many thanks for this. This should do, I will test the new version and confirm again. I think two versions are not needed as I plan to add:
::::::::*<code><nowiki>|replacetext={{#ifeq:{{{fetchwikidata|}}}|ALL||[[Category:Wikidata available for Infobox mountain]]}}</nowiki></code>
::::::::So after checking a particular article, the checker simply adds <code><nowiki>|fetchwikidata=ALL</nowiki></code>, which enables Wikidata and removes the category at the same time. And once all checks are done (the category is empty), we simply remove <code><nowiki>|replacetext=</nowiki></code> from the infobox. Cheers, [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 02:33, 13 May 2020 (UTC)
::::::::[[User:RexxS|RexxS]], I've tested the above. In terms of functionality it now works well. There is a bug though, but I'm not sure if its coming from [[Module:WikidataIB/sandbox]] or [[Template:Infobox mountain/sandbox]]. If we preview <code><nowiki>{{Infobox mountain/sandbox|qid=Q15397819}}</nowiki></code>, you will see that "Parent peak" shows a blank value. Would you know what is causing that? [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 06:24, 13 May 2020 (UTC)
::::::::: {{re|Rehman}} You'll still need two versions, of course, but if you use your coding, you don't need them at the same time. That's fine. The blank field is as expected, and it's because [[Module:Infobox]] "sees" the category string as a field value (not a blank value), so it creates the field label for it. That's the problem with using the module to return the category, rather than coding it into the template. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 11:25, 13 May 2020 (UTC)
::::::::::Oh :( I'm not too sure if there is a way around this, but I have posted at [[Module talk:Infobox]] to see if something can be done. This is too bad. A feature of this sort would surely come in handy with the "onboarding process" of infoboxes not yet with Wikidata support. [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 12:51, 13 May 2020 (UTC)
{{OD|:::::::::::}} Thanks for helping at [[Module talk:Infobox]]. I'm very glad we now have this feature. I've did some more tests, and everything now seems to work seamlessly. When you're ready, could you move the WikidataIB code from sandbox to live please? Cheers, [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 03:40, 14 May 2020 (UTC)
: {{done}} --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 19:29, 14 May 2020 (UTC)
:: Thank you [[User:RexxS|RexxS]]. Not sure if this is due to the above change, but there seems to be a bug in the main functions:
::* <code><nowiki>{{#invoke:WikidataIB|getValue|1=P2660|qid=Q15397819|rank=best|fetchwikidata=all|suppressfields=none|onlysourced=no|noicon=true}}</nowiki></code> → {{#invoke:WikidataIB|getValue|1=P2660|qid=Q15397819|rank=best|fetchwikidata=all|suppressfields=none|onlysourced=no|noicon=true}}
::* <code><nowiki>{{#invoke:WikidataIB|getValue|1=P2660|qid=Q15397819|ps=1}}</nowiki></code> → {{#invoke:WikidataIB|getValue|1=P2660|qid=Q15397819|ps=1}}
::I'm not able to trace the cause of it though... [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 05:25, 15 May 2020 (UTC)
::: {{re|Rehman}} {{para|fetchwikidata|all}} doesn't work - it would whitelist just a field called "all" because field names are case specific. Use {{para|fetchwikidata|ALL}}.
::: {{para|suppressfields|none}} doesn't work - it would blacklist just a field called "none". Usually that makes no difference, except that any value for {{para|suppressfields}} requires a {{para|name}} parameter so that it knows the name of the field it has to check on the blacklist. The same goes for {{para|fetchwikidata}} when it has any value other than "ALL", when it needs to know the field name to check on the whitelist.
:::* <code><nowiki>{{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=ALL |onlysourced=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=ALL |onlysourced=no |noicon=true}}
:::* <code><nowiki>{{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=ALL |onlysourced=no |suppressfields=field1 |noicon=true |name=prominence}}</nowiki></code> → {{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=ALL |onlysourced=no |suppressfields=field1 |noicon=true |name=prominence}}
:::* <code><nowiki>{{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=field1, field2, prominence |onlysourced=no |noicon=true |name=prominence}}</nowiki></code> → {{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=field1, field2, prominence |onlysourced=no |noicon=true |name=prominence}}
:::* <code><nowiki>{{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=field1, field2, prominence |onlysourced=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=field1, field2, prominence |onlysourced=no |noicon=true}}
:::* <code><nowiki>{{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=ALL |onlysourced=no |suppressfields= |noicon=true |name=}}</nowiki></code> → {{#invoke:WikidataIB |getValue |1=P2660 |qid=Q15397819 |rank=best |fetchwikidata=ALL |onlysourced=no |suppressfields= |noicon=true |name=}}
::: In the cases where the name parameter is missing (other than when {{para|fetchwikidata|ALL}}), the call will always return empty. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 15:42, 15 May 2020 (UTC)
::::I'm quite certain these basic calls didn't work yesterday even when I tried uppercase. Probably a glitch/lag somewhere, or just me having a moment. I've gone ahead and changed all sandbox instances to uppercase anyway, in case it was me missing something. Thank you for explaining! Cheers, [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 04:15, 16 May 2020 (UTC)
 
== Image captions ==
 
Hello. Any suggestions on getting accurate image captions? I'm aware of the old <code><nowiki>{{#invoke:Wikidata|getImageLegend|FETCH_WIKIDATA}}</nowiki></code>, but [[Module:Wikidata]] is outdated and the output isn't accurate when there are multiple images.
 
I tried to put together something like <code><nowiki>{{#invoke:WikidataIB|getQualifierValue|P18|pval={{#invoke:WikidataIB|getValue|P18|qid=Q15397819|ps=1|maxvals=1}}|qual=P2096|qid=Q15397819|ps=1|maxvals=1}}</nowiki></code>, but that of course didn't work. [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 06:49, 8 May 2020 (UTC)
: The call I'm currently using to do this (in [[:commons:Template:Wikidata Infobox]]) is <code><nowiki>{{#invoke:WikidataIB |getValue | rank=best |P18 |qid={{#invoke:WikidataIB |getQid |qid={{{qid|}}} }} |fwd={{{fwd|ALL}}} |osd=no |noicon=y |qual=P2096 |qualsonly=yes | maxvals=1}}</nowiki></code>. Thanks. [[User:Mike Peel|Mike Peel]] ([[User talk:Mike Peel|talk]]) 07:40, 8 May 2020 (UTC)
::Thanks [[User:Mike Peel|Mike Peel]]. Just what I was looking for! Cheers, [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 07:49, 8 May 2020 (UTC)
 
[[User:Mike Peel|Mike Peel]], would you know if the Commons caption saved as [[:Commons:Commons:Structured data|structured data]] could be made use of if a caption on Wikidata is missing? Or even vice versa, if the Commons caption could be prioritised if preferred? [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 13:16, 16 May 2020 (UTC)
: No idea, sorry. You can access Commons captions on Commons using WikidataIB and the media files M-id, but I've never tried outside of Commons. Thanks. [[User:Mike Peel|Mike Peel]] ([[User talk:Mike Peel|talk]]) 13:18, 16 May 2020 (UTC)
::Thanks Mike. It would be nice if that is implemented in the future, especially considering Commons files themselves have useful machine-readable captions. Cheers, [[User:Rehman|<span style="font-variant:small-caps; font-weight:bold; color:darkblue">Reh</span>]][[User talk:Rehman|<span style="color:green">man</span>]] 13:26, 16 May 2020 (UTC)
 
== Qualifiers ==
 
I've done a fairly significant re-write of how qualifiers are handled. The effects are to allow DATES to be mixed with other parameters; to process {{q|P580}} and {{q|P582}} separately, so they are always last in the list of qualifiers rendered (and use ndashes, regardless of the value of <code>qsep</code>); and to clean up the code internally, reducing recalculation of certain objects every time a loop is iterated. I've tested as many cases as I can think of, but there may still be issues that require the code to be rolled back while they are sorted out. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 15:03, 13 June 2020 (UTC)
 
== Infoboxes still using Template:Wikidata ==
 
According to "What links here", the following infoboxes are still using {{tl|Wikidata}} and may benefit from conversion to Module:WikidataIB:
{{collapse top|According to "What links here", the following infoboxes are still using {{tl|Wikidata}} and may benefit from conversion to Module:WikidataIB:}}
*[[Template:Infobox Belgium municipality]] (611 transclusions)
*[[Template:Infobox Belgium municipality section]]
*[[Template:Infobox Italian comune]] (8,086 transclusions)
*[[Template:Infobox Russian federal subject]]
*[[Template:Infobox Swiss town]] (2,841 transclusions)
*[[Template:Infobox airline]] (4,356 transclusions)
*[[Template:Infobox artwork/wikidata]] (493 transclusions)
*[[Template:Infobox company]] (76,000 transclusions)
*[[Template:Infobox company/Unternehmen]]
*[[Template:Infobox drink]] (1,166 transclusions)
*[[Template:Infobox drug]] (8,510 transclusions)
*[[Template:Infobox drug/formatCompTox]] (8,522 transclusions)
*[[Template:Infobox element]] (somewhere in a subtemplate)
*[[Template:Infobox football association]]
*[[Template:Infobox gene]] (12,577 transclusions)
*[[Template:Infobox golfer/ranking]]
*[[Template:Infobox organization/Wikidata]]
*[[Template:Infobox physical quantity]]
*[[Template:Infobox power station]] (2,554 transclusions)
*[[Template:Infobox rowing club]]
*[[Template:Infobox scientist/Wikidata]]
*[[Template:Infobox software]] (13,588 transclusions)
{{collapse bottom}}
It seems likely that some of these templates are pulling unsourced data from Wikidata into infoboxes. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 20:01, 1 July 2020 (UTC)