Module talk:WikidataIB/Archive 7: Difference between revisions

Content deleted Content added
m Archiving 2 discussion(s) from Module talk:WikidataIB) (bot
m Archiving 1 discussion(s) from Module talk:WikidataIB) (bot
Line 160:
:: It's documented at [[Module:WikidataIB #Parameters to getValue]]. Hope that helps. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 16:47, 23 September 2020 (UTC)
:::That's just what I'm looking for, thanks. I looked through that table twice so no idea why I didn't spot that option. &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 17:50, 23 September 2020 (UTC)
 
== Label truncated ==
 
<pre>{{#invoke:WikidataIB|getLabel|qid=Q6918608}}</pre>
gives {{#invoke:WikidataIB|getLabel|qid=Q6918608}}
 
<pre>{{#invoke:WikidataIB|getValue|qid=Q940078|P287|fwd=ALL|osd=0}}</pre>
gives <s>{{#invoke:WikidataIB|getValue|qid=Q940078|P287|fwd=ALL|osd=0}}</s> (now fixed, was just Mott)
 
For some reason the label is truncated, presumably because of the comma. How can I override this? &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 13:10, 23 September 2020 (UTC)
:
: {{re|MSGJ|label=Martin}} That's a tough one, because the module prefers the local sitename (where it exists) to avoid using the label because of vandalism. Unfortunately, enwiki article titles commonly contain parenthetical or comma separated disambiguators, so it strips anything in parentheses or after a comma, e.g. <code>[[John Smith (cricketer)]]</code> → <code>John Smith</code> and [[Hayes, Middlesex]] → Hayes. I could create another parameter to switch to using the label instead of the sitename, but it would leave the field much more vulnerable to vandalism. I'll knock up some code in the sandbox to check it out. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 17:09, 23 September 2020 (UTC)
: {{re|MSGJ|label=Martin}} In the [[Module:WikidataIB/sandbox|sandbox]], I've implemented a new parameter {{para|uselabel}} (alias <code>uselbl</code>, defaults to false) that forces the call to display the label instead of displaying the disambiguated sitelink:
:* <code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|qid=Q940078|P287|fwd=ALL|osd=n}}</nowiki></code> → <s>{{#invoke:WikidataIB/sandbox|getValue|qid=Q940078|P287|fwd=ALL|osd=n}}</s> (now fixed, was just Mott)
:* <code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|qid=Q940078|P287|fwd=ALL|osd=n |uselbl=y}}</nowiki></code> → {{#invoke:WikidataIB/sandbox|getValue|qid=Q940078|P287|fwd=ALL|osd=n |uselbl=y}}
: See if that does the job for you and we can update the main module if so. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 17:43, 23 September 2020 (UTC)
::That would be perfect. I think using the label would be better in most cases, although if vandalism is a real problem then I can understand reluctance. &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 17:47, 23 September 2020 (UTC)
::: {{re|MSGJ|label=Martin}} I'm afraid that vandalism of labels on Wikidata is a huge problem, while it's near impossible to vandalise a sitelink{{snd}} hence the effort I put in to using the sitelink by default. I often look at [https://wdvd.toolforge.org/index.php?lang=en&limit=50&labels=on&sitelinks=on the Wikidata vandalism dashboard] and remain discouraged by the amount of vandalism that occurs. The root cause is that there are only about 46 articles per active user on the English Wikipedia, while there are 3747 articles per active user on Wikidata. I've updated the main module now. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 18:45, 23 September 2020 (UTC)
:::* <code><nowiki>{{#invoke:WikidataIB|getValue|qid=Q940078|P287|fwd=ALL|osd=n}}</nowiki></code> → <s>{{#invoke:WikidataIB|getValue|qid=Q940078|P287|fwd=ALL|osd=n}}</s> (now fixed, was just Mott)
:::* <code><nowiki>{{#invoke:WikidataIB|getValue|qid=Q940078|P287|fwd=ALL|osd=n |uselbl=y}}</nowiki></code> → {{#invoke:WikidataIB|getValue|qid=Q940078|P287|fwd=ALL|osd=n |uselbl=y}}
::::Thanks, I have used it for that particular property to avoid the original problem. But unless I use {{para|uselbl|y}} for every property, there is no way to ensure it won't happen with another property. How about the following: if the sitelink equals the label or one of the aliases (up to case differences) then do not truncate the commas. &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 19:52, 23 September 2020 (UTC)
::::: {{re|MSGJ|label=Martin}} That's looks like a good improvement. Aliases are another can of worms, so I've left that out for the moment, but skipping the sitelink processing altogether if the the label and sitelink are the same (apart from case) should clearly be more efficient. The implementation in the sandbox looks good enough and simple enough for me to be confident in updating the main module. It should all work now without using the {{para|uselbl}} parameter. Thank you. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 14:22, 24 September 2020 (UTC)