Module talk:WikidataIB/Archive 8
This is an archive of past discussions about Module:WikidataIB. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 5 | Archive 6 | Archive 7 | Archive 8 |
Out of memory error
@RexxS, Mayankj429, and Aman.kumar.goel: I have just undone Special:Diff/971102807. It seems to cause an out of memory error (see before and after). Also the page loading time is significant in the old revision, faster in the new one. I would assume this is the memory issue. I'll leave it reverted for now, but I think people who understand this 10x more than I do need to discuss. -- Amanda (aka DQ) 18:33, 30 December 2020 (UTC)
- One possible solution: rather than fetching all property values and filtering out the last with
|list=p-1
, we can mark a single value as preferred in Wikidata (d:Help:Ranking) and use|rank=p
|maxvals=1
. From a quick test (after making the preferred value here), memory usage from that single call gets cut in half, from 8MB to 4MB. This requires keeping the preferred value up to date in Wikidata, but otherwise seems like an easy fix. Pinging Dellux mkd, who is keeping this updated in Wikidata. What do you think? — The Earwig talk 19:11, 30 December 2020 (UTC)- @AmandaNP, Dellux, and The Earwig: This call:
{{#invoke:WikidataIB|getValue|fwd=ALL|P8011|qual=P585|list=p-1|qo=1|qdf=dmy|qid=Q84055514}}
→- costs around 0.5 sec out of 10 sec and 8 MB out of 52 MB of Lua resources, which is pretty expensive for a way to get the latest date, and relies on Wikidata storing values in order. This call:
{{#invoke:WikidataIB|getValue|fwd=ALL|P8011|qual=P585|rank=b|qo=1|qdf=dmy|qid=Q84055514}}
→- costs around 0.005 sec out of 10 sec and 0.6 MB out of 52 MB of Lua resources, which is a lot cheaper but relies on the latest date being marked as preferred. Neither of these calls on their own cause an out-of-memory error, but if the editors of the article insist on having a ludicrous 383 references, then every little saving on Lua resources will help to keep the article from falling over. Without either call, the Lua memory usage of the article is still 51.7 MB out of 52.4 MB with nearly 7 sec of Lua processing time. The real solution is to get rid of the massive overcitation, and dramatically reduce the content that's available in the daughter articles per WP:SS. Otherwise, it won't be long before it falls over again. --RexxS (talk) 20:44, 30 December 2020 (UTC)
- Well, i just have to repeat what AmandaNP said and that is that i leave this discussion to people who understand this 10x more than i do. I agree with The Earwig and RexxS that we must get rid of the massive overcitation. 383 references so far is way too much and can be reduced in order too keep the article from falling. Again i must say that i leave the call to people who understand this more than i do. Dellux mkd (talk) 21:36, 30 December 2020 (UTC)
- Thanks, I'll restore the cheaper version and start nuking out some refs and maybe splitting. -- Amanda (aka DQ) 22:20, 30 December 2020 (UTC)
- @RexxS and The Earwig: While I did nuke a lot of things out of the article, me going through and removing any excess referencing seems like a monumental task compared to what we might be able to do by modifying the 15 invokes of this module. Right now, memory is:
Lua time usage: 3.419/10.000 seconds | Lua memory usage: 48,199,303/52428800 bytes
. After removing the module and replacing by hand:Lua time usage: 2.051/10.000 seconds | Lua memory usage: 28,396,497/52428800 bytes
. So if either of you can optimize anything on that page, it would be appreciated. -- Amanda (aka DQ) 14:02, 31 December 2020 (UTC)
- @RexxS and The Earwig: While I did nuke a lot of things out of the article, me going through and removing any excess referencing seems like a monumental task compared to what we might be able to do by modifying the 15 invokes of this module. Right now, memory is:
Error continues at other sections
@RexxS, The Earwig, AmandaNP, Oshwah, Dellux mkd, and Mayankj429: The "Lua error" is now present for the entire External links section as per latest version Special:Diff/999975064. Also, at COVID-19_pandemic_in_India#Testing one can see a table full of dates being displayed that is serving no logic. Please have a look and a resolution is highly appreciated. Besides this, I request to make the page temporary semi-protection due to disruptive editing by IP editors now and then. Thank you. — Amkgp 💬 18:04, 15 January 2021 (UTC)
- Oh boy. Okay, we'll take a look at it. ~Oshwah~(talk) (contribs) 19:34, 15 January 2021 (UTC)
- Someone restored the stuff I removed with this edit. -- Amanda (aka DQ) 20:53, 15 January 2021 (UTC)
- It's actually back to 10MB from the memory limit likely because of the continual increase in data from wikidata. I'm going to have to remove the values and we'll have to put it in by hand. -- Amanda (aka DQ) 21:00, 15 January 2021 (UTC)
- I took out the wikidata statements at they will be ever expanding, and WP:NOTNEWS and WP:INDISCRIMINATE. We can update the numbers manually. -- Amanda (aka DQ) 21:07, 15 January 2021 (UTC)
- The values on Wikidata were being updated without marking the latest date as preferred, so there's no way to reduce the overhead without cooperation there. I strongly recommend that we don't use Wikidata for these articles because of the time-sink involved in fixing avoidable problems. --RexxS (talk) 22:06, 15 January 2021 (UTC)
getQualValueByLang
How can I get a qualifier value by language?
I need to get the English value of the media legend (P2096) qualifier of the first value of the image (P18) statement on Douglas Adams (Q42).
--Lectrician1 (talk) 06:00, 12 February 2021 (UTC)
- Module:Wd by default gets the value in the local wiki's language, so this works for you:
{{wd|qualifier|Q42|P18|P2096}}
→ Portrait of Douglas Adams- Thayts ••• 09:20, 12 February 2021 (UTC)
Detecting same/different values in Wikidata
I would like a convenient way to detect when a locally-defined value is equal to the value on Wikidata (which would tell me I could safely remove the locally defined value) or when a locally-defined value is different to the value on Wikidata (which might indicate an error in either value). Possibilities I had in mind:
- Colouring the entire value/text green or red (respectively) if the wd value is same/different
- Adding a small icon (e.g. / ) after the value.
In both cases, they would only appear if set by an editor's personal CSS. This is not something to trouble the reader with. Thanks for consideration — Martin (MSGJ · talk) 19:46, 3 March 2021 (UTC)
Bug with checkBlacklist
{{#if:{{#invoke:WikidataIB |checkBlacklist |name=nationality |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}
→ not blacklisted — Martin (MSGJ · talk) 22:10, 15 March 2021 (UTC)
- The module is outputting "false" which is treated the same as "true" by the "if" conditional. It might be better if it just outputted blank rather than false. — Martin (MSGJ · talk) 15:42, 17 March 2021 (UTC)
- This works:
{{#ifeq:{{#invoke:WikidataIB |checkBlacklist |name=nationality |suppressfields=residence; nationality; citizenship}} | true | not blacklisted | blacklisted}}
→ blacklisted
- Shall I update the documentation, or can we change the output of "false"? — Martin (MSGJ · talk) 15:54, 17 March 2021 (UTC)
Bug?
Module:WikidataIB#Function_checkBlacklist is currently returning true for both examples, when I'm pretty sure the first is meant to return "blacklisted". {{u|Sdkb}} talk 08:56, 23 August 2021 (UTC)
- Oh, I see MSGJ raised this already and identified the issue. I'm not sure if changing to a blank output would cause any issues, but the documentation or something needs to change. {{u|Sdkb}} talk 08:58, 23 August 2021 (UTC)
Problem with caption
I'm having a problem getting the correct caption for the image. Burlington Breakwater South Light (Q109370544) has two images. The first does not have a caption but the second does.
{{wdib|maxvals=1|P18|qid=Q109370544|fwd=ALL|osd=n}}
gives me the first image, which is fine:
But
{{wdib|maxvals=1|P18|qid=Q109370544|qual=P2096|qualsonly=y|fwd=ALL|osd=n}}
is giving me the caption for the second image, which I don't want, because it doesn't match the image.
At Module talk:WikidataIB/Archive 6, Rehman suggested using the getQualifierValue function, but I can't get this to work — Martin (MSGJ · talk) 17:18, 27 November 2021 (UTC)
getting data
just found a 'fetchwikidata' entry on its own in an article infobox, the coords arg is also there but blank, the mapframe is showing, mapframe is correct, displayed coords are wrong ...
is fetchwikidata a valid template thing or should it be an argument in a wikidata template box ? I copy/pasted the whole article and I'm getting no coords, but then my sandbox wouldn't have details to copy from ...
John Whitton Bridge - User:Dave Rave/sandbox9 Dave Rave (talk) 00:13, 27 November 2021 (UTC)
- That parameter appears to be working correctly.
|fetchwikidata=
is passed to Module:WikidataIB and used as documented in this module's documentation. The infobox is fetching coordinates from the Wikidata item associated with John Whitton Bridge, displaying them, and linking to the Geohack page, which links to maps that result in a location close to the bridge. If the coordinates are incorrect in Wikidata, they will be incorrect in the Wikipedia article. – Jonesey95 (talk) 02:12, 27 November 2021 (UTC)- wikidata gps is correct, mapframe is correct, fetched gps coords are wrong Dave Rave (talk) 09:00, 28 November 2021 (UTC)
- As far as I can tell, for John Whitton Bridge, Wikidata says 33°49'23"S, 151°5'26"E and the infobox displays 33°49′S 151°05′E. When I click the coords, the Geohack page says 33°49′12″S, 151°5′24″E. The call to WikidataIB, as rendered by {{Coord}}, is a little different, and I can't explain that difference. If I use
{{coord|{{#invoke:WikidataIB|getCoords}}|display=inline|format=dms}}
directly on the page, I get the same results as the infobox (a little different). If I use {{WikidataCoord}} on the page, it displays, and links to, the Wikidata value of 33°49'23"S, 151°5'26"E. – Jonesey95 (talk) 14:34, 28 November 2021 (UTC)
- As far as I can tell, for John Whitton Bridge, Wikidata says 33°49'23"S, 151°5'26"E and the infobox displays 33°49′S 151°05′E. When I click the coords, the Geohack page says 33°49′12″S, 151°5′24″E. The call to WikidataIB, as rendered by {{Coord}}, is a little different, and I can't explain that difference. If I use
- wikidata gps is correct, mapframe is correct, fetched gps coords are wrong Dave Rave (talk) 09:00, 28 November 2021 (UTC)
Breaking changes made to live template twice
Neveselbert, please do more testing before changing this module again. The module is used in over one million pages. Your recent edit twice introduced Linter errors into more than 1,000 pages. It is possible that this indicates that a different template or module needs to be fixed before your proposed change can be reintroduced. I saw the following templates transcluded in pages that showed the error: {{Infobox software}}, {{Infobox company}}, {{Infobox drink}}, if that helps you track down the problem. – Jonesey95 (talk) 00:52, 8 December 2021 (UTC)
- @Jonesey95: I'm struggling to diagnose the problem. Can you have a look please? ‑‑Neveselbert (talk · contribs · email) 21:31, 13 December 2021 (UTC)
- I'll be happy to. Please link to pages with test cases comparing infoboxes using your proposed edit and the existing module. – Jonesey95 (talk) 21:53, 13 December 2021 (UTC)
Help with converting a wikidata call to this module
How would I convert these two {{Wikidata}} calls to use this module? I want there to only return if there is a reference. The calls:
{{wikidata|property|reference|edit|Q71483|P348|P400=Q94|P548=Q2804309}}
-> 6.6.0.13[1]{{wikidata|qualifier|Q71483|P348|P400=Q94|P548=Q2804309|P577}}
-> 25 July 2023 - the above reference covers this so this is ok{{wikidata|property|reference|edit|Q50077|P348|P548=Q2804309}}
-> 17.9.2[2] - should not return
Gonnym (talk) 10:49, 25 December 2021 (UTC)
- @Gonnym: as far as I know this module will not return references at all. It is a major weakness of this module over Module:Wikidata. It will check if statements are referenced via the onlysourced parameter, but it will not display the references. If you still want this question answered, then I will try — Martin (MSGJ · talk) 03:46, 24 February 2022 (UTC)
References
- ^ "Android: Version 6.6.0.13; Updated on Jul 25, 2023". 25 July 2023. Retrieved 18 September 2023.
- ^ "Visual Studio 2022 version 17.9.2 Release Notes". 27 February 2024. Retrieved 27 February 2024.
Only values with no end time (P582)
Is there a way to only show values with no end time (P582)? i.e. all current board members? Thank you! --Newt713 (talk) 08:55, 30 December 2021 (UTC)
- An if statement would probably work for you. Something like
#if:P582|(do nothing)|your desired output
(fake code, obviously). – Jonesey95 (talk) 13:43, 30 December 2021 (UTC)- Thanks. But how do I include the if statement into the Module? In my case i.e.
{{#invoke:WikidataIB | getValue |rank=best |P488 |name=chairperson |qid=Q896030 |fetchwikidata=ALL}}
. I can't use an if statement for the whole statement. --Newt713 (talk) 21:34, 30 December 2021 (UTC)- @Newt713: I agree it won't work in your case. I assume you are trying to fetch only the current chairperson (P488)? The usual way to deal with this is to make that statement have "preferred rank", then the rank=best option will pull that statement through. See wikidata:Help:Ranking for more details. — Martin (MSGJ · talk) 03:41, 24 February 2022 (UTC)
- @MSGJ: Thank you. That's my solution at the moment. I only think it's a bad solution, giving the inconsistent ranking data. It would be great to expand this module to allow "only current". --Newt713 (talk) 07:25, 24 February 2022 (UTC)
- @Newt713: I agree it won't work in your case. I assume you are trying to fetch only the current chairperson (P488)? The usual way to deal with this is to make that statement have "preferred rank", then the rank=best option will pull that statement through. See wikidata:Help:Ranking for more details. — Martin (MSGJ · talk) 03:41, 24 February 2022 (UTC)
- Thanks. But how do I include the if statement into the Module? In my case i.e.
Translating Wikipedia page title, or redirect page title, to QID
QID codes and PID codes make wiki code hard to understand, for example in Wikidata based tables. Ordinary users get frustated when they see the complex wiki code.
The template {{Get QID}} would potentially solve the problem, but it does not seem to take article name as argument as the documenation says. For example Q1 should result in Q1 according to the documentation.
Question 1: Why not modify the Get QID template to use {{#invoke:WikidataIB|getEntityFromTitle|...}}? For example {{#invoke:WikidataIB|getEntityFromTitle|Universe}} results in Q1. @Capankajsmilyo:
Question 2: Is there a way to make WikidataIB accept a redirected term as argument? For example {{#invoke:WikidataIB|getEntityFromTitle|Universes}} should result in Q1, but results in . The URL https://en.wikipedia.org/w/index.php?title=Universes&redirect=yes acceps redirects and works. Do we have to wait for a change of the mw.wikibase syntax? For example in mw.wikibase.getEntityIdForTitle to accept redirect=yes, or RedirectResolvingEntityLookup. Can we expect such a modification?
Tomastvivlaren (talk) 22:09, 23 February 2022 (UTC)
- Hi Tomastvivlaren! Quite a few points you have raised there.
getEntityFromTitle
is currently undocumented, and I was unaware of it till now.- I have used Module:ResolveEntityId for this purpose and it works well.
- I fully agree it would be useful if redirects were followed. I posted a request for this in June 2021 and coincidentally followed up shortly before your post here. It is definitely technically feasible because we have the functionality in Module:Redirect.
- Otherwise I am unsure how you propose to use this on Wikidata based tables. I agree that using QIDs in wikicode can look unfriendly and I have started using HTML comments in the wikitext (see List of lighthouses in Japan). But there no way to avoid using the QIDs that I can see?
- Regards — Martin (MSGJ · talk) 03:31, 24 February 2022 (UTC)
- I have now modified template:Get QID to get the QID for any Wikipedia page, based on the page title, by utilizing getEntityFromTitle in the module:WikidataIB.
- It also works if the page is moved, since it follows the redirect using Module:Redirect. Thanks for the recommendation!
- I have also used this to create {{population WD}} and {{area WD}}.Tomastvivlaren (talk) 18:28, 26 February 2022 (UTC)
- Okay. I would advise to use QIDs and advise against using labels, which are not unique! — Martin (MSGJ · talk) 20:50, 26 February 2022 (UTC)
- Well, I am not using Wikidata labels, but Wikipedia page article name. QID and PID in article wikicode makes it ugly and hard to understand, not only for non-programmers. @MSGJ: Tomastvivlaren (talk) 21:49, 26 February 2022 (UTC)
- Okay. I would advise to use QIDs and advise against using labels, which are not unique! — Martin (MSGJ · talk) 20:50, 26 February 2022 (UTC)
Possible bug fix
I'm trying to set up my own wiki, and I've been importing various templates and modules from Wikipedia. Something I imported eventually complained that this module was missing, so I imported it.
At this point I feel like I should note that I have no idea what this module is for. With that said:
After importing this module, pages that were using it then started complaining about an attempted dereference of a nil reference. I "fixed" it (on my local site), at least insofar as that those pages no longer complain, but I don't want to update the module here on Wikipedia because, like I said, I have no idea what it's for. So, in case someone more knowledgeable than me wants to check if it would be appropriate to add my change here too, what I did was insert this line at the top of function _getcommonslink:
if not mw.wikibase then return nil end
The mw.wikibase variable is dereferenced a couple lines later, which is where the error was thrown from. I hope this helps. -Rwv37 (talk) 23:24, 9 February 2022 (UTC)
- mw.wikibase is the library of functions for accessing wikibase items via Lua. It's documented here. Without that extension I cannot think how this module can do anything for you on your home wiki. — Martin (MSGJ · talk) 03:37, 24 February 2022 (UTC)
- Yeah, I eventually figured out what Wikibase is. The thing the module could do for my home wiki is exist, so as to stop other imported things from complaining about it being missing. Turns out that issues like this are all over the code, not just in Module:WikidataIB. -Rwv37 (talk) 10:15, 5 March 2022 (UTC)
How to get the latest value instead of the largest value?
This gives the largest population value:
- {{population WD|Härnösand Municipality}} -> 24,605 (2024)
- {{#invoke:WikidataIB |getValue |P1082 |qid={{GetQID|Härnösand Municipality}} |fwd=ALL |rank=p n |osd=no |sorted=yes |list=p-1 |qual=ALL}} -> 25,325 (2017)
I want it to show the newest value, which is 21,012 (2021). Is that possible using WikidataIB? Also in case all values have the same rank? Tomastvivlaren (talk) 09:41, 1 March 2022 (UTC)
- I don't think there is a function for that. You should set preferred value and then use rank=best — Martin (MSGJ · talk) 11:26, 1 March 2022 (UTC)
- {{#invoke:WikidataIB |getValue |P1082 |qid=Q209634|fwd=ALL |rank=best |osd=no |qual=ALL}} -> 24,605 (2024)
- Thnx for your good advise. I believe my current solution shows the most recently edited value (which often but not always is the newest value), if all values have the same rank:
- {{#invoke:WikidataIB |getValue |P1082 |qid=... |fwd=ALL |rank=best |osd=no |qual=ALL|list=p-1}}
- Tomastvivlaren (talk) 23:53, 10 March 2022 (UTC)
How to only show year of a numeric value?
How can I only show the year of a numeric value, for example the year for the population size of a city? Now I used the following advanced string manipulation to remove the value, which makes the script slow - it gives the error message "The time allocated for running scripts has expired" if the script is included a large number of times in the same Wikipedia page:
{{#invoke:Ustring|gsub|{{#invoke:WikidataIB |getValue |P1082 |qid=... |fwd=ALL |rank=best |osd=no |qual=P585|qdf=y|noicon=TRUE|list=p-1}}|^[%d,± ]* %((%d%d%d%d)%)|%1}}
sorted=true: by what?
I understand that |sorted=true
sorts the returned values, but I cannot see by what ordering. Eg, for quassin (Q2079986), found in taxon (P703):
- sorted=false: Picrasma crenata, Picrasma javanica, Picrasma quassioides, Quassia africana, Quassia amara, Samadera indica dflt
- sorted= true: Quassia africana, Picrasma crenata, Picrasma javanica, Picrasma quassioides, Quassia amara, Samadera indica
- So, true-results have unexpected order IMO. (Incidentally, the itempage has/shows alphabetical order).
DePiep (talk) 13:26, 26 September 2022 (UTC)
- Does it have to do with wikilinked/unlinked? If so, by some rationale or because of code like "[[..."? DePiep (talk) 13:28, 26 September 2022 (UTC)
- @DePiep From the doc page/comments:
It's only a very dumb alphabetical sort and sorts linked values as "[[ ..."
. So a literal alphabetical sort that doesn't break up links to sort by label. That seems to match your example as well. -- ferret (talk) 13:30, 26 September 2022 (UTC)- Thanks; makes me feel good having the question right ;-)
- Consider answered. DePiep (talk) 13:38, 26 September 2022 (UTC)
- @DePiep From the doc page/comments:
getWebsite error
I think there is an error in the getWebsite function. If there is no wikidata item corresponding to the current page then it will not even display the locally defined parameter. That prevents it being tested properly on talk pages and testcases.
{{#invoke:WikidataIB|getWebsite|url=www.google.com}}
currently produces: [www.google.com www
— Martin (MSGJ · talk) 06:36, 3 October 2022 (UTC)
- @MSGJ
Which infobox? This may be a template-level issue.Nevermind I'm dumb, I missed your example because it's literally blank :) Taking a glance... -- ferret (talk) 14:20, 3 October 2022 (UTC) - @MSGJ The culprit is the line
if not qid then return nil end
. If the page has no qid, the function ends early. I think this should probably be something likeif not qid and not url then return nil end
. That should allow it to continue if a locally defined url is set. -- ferret (talk) 14:29, 3 October 2022 (UTC)- Yes I agree. Was just checking in case I'd missed something silly. This function is not really documented. — Martin (MSGJ · talk) 15:41, 3 October 2022 (UTC)
- I've got some code which seems to work in Module:WikidataIB/sandbox — Martin (MSGJ · talk) 14:35, 4 October 2022 (UTC)
- Deployed — Martin (MSGJ · talk) 16:10, 6 October 2022 (UTC)
How to add references
Is there a way to show references? {{wikidata}} has this nice option:
{{wikidata|properties|linked|references|normal+|Q18216|P703}}
- → liquorice,[1] Ixora coccinea[2]
But afaik it is less controllable. Some live examples in infoboxes? -DePiep (talk) 14:48, 26 September 2022 (UTC)
References
- ^ L A Mitscher; Y H Park; D Clark; J L Beal (March 1980). "Antimicrobial agents from higher plants. Antimicrobial isoflavanoids and related substances from Glycyrrhiza glabra L. var. typica". Journal of Natural Products. 43 (2): 259–269. doi:10.1021/NP50008A004. ISSN 0163-3864. PMID 7381508. Wikidata Q71214999.
- ^ Chia-Lin Lee; Yung-Chih Liao; Tsong-Long Hwang; Chin-Chung Wu; Fang-Rong Chang; Yang-Chang Wu (December 2010). "Ixorapeptide I and ixorapeptide II, bioactive peptides isolated from Ixora coccinea". Bioorganic & Medicinal Chemistry Letters. 20 (24): 7354–7357. doi:10.1016/J.BMCL.2010.10.058. ISSN 0960-894X. PMID 21106454. Wikidata Q39627968.
DePiep (talk) 14:48, 26 September 2022 (UTC)
- As far as I know, this module was never designed to produce references. It would be nice to produce well formatted references. I think it will be quite challenging to match an existing citation style on an article. — Martin (MSGJ · talk) 15:11, 26 September 2022 (UTC)
- Ouch. This hurts... Thx. DePiep (talk) 18:57, 26 September 2022 (UTC)
- Oh, thank you for opening this discussion @DePiep!
- In case we manage to combine both, I opened the mirror version here:
- https://en.wikipedia.org/wiki/Module_talk:Wd#Add_a_'maxvals'_option_as_in_https://en.wikipedia.org/wiki/Module:WikidataIB AdrianoRutz (talk) 08:43, 7 October 2022 (UTC)
- OK, thx. Other issues in here: reference formatting (& omitting when maxval is used). Bottleneck in moving fwd is time here; sub-ideal solutions in mind. DePiep (talk) 08:50, 7 October 2022 (UTC)
Using "unknown value" in queries
Is there any way to query items with "unknown value" in their statemennts?
For example:
{{#invoke:WikidataIB |getQualifierValue |qid=Q104417487 |P4032 |pval="Unknown"|qual=P585 |name=xyz |fetchwikidata=ALL |onlysourced=no |noicon=true |df=YMD}}
Should return the date "29 October 2022" from the item wikidata:Q104417487. T.Shafee(Evo&Evo)talk 11:36, 2 November 2022 (UTC)
- @Evolution and evolvability: I recall last night that if I entered "anonymous"[1] as the author name, the "add this statement to wikidata" button disappears. OhanaUnitedTalk page 13:39, 2 November 2022 (UTC)
- That's becaues the current v:Template:Review_info template uses the query:
{{#invoke:WikidataIB |getQualifierValue |qid=Q104417487 |P4032 |pval=Q4233718|qual=P585 |name=xyz |fetchwikidata=ALL |onlysourced=no |noicon=true |df=YMD}}
- What I'm hoping to do is change it over to:
{{#invoke:WikidataIB |getQualifierValue |qid=Q104417487 |P4032 |pval="Unknown"|qual=P585 |name=xyz |fetchwikidata=ALL |onlysourced=no |noicon=true |df=YMD}}
- so that the "unknown value" special value can be used on the wikidata items, because that's where the community seems to be moving for indicating statements about anonymous peer reviewers.
- The module seems to have some ability to understand "unknown value" statements because this query:
{{#invoke:WikidataIB |getValue |qid=Q104417487 |P4032 |name=xyz |fetchwikidata=ALL |onlysourced=no |noicon=true }}
- returns:
Ken Winters, Unknown
- It just needs to be extended from the getValue function to the getQualifierValue function. T.Shafee(Evo&Evo)talk 02:46, 3 November 2022 (UTC)
- @Evolution and evolvability: If you absolutely need to query for unknown values, use
{{#invoke:WikidataIB/sandbox |getQualifierValue |qid=Q104417487 |P4032 |pval=Unknown|qual=P585 |name=xyz |fetchwikidata=ALL |onlysourced=no |noicon=true |df=YMD}}
LennardHofmann (talk) 09:45, 4 November 2022 (UTC)- If using Module:Wd is an option, please use
{{wikidata|qualifier|raw|Q104417487|P4032|_|P585}}
instead. LennardHofmann (talk) 09:51, 4 November 2022 (UTC)- @LennardHofmann - oh good idea! I always forget about that module (tbh, I'm still a little hazy on the main differences between it and this one). Anyway, the template v:Template:Review_info now works again to first to detect whether a wikidata item has an anon peer reviewer (P4032="unknown value") and if not, adds one via quickstatements. T.Shafee(Evo&Evo)talk 05:40, 11 November 2022 (UTC)
- If using Module:Wd is an option, please use
- @Evolution and evolvability: If you absolutely need to query for unknown values, use
- That's becaues the current v:Template:Review_info template uses the query:
Pulling structured data from Commons
Is there an equivalent to this module to retrieve structured data from a file on wikimedia commons? E.g. this file should have P275 = Q20007257. Any ideas? T.Shafee(Evo&Evo)talk 06:29, 10 March 2023 (UTC)
value instead of Qid in qvalue
With module Wd it's possible to do this (for total revenue in d:Q30288051):
- {{#invoke:Wd|property|eid=Q30288051|P2139|P585=2017}} → 1,993,978 United States dollar
but module WikidataIB only takes qualifier ID for qvalue so the following does not work
- {{#invoke:WikidataIB |getValueByQual |qid=Q30288051 |P2139 |qualID=P585 |qvalue=2017}} →
Is there a way to use any value, like in module Wd? Ponor (talk) 18:00, 2 June 2023 (UTC)
- @Ponor: There is a comment in the code that says "We'll only deal with wikibase-items and strings for now". Checking whether a given date string (e.g. "2017") matches a Wikidata time value is non-trivial, so I don't expect that getValueByQual will support the
time
datatype any time soon. LennardHofmann (talk) 18:59, 2 June 2023 (UTC)