Content deleted Content added
m Archiving 1 discussion(s) from Module talk:WikidataIB) (bot |
m Archiving 2 discussion(s) from Module talk:WikidataIB) (bot |
||
Line 283:
:* <code><nowiki>{{#invoke:WikidataIB |getPropOfProp |prop1=P610 |fwd=ALL |osd=n |noicon=t |prop2=P2044 |uabbr=t |qid=Q13786}}</nowiki></code> → {{#invoke:WikidataIB |getPropOfProp |prop1=P610 |fwd=ALL |osd=n |noicon=t |prop2=P2044 |uabbr=t |qid=Q13786}}
:* <code><nowiki>{{#invoke:WikidataIB |getPropOfProp |prop1=P610 |fwd=ALL |osd=n |noicon=t |prop2=P2044 |conv=y |qid=Q13786}}</nowiki></code> → {{#invoke:WikidataIB |getPropOfProp |prop1=P610 |fwd=ALL |osd=n |noicon=t |prop2=P2044 |conv=y |qid=Q13786}}
== I don't come here often. Is it me, or are there a couple of problemettes? ==
1 Minor problem in climate<br />
::<nowiki>A1 {{safesubst:#invoke:WikidataIB |getValue |P2564|qid=Q315703|fwd=ALL|sn=true|osd=no|noicon=true}}</nowiki><br />
:::gives the right answer [[Tropical rainforest climate|Af]]<br />
:::except that I want it unlink ...<br />
::<nowiki>A2 {{safesubst:#invoke:WikidataIB |getValue |P2564|qid=Q315703|fwd=ALL|sn=true|osd=no|noicon=true|linked=no}}</nowiki><br />
:::tropical rainforest climate<br />
:::but it no longer gives the shortname.<br />
::<nowiki>short name (sn)</nowiki> has not enough description in main document, and none at all in the sandboxes.<br />
2 Minor problem in scaling money<br />
::<nowiki>B1 ₱{{safesubst:#invoke:WikidataIB |getValue |P3087|qid=Q315771|fwd=ALL|rank=b|osd=no|noicon=true|su=false}}</nowiki><br />
:::unscaled→ ₱171,234,667.17<br />
::<nowiki>B2 ₱{{safesubst:#invoke:WikidataIB |getValue |P3087|qid=Q315771|fwd=ALL|rank=b|osd=no|noicon=true|scale=3|su=false}}</nowiki><br />
:::thousands→ ₱171,235 thousand<br />
:::integer only<br />
::<nowiki>B3 ₱{{safesubst:#invoke:WikidataIB |getValue |P3087|qid=Q315771|fwd=ALL|rank=b|osd=no|noicon=true|scale=6|su=false}}</nowiki><br />
:::millions→ ₱171.2 million<br />
:::has one decimal, not integer<br />
::<nowiki>B4 ₱{{safesubst:#invoke:WikidataIB |getValue |P3087|qid=Q315771|fwd=ALL|rank=b|osd=no|noicon=true|scale=9|su=false}}</nowiki><br />
:::billions→ ₱0.1712 billion<br />
:::has four decimals, not integer<br />
::<nowiki>BY ₱{{safesubst:#invoke:WikidataIB |getValue |P3087|qid=Q315771|fwd=ALL|rank=b|osd=no|noicon=true|scale=a|su=false}}</nowiki><br />
:::auto scaling→ ₱171,235 thousand<br />
:::it doesn't seem correct - scaling here should be <nowiki>scale=6</nowiki>
::<nowiki>BZ ₱{{safesubst:#invoke:WikidataIB |getValue |P3087|qid=Q1889017|fwd=ALL|rank=b|osd=no|noicon=true|scale=a|su=false}}</nowiki><br />
:::auto scaling→ ₱1,590 million<br />
:::it doesn't seem correct - scaling here should be <nowiki>scale=9</nowiki><br />
:[[Special:Contributions/46.69.62.85|46.69.62.85]] ([[User talk:46.69.62.85|talk]]) 12:24, 16 October 2020 (UTC)
:'''2'''
{|
| style="text-align:left;" | 2a ''rounding''
|-
| style="vertical-align:top;max-width:12.5em;"| I think it's trying to be too clever.<br />See [[James Thurber]] – The Bear Who Let lt Alone
| style="text-align:left;" |<poem><code>
-- round scaled numbers to integers or 4 sig fig
if (scale > 0 or sc == "a") then
if amount < 1e4 then
amount = roundto(amount, 4)
else
amount = math.floor(amount + 0.5)
end
end</code></poem>
|-
| I think it should all end up with 1D except scale 0, nothing to do with sig figs
|-
| style="text-align:left;" | 2b ''auto scale''
|-
| style="vertical-align:top;"| It seems wrong – this is the part:
| style="text-align:left;" |<poem><code>
if sc == "a" then
-- automatic scaling
if amount > 1e15 then
scale = 12
elseif amount > 1e12 then
scale = 9
elseif amount > 1e9 then
scale = 6
elseif amount > 1e6 then
scale = 3
else
scale = 0
end
else
scale = tonumber(args.scale) or 0
if scale < 0 or scale > 12 then scale = 0 end
scale = math.floor(scale/3) * 3
end
local factor = 10^scale
amount = amount / factor</code></poem>
|-
| style="vertical-align:top;"| I think it should be changing along
| style="text-align:left;" |<poem><code>
if sc == "a" then
-- automatic scaling
if amount > 1e12 then
scale = 12
elseif amount > 1e9 then
scale = 9
elseif amount > 1e6 then
scale = 6
elseif amount > 1e3 then
scale = 3
else
scale = 0
end
else
scale = tonumber(args.scale) or 0
if scale < 0 or scale > 12 then scale = 0 end
scale = math.floor(scale/3) * 3
end
local factor = 10^scale
amount = amount / factor</code></poem>
|-
| although I don't know why very large numbers are not given any scaling.<br />See [[Long and short scales]]. And the coding is very slow.
|}
: 1 A1: There is no use-case for an unlinked short name. Displaying something like '''Climate''' Af is nonsensical to most readers, whereas '''Climate''' [[Tropical rainforest climate|Af]] allows the reader a chance to learn what the classification is. Your desire for unlinked text is not helpful.
: 1 A2: because there is no use-case for an unlinked short name, I only coded fetching a short name when the item is linked.
: If you don't think there's enough documentation on short name, please feel free to add something to [[Module:WikidataIB/doc]] which is ''not'' protected.
: 2 B1 to B4 and 2a: Because these values are for use in infoboxes, the space is constrained. What is the point in quoting cents when we have values in the millions of dollars? I simply disagree with your suggestion that we should normally be placing values into infoboxes with 11 significant figures. I think 171.2 billion is far superior in an infobox to 171,234,667.17 in 99.9% of cases. Rounding these values to four sig fig is a good compromise between precision and use of available space. I completely reject your suggestion to round to 1 decimal place. If we scale 1,149 on my scheme to scale=3, we get 1.149 thousand. On your scheme, we get 1.1 thousand - that's a relatively big error.
: 2 BY, BZ and 2b: If we use autoscaling, I would expect 1,149 to display as 1,149, not as 1.149 thousand, which takes up far more space and is not in line with common usage. I disagree that is being "too clever". I'm ambivalent about bigger values, so I don't have a problem with displaying 1,149,000 as either 1.149 million or 1,149 thousand. In any given case, the autoscaling can be overriden by setting a scale value anyway.
: Very big numbers are ambiguous when using trillion, etc. and who understands quadrillion, quintillion and so on? They could easily be implemented, but how much use would they get? Do you have examples of their use in infoboxes?
: As for the coding being very slow, please feel free to re-write the module in faster code. There are several sandboxes you can use to demonstrate your improvements. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 22:38, 11 November 2020 (UTC)
== Another problem ==
<nowiki>{{#invoke:WikidataIB |getValue |P1082||qid=Q2673519|fwd=ALL|rank=p n|osd=no|noicon=true|sorted=yes|qsorted=yes|maxvals=2|list=p-1|qo=true|qual=P585}}</nowiki> gives {{#invoke:WikidataIB |getValue |P1082||qid=Q2673519|fwd=ALL|rank=p n|osd=no|noicon=true|sorted=yes|qsorted=yes|maxvals=2|list=p-1|qo=true|qual=P585}} which is what I want. But giving full date <nowiki>{{#invoke:WikidataIB |getValue |P1082||qid=Q2673519|fwd=ALL|rank=p n|osd=no|noicon=true|sorted=yes|qsorted=yes|maxvals=2|list=p-1|qo=true|qual=P585</nowiki>'''|qdf=dmy'''<nowiki>}}</nowiki> (and / or |df=dmy) changes the date: {{#invoke:WikidataIB |getValue |P1082||qid=Q2673519|fwd=ALL|rank=p n|osd=no|noicon=true|sorted=yes|qsorted=yes|maxvals=2|list=p-1|qo=true|qual=P585|qdf=dmy}}<br />Help! [[User:Not Samuel Pepys|Not Samuel Pepys]] ([[User talk:Not Samuel Pepys|talk]]) 17:27, 11 November 2020 (UTC)
:
: {{re|Not Samuel Pepys}} WikidataIB uses the default sorting in Lua for property and qualifier values, so if you set {{para|sorted|yes}}, it will sort the output values alphanumerically. The setting of {{para|qsorted}} is irrelevant because there is not more than one qualifier value in each case.
: If we go through the steps in refining the values from {{q|Q2673519}}, you can see what's happening. This is with {{para|df|y}} (because the default for qualifiers is year-only):
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |qual=P585}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |qual=P585}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |list=p-1}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |list=p-1}}
: This is with {{para|df|dmy}}:
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |qual=P585 |qdf=dmy}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |qual=P585 |qdf=dmy}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qdf=dmy}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qdf=dmy}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |qdf=dmy}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |qdf=dmy}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |list=p-1 |qdf=dmy}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=p n |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |list=p-1 |qdf=dmy}}
: As you can see, 2010 sorts before 2015, but 1 August 2015 sorts before 1 May 2010. I need to write a new sorting routine to replace the default for use when the values are dates. Sorry, but that's a bit more of a job and may take me a while to implement. For now, I'd recommend using the preferred value from Wikidata:
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=best |osd=no |noicon=true |qual=P585 |qdf=dmy}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=b |osd=no |noicon=true |qual=P585 |qdf=dmy}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=best |osd=no |noicon=true |sorted=yes |qual=P585 |qdf=dmy}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=b |osd=no |noicon=true |sorted=yes |qual=P585 |qdf=dmy}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=best |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |qdf=dmy}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=b |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |qdf=dmy}}
:* <code><nowiki>{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=best |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |list=p-1 |qdf=dmy}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P1082 |qid=Q2673519 |fwd=ALL |rank=b |osd=no |noicon=true |sorted=yes |qual=P585 |qo=y |list=p-1 |qdf=dmy}}
: I'll make sure it's on the to-do list. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 21:58, 11 November 2020 (UTC)
::I think the "easiest" would be using Y F d (in #time: syntax). As long as it was the right date, #time: would use what parts it needs without knowing which order the parts are. All my questions are connected with {{tlx|PH wikidata}} – [[User:Not Samuel Pepys|Not Samuel Pepys]] ([[User talk:Not Samuel Pepys|talk]]) 23:33, 11 November 2020 (UTC)
::: The module uses [[Module:Complex date]] to render dates in whatever language is required, and using <code>mw.language:formatDate</code> (the Scribunto implementation of the #time parser function) would break that functionality as well as failing when qualifiers like 'circa' are added. If I still had the value of the timestamp available when doing the sorting, I could sort that alphanumerically and that would be easiest way. I'm considering prepending the timestamp to the formatted date and then stripping it off after sorting as a solution to the problem. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 00:21, 12 November 2020 (UTC)
|