Module talk:Wd

Page contents not supported in other languages.
Source: Wikipedia, the free encyclopedia.
WikiProject iconWikidata
WikiProject iconThis module is within the scope of WikiProject Wikidata, a collaborative effort to improve Wikipedia's integration with Wikidata.
If you would like to participate, please visit the project page.

Error

{{wikidata|references|P11698|eid=Q7227384}} ([1]) is displaying an error, presumably because the module is having trouble with the statement's reference including section, verse, paragraph, or clause (P958). It should be mapped to {{Cite web}}'s |at= parameter. Could this be fixed? {{u|Sdkb}}talk 06:10, 1 February 2024 (UTC)[reply]

@Sdkb: I have made a fix in the sandbox:
[1]
I am not sure this is how it should be displayed, the meaning of "B22" would not be clear for me if I saw it in a citation while reading. What do you think? Janhrach (talk) 20:31, 3 February 2024 (UTC)[reply]
@Janhrach: Looks good to me! My view is that it should be displayed the same as it would in CS1: [2] I agree that the display in CS1 isn't ideal, but that's a larger issue for CS1 to deal with (and not a particularly dire one — having the specific location might help someone trying to verify the information, but it's not really going to harm anyone confused by it). Cheers, {{u|Sdkb}}talk 23:01, 3 February 2024 (UTC)[reply]
Ok, so I will submit an edit request in several days if nobody will have complained. Thank you for reporting this. Janhrach (talk) 08:14, 4 February 2024 (UTC)[reply]
@Janhrach, seeing no concerns, are we good to implement? {{u|Sdkb}}talk 03:57, 8 February 2024 (UTC)[reply]
@Sdkb: Yes, we are. Considering you are a template editor, could you please make the change yourself, so that an edit request isn't needed? Janhrach (talk) 09:40, 11 February 2024 (UTC)[reply]
 Done here. Please let me know if there are any issues. Cheers, {{u|Sdkb}}talk 15:58, 11 February 2024 (UTC)[reply]
@Janhrach if you would like the TPE userright, please let me know, as I believe you meet the criteria — Martin (MSGJ · talk) 21:26, 11 February 2024 (UTC)[reply]
I believe I am one template edited short of one of the requirements. Janhrach (talk) 19:29, 18 February 2024 (UTC)[reply]

References

  1. ^ a b "Pomona College 2023–2024 Common Data Set". Pomona College. B22. Archived from the original on 19 February 2024. Retrieved 17 April 2024.
  2. ^ "Pomona College 2023–2024 Common Data Set". Pomona College. B22. Retrieved 1 February 2024.

Accessing titles from other Wikipedias

 Courtesy link: Module talk:Wd/Archive 1 § Titles from other wikipedias

Still interested in this feature: given a wikidata Q-id and an ISO-639 code 'xx', return the title of the article at xx-wiki for that item. Perhaps as in this mockup:

{{wikidata|wikipedia|lang=es|eid=Q43287}} → Imperio alemán

There's also another editor interested in this; adding Your Friendly Neighborhood Sociologist. Thanks, Mathglot (talk) 08:59, 14 February 2024 (UTC)[reply]

Theres a suggestion on the courtesy linked page to use {{#invoke:WikidataIB|getSiteLink|qid=Q43287|wiki=eswiki|ps=1}} >> Imperio alemán, @Mathglot. Ponor (talk) 12:18, 16 February 2024 (UTC)[reply]
@Ponor: Thank you for your comment. I thought I missed a reply in that discussion or something, but it turns out that it came from a different discussion in section § Getting values (labels) from a local Wikipedia, and unfortunately I never saw that one. Also, I believed the response I got in the original discussion that it wasn't possible, so this is a very pleasant surprise. That's some eagle-eyed sleuthing; thanks again! Mathglot (talk) 23:12, 16 February 2024 (UTC)[reply]
Oh... thank you, @Mathglot, I learned something new too. This could be made into a separate template, if needed, so other people can find it: {{sitelink|qid|wiki}} // {{sitelink|Q43287|es}}es:Imperio alemán, or whatever you wanna to call it. It's a 10 minute job. Ponor (talk) 23:50, 16 February 2024 (UTC)[reply]
@Ponor:, yeah, and creating a template wrapper for it got added to my list the minute you replied and I saw it was workable. Only for me, it's more like a 2–3 hour job: ten minutes to code and test it, just as you say; then maybe 30-45' to write the doc page and maybe create a couple of template shortcuts, and another hour-plus or so to hunt down some RW examples in a few languages, and another hour or so to write the test cases page. Maybe I need to go to perfectionist jail for a while . I think it might need several redirect names; probably 'sitelink' is a good template name, but won't mean much to those who think 'foreign wikipedia title' and it's not obvious to me how to ensure it is findable; all your suggestions would be welcome.
As it happens, I'm deep into a wrapper creation right now:
Draft:HasTemplate, which is going to be incredibly useful once it is released. It's got a backstory that is turning out to be a lot more complex than I ever expected; you can look at this discussion if you're curious, but fair warning: it really gets into the weeds on some things, so what I thought was going to be a terse, one-sentence, one-response discussion, is way more than that. (Feel free to wade in there, if you're not afraid of drowning in the details.) So, I will definitely write {{sitelink}} (or whatever we decide to call it) but you never know when something that seemed like a ten-minute thing at the time, turns out to have all sorts of little issues around it and goes on a lot longer, but I hope not! Mathglot (talk) 00:33, 17 February 2024 (UTC)[reply
]
Well... I did something here: Template:Sitelink :) People will probably find it in its category, with other similar templates. Need to figure out how to make the foreign titles wikilinked, nothing like [[:es:xxxx|]] worked.
  • {{sitelink|es|qid=Q43287}}: Imperio alemán
  • {{sitelink|fr|title=German empire}}: Empire allemand (was cheap to get)
  • {{sitelink|fr}} in any article should also work
Feel free to play further! And whoever's reading this. Ponor (talk) 01:22, 17 February 2024 (UTC)[reply]
Well, you just saved me ten minutes. (I went ahead and updated the doc a bit more; see what you think.) I tested {{sitelink|fr}} at German Empire, and it worked perfectly, although there probably won't be much call for that. On the other hand, being able to use it from the associated Talk page would be very useful; I tested it at Talk:German Empire, and of course no big surprise that it returned empty. Any way it could be updated to detect namespace, i.e., switch to {{SUBJECTPAGENAME}} if it were on the Talk page? That would be very useful. Mathglot (talk) 02:52, 17 February 2024 (UTC)[reply]
@Mathglot: I have a few usecases on my 'other' wiki, for example when pointing readers to full documentation page for templates taken from enwiki, as in Predložak:Get QID (ha! I used {{sitelink|hr|title=Template:Get QID}} here). I'm pretty sure something can be done about the talk pages, let me think about it. Should that be one wiki's talk page to another wiki's talk page or something else? One can always use QIDs and page titles, I wonder if adding more complexity to our little wrapper template would be worth it. Ponor (talk) 14:17, 19 February 2024 (UTC)[reply]

Reference call returns blank on te.wikipedia.org in one case

On te.wikipedia.org, the code used in infobox template for displaying reference is not working in some cases. Example url: https://te.wikipedia.org/wiki/%E0%B0%AA%E0%B1%8D%E0%B0%B0%E0%B0%A4%E0%B1%8D%E0%B0%AF%E0%B1%87%E0%B0%95:ExpandTemplates

template code that does not work

{{#invoke:wd|references|Q18395504|P2046}}

similar template code that works

{{#invoke:wd|references|Q18395504|P1082|P585=2011}}


On en.wikipedia.org at the URL https://en.wikipedia.org/wiki/Special:ExpandTemplates the code works for both cases.

The Templates and Modules involved are replicated on Telugu Wikipedia from English Wikipedia. I request help to address the problem.--Arjunaraoc (talk) 10:43, 20 February 2024 (UTC)[reply]

@Arjunaraoc: I think I have found out the cause of the issue, but I am not certain. Could you send me more examples of this bug?
I didn't have much time for Wikipedia recently, and I think I won't have in the immediate future, so don't expect this to be fixed in less than ~2 weeks. I will ping you when a fix is ready. Janhrach (talk) 17:19, 23 February 2024 (UTC)[reply]
@Janhrach, The code that I cited is used in 670+ pages on Telugu wikipedia. I found the references call with P854, P1476 working properly (d:Q60165513 and corresponding Telugu Wikipedia page https://te.wikipedia.org/wiki/%E0%B0%87%E0%B0%82%E0%B0%95%E0%B1%8A%E0%B0%B2%E0%B1%8D%E0%B0%B2%E0%B1%81_%E0%B0%AE%E0%B0%82%E0%B0%A1%E0%B0%B2%E0%B0%82). So I updated almost all entries to use the working code. So while this is not a priority, let me know when the fix is ready. Arjunaraoc (talk) 10:53, 27 February 2024 (UTC)[reply]
@Janhrach, Today I found another test case where the code works on both English and Telugu Wikipeidas
{{#invoke:wd|references|Q60165552|P2046}}
{{#invoke:wd|references|Q60165552|P1082|P585=2011}} 
Hope that helps.. Arjunaraoc (talk) 07:04, 28 February 2024 (UTC)[reply]
@Arjunaraoc: I think I know what causes the issue, but I am sure I won't have time to fix the issue in the next two weeks, if not more. Be patient, please. Janhrach (talk) 18:22, 5 March 2024 (UTC)[reply]
@Arjunaraoc: The fix is ready in the sandbox. If there are any problems, write to me here. Keep subscribed to this topic, so you will be notified if anybody raises an issue with this change. Thank you for reporting this bug.
To everybody: In accordance with the policy, I will wait for several days until I update the main module. Please review my changes. Janhrach (talk) 16:11, 22 March 2024 (UTC)[reply]
@Janhrach, Thanks for the fix. I tested it on Telugu wikipedia and found the the test cases working. Arjunaraoc (talk) 00:38, 23 March 2024 (UTC)[reply]
 Module updated. Janhrach (talk) 08:11, 1 April 2024 (UTC)[reply]

"Not enough memory" errors

At Comparison of cross-platform instant messaging clients, many of the table entries are displaying Lua error: not enough memory. for various {{wikidata}} calls. I don't know anything about wikidata lookups, just passing along a message left on that article's talk-page. DMacks (talk) 04:13, 27 February 2024 (UTC)[reply]

And it would be nice to have a better fallback in the future. Clicking on the links results currently in a not very helpful popup. https://i.imgur.com/IyXvE6p.png & MediaWiki:Scribunto-common-no-details should probably link to this page so people can get help if they need it & MediaWiki:Scribunto-lua-error. Polygnotus (talk) 04:33, 27 February 2024 (UTC)[reply]
FWIW: The article source, at the bottom, shows "Lua memory usage: 52428782/52428800 bytes" in the limit report. – Jonesey95 (talk) 18:28, 28 February 2024 (UTC)[reply]

A systematic way to avoid reference errors may be needed

I wonder, looking at just the "Comparison of ..." articles in Category:Module:Wd reference errors (currently 1,181 pages), whether a change to the module might help fix some of these errors. Having an error message displayed instead of a reference, especially when nothing has changed in the Wikipedia article, is not good practice. It may be helpful for someone familiar with this module and with Wikidata's structure to look through a sample of these errors to see if a default setting like "prefer the most recent reference when a reference is requested" or a similar preference might help fix some of these errors. – Jonesey95 (talk) 18:55, 28 February 2024 (UTC)[reply]

@Jonesey95: The vast majority of the errors are caused by missing titles. The error messages were introduced into this module as a result of this discussion. I do agree that the current message, which doesn't specify what exactly caused the issue, is not good, and I plan to fix that in some time. However, this might be a complex problem, and I don't think I will have time for that in several months, at least.
As for the errors specifically, you might want to propose a change the module to not need titles in Wikidata references. In that case, you should read the mentioned discussion. Janhrach (talk) 18:51, 5 March 2024 (UTC)[reply]
A template-based reference that is missing a title is (a) incomplete, and should generate an error message, and (b) should generate an error message saying specifically that the title is missing. I hope that will not be difficult to achieve. – Jonesey95 (talk) 19:15, 5 March 2024 (UTC)[reply]
So we can do nothing about the number of the errors, except editing Wikidata. (Making a Wikidata bot adding titles to references is possible, but I can't do so.) As for no. 2, I am going to fix that sometime. Janhrach (talk) 19:59, 5 March 2024 (UTC)[reply]
A missing title is not an error and should not generate an error message. I asked about making a wikidata bot to add titles to references and all I got was Module_talk:Wd/Archive_1#Bot_task:_adding_"title"_to_a_reference_url 6 months ago you also said "Right now, I do not spend much time editing Wikipedia".[1] Why do we have to depend on 1 busy volunteers spare time to fix this important problem? Perhaps some of that $180.2 million of WMF revenue could be spent on something actually useful? Polygnotus (talk) 20:24, 5 March 2024 (UTC)[reply]
See
WP:BAREURL. If not an error message, then at least append {{Bare URL inline}} to tag the reference for cleanup. – Jonesey95 (talk) 20:31, 5 March 2024 (UTC)[reply
]

Current population value

Wikidata:Q6045892 page contains population values between 2007-2022. However, when I type the wikidata:Property:P1082 value, the template calls the population value for 2007. What should I do to have it call up the population value for the most recent year?

{{wd|property|Q6045892|P1082}} → 2,010

Thank you. Sadrettin (talk) 10:48, 7 April 2024 (UTC)[reply]

You have at least two options, @Sadrettin:
  • {{wd|property|Q6045892|P1082|P585=2022}} >> 3,783
  • Change the rank of the latest property on wikidata to preferred
Ponor (talk) 13:08, 7 April 2024 (UTC)[reply]
{{#invoke:wd
	|property
	|P1082
	|P585={{#invoke:Wikidata
		|getRawQualifier
		|qualifier=P585
		|property=P1082
		|sort=P585
		|invert=true
		|limit=1
	}}
}}
The above filters the multiple values of population (P1082 property) by the latest year (P585 qualifiers). If you add |P459=Q6042918 after |P1082, then the result is also filtered by determination method. Serresmap (talk) 18:55, 18 April 2024 (UTC)[reply]

Getting Template:Update tracker working with qualifiers

I've been working on developing {{Update tracker}} and its child {{Update tracker item}}, templates for articles that use {{Wikidata}} that create a table for the talk page that lists which information needs to be updated (convenient for subjects like colleges that have a lot of data that needs updating every year).

I've gotten it mostly functional, except that I can't figure out how to get it to work with qualifiers (see the testcases). To function, it needs to call extra qualifier commands only when the |qualifier= or |qualifier-value= parameters are defined. I don't know of a way to conditionally add extra parameters, though, and keeping them blank causes an error.

Does that make sense? Anyone able to help? Sdkbtalk 14:05, 10 April 2024 (UTC)[reply]


@Sdkb: what do you mean by "there's an error" (in your testcases)? Is it an error thrown by the module or is it just the wrong data that you're getting? I suppose you tried
{{Wikidata |qualifier |single |{{{property|}}} |P585 |eid={{{entity|}}} |{{{qualifier|}}}={{{qualifier-value|}}} }}
Did you leave out the vertical bars in the last two variables? I did a quick test in your code, previewing your test cases while editing, and the previous code did return some values and no obvious errors.
I see another problem here / for Scripps College (Q10664609). This:
  • {{Wikidata|qualifier|single|eid=Q10664609|P1128|P585|P518=Q5428874}}→ 2019 (current WD value is 2019)
seems alright. However, in
  • {{Wikidata|qualifier|single|eid=Q10664609|P1128|P585}} → 2019
you'd expect the result to be 2020 (right?), but without any qualifiers the call returns the first of the two values of:
  • {{Wikidata|qualifier|eid=Q10664609|P1128|P585}} → 2019; September 2020
This would require a change on WD, another "applies to" or "rank: preferred", I believe.
Although, this does seem to work, so |qualifier= should be given with no value when there are other nonempty qualifiers for the property:
  • {{Wikidata|qualifier|single|eid=Q10664609|P1128|P585|P518=}}→ September 2020
Ponor (talk) 12:56, 10 April 2024 (UTC)[reply]
Thanks for the reply, Ponyo! The error I'm referencing came from the fact that |qualifier= and |qualifier-value= are optional, and the most simple use case (the first two test cases) leave them out. The previous code I tried removed the equal sign if they were not present, causing the template to evaluate as
{{Wikidata |qualifier |single |{{{property|}}} |P585 |eid={{{entity|}}} | }}
, where the pipe and blank parameter at the end causes it to become blank. Curiously, using your more basic method, the template evaluates as
{{Wikidata |qualifier |single |{{{property|}}} |P585 |eid={{{entity|}}} | = }}
, which I didn't even try because I presumed it would produce even more of an error, but it actually seems to cause it to work as intended. So that resolves my problem, although I don't trust that blank equals signs will always be okay for {{Wikidata}} as it evolves in the future, so if there's a more durable solution that'd be good to know about. Sdkbtalk 19:45, 10 April 2024 (UTC)[reply]
@Sdkb: glad it worked (wasnt' sure what exactly wasn't working). I don't think the blank equals sign will cause any problems; when there's nothing on its left, it should be discarded. If, however, you want to run some tests on your variables, you can try
{{#if:{{{qualifier|}}}| {{Wikidata||{{{qualifier}}}={{{qualifier-value}}}}} | {{Wikidata|}} }}
Someone more familiar with parsers and stuff might tell us if there's a better way; something tells me there has to be a hard-coded = sign, and not its replacements. Ponor (talk) 20:23, 10 April 2024 (UTC)[reply]
The same test, using the nothing-on-the-left-of-equals-sign trick:
{{Wikidata |qualifier |single |{{{property|}}} |P585 |eid={{{entity|}}} |{{#if: some function of {{{qualifier|}}} and {{{qualifier-value}}} | {{{qualifier}}} | }} = {{{qualifier-value}}} }}
Ponor (talk) 20:30, 10 April 2024 (UTC)[reply]