Jump to content

Module talk:WikidataIB

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MSGJ (talk | contribs) at 06:36, 3 October 2022 (getWebsite error: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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}}

Tomastvivlaren (talk) 00:06, 11 March 2022 (UTC)[reply]

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 Edit this on Wikidata dflt
sorted= true: Quassia africana, Picrasma crenata, Picrasma javanica, Picrasma quassioides, Quassia amara, Samadera indica Edit this on Wikidata
So, true-results have unexpected order IMO. (Incidentally, the itempage has/shows alphabetical order).

DePiep (talk) 13:26, 26 September 2022 (UTC)[reply]

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)[reply]
@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)[reply]
Thanks; makes me feel good having the question right ;-)
Consider answered. DePiep (talk) 13:38, 26 September 2022 (UTC)[reply]

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)[reply]

References

  1. ^ 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.
  2. ^ 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)[reply]

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)[reply]
Ouch. This hurts... Thx. DePiep (talk) 18:57, 26 September 2022 (UTC)[reply]

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.google.com]

— Martin (MSGJ · talk) 06:36, 3 October 2022 (UTC)[reply]