Jump to content

Module talk:WikidataIB/Archive 4

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Lowercase sigmabot III (talk | contribs) at 05:15, 18 January 2019 (Archiving 1 discussion(s) from Module talk:WikidataIB) (bot). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Archive 1Archive 2Archive 3Archive 4Archive 5Archive 6Archive 8

getAliases

I've added a new function to the sandbox to get the aliases for an entity. This is an expensive call if arbitrary access is used.

The function getAliases has the qid of a Wikidata entity passed as |qid= (it defaults to the associated qid of the current article if omitted), and a local parameter passed as the first unnamed parameter. It implements blacklisting and whitelisting with a field name of "alias" by default. Any local parameter passed becomes the return value, subject to the blacklisting of "alias".

It returns the aliases for the Wikidata entity with the usual list options, and nothing is returned if the aliases do not exist.

Examples and test cases are at Module talk:WikidataIB/sandbox/testing #getAliases. It may be useful for infoboxes that have an "alternative names" field. --RexxS (talk) 19:51, 14 November 2018 (UTC)

@RexxS: It definitely sounds useful! I have two requests: would it be possible to also include results from short name (P1813); and would it be possible to filter out very similar names, such as ones that differ by an accent (e.g., see Telescopio Carlos Sánchez (Q7696819)) Thanks. Mike Peel (talk) 20:30, 14 November 2018 (UTC)
@Mike Peel: At present, I've only written general calls that would be usable in any circumstance, like get a property value, get a label, or get a description, etc. I think what you're moving toward is more specialised calls that are very specific to particular purposes. I don't have a problem with that, but it will take a little more time to create something usable. What I think we will produce is larger "building blocks" for templates that will do more than just return a simple set of values. Module:WikidataIB has the routines now to create these bigger blocks while retaining the functionality that we're used to in terms of black/white-listing, sourcing, output formatting and internationalisation, so most of it is already there.
I'll have a look at the issue of filtering out "similar" names, because that's new to me, and I'm not sure what is the best algorithm to use. The question it raises is which of two similar values do we filter out? the second one we come across? or the one with diacritics? or the one without diacritics? And how should that be handled for other languages? Take an example: if we have Buhlmann, Bühlmann, and Buehmann, which one(s) do we keep? Would we make the same decision if language is set to German? --RexxS (talk) 20:58, 14 November 2018 (UTC)
Sorry, I was trying to stay general! However, there does seem to be some overlap between the aliases and the short name... With similar names, I'd go by the order that they appear on Wikidata if possible, since they seem to have a special order there (which is a lot easier to change than the property values), and they are language-specific. Thanks. Mike Peel (talk) 21:02, 14 November 2018 (UTC)
@Mike Peel: I've made Module:Diacritics containing some utility functions that can be used via #invoke or imported into other modules. It can strip diacritics from phrases or compare two phrases returning true if they are the same or differ only in diacritics (what we might call "similar"). I can use that in WikidataIB to write a new function that collects aliases and short names, then removes identical or similar names before outputting them. The question remaining is, are there any other "similar" words besides those which differ only in diacritics? Do you know of any examples? --RexxS (talk) 13:54, 17 November 2018 (UTC)

References

Would it be possible to generate citations (i.e. <ref name="-wd-Q56813023">[transcluded data]</ref>) using this module? I think this would be useful in infoboxes since Wikidata references are usually different to the sources used directly in articles. The French Wikipedia has something similar but it seems to be somewhat less developed and creates duplicates where the same source is used multiple times. {{Cite Q}} exists but it's not entirely Lua-based. Jc86035 (talk) 15:58, 17 November 2018 (UTC)

I've stayed clear of trying to generate references from Wikidata because there is simply no way of knowing what format the references in an article should be. An editor can make up their own style of reference formatting, and then CITEVAR forbids any other style of formatting. I'm simply not prepared to give more ammunition to the Wikidata-haters and infobox-haters to complain about the code that I write. You can get references using {{wd}}, of course, but I have no plans to do that in WikidataIB. --RexxS (talk) 16:55, 17 November 2018 (UTC)

I have also noted that French WP automatically creates archive links. It would help reducing the problem of linkrot here, and simplify the referencing work of en.wp editors. -- Ohc ¡digame! 11:22, 18 November 2018 (UTC)