Vés al contingut

Tema de Usuari Discussió:Vriullop/Fitxer de Discussions Estructurades 1

Sami At Ferḥat (discussiócontribucions)

Hello Vriullop,

I have a question concerning the main function of the Wikidata module, why did you disallow calling the function claim from a content page?

Vriullop (discussiócontribucions)

It is a bad practice to invoke a module from an article instead of using a template. In the first steps developing this module I found it difficult to change the syntax of the arguments when it is invoked directly. It is easy to modify a template but you need a bot to modify all the articles invoking the module. Anyway, once the module is stable this restriction is not required. Has it caused any problem?

Sami At Ferḥat (discussiócontribucions)

Thanks for the explanation, I just asked the question out of curiosity.

Since your are the author of the module, could you please review my modifications on the kab wiki here. I mainly modified the function getParentValues:

  • Ability to pass an id label (uptolabelid) instead of a text value (upto).
  • Ability to pass an id link (uptolinkid).
  • Sometimes the label is nil while the link text is not; so it stopped lopping. I removed that restriction.
  • Ability to pass a list of properties to the parameter property.

Examples

  • Infobox language (see result in kab:Takatalant): {{#invoke:Wikidata|getParentValues|property=P279|uptolinkid=Q25268 Q721612 Q37845 Q32940 Q33199 Q49228 Q33311 Q25946 Q25946 Q33322 Q19860 Q33614 Q26986 Q33838 Q33705 Q33909 Q236425 Q34228 Q45961 Q34171 Q34113 Q34073 Q33612 Q34090 Q33750 Q34230 Q11263525 Q27969 Q34070|sorting=-1|rowformat=$1|cascade=true|include_self=true}}
  • Infobox religion (see result in kab:Taciɛit ): {{#invoke:Wikidata|getParentValues|property=P279 P361|uptolinkid=Q9174|sorting=-1|rowformat=$1|cascade=true|include_self=true}}

It's the first time in my life coding with a scripting language (especially without an IDE), so please do not look at the shameful history of the page.

Vriullop (discussiócontribucions)

I'll look at your code later, maybe in a week, currently I'm too busy. In the meantime I ping Amadalvarez if he wants to look at use cases of new functions for getParentValues. At a first glance it makes sense to me, to manage parent values through ids instead of labels.

Sami At Ferḥat (discussiócontribucions)

I also have another question: Is it possible to use SPARQL in a wiki module?

It'd be helpful to get child values (subspecies of species, dialects of a language...etc.). The wikidata property has part is most of the time empty.

Vriullop (discussiócontribucions)

By now it is not posible to make SPARQL queries with Scribunto. It is in the whishlist, for example phab:T185313, but I'm afraid it will be expensive.

Vriullop (discussiócontribucions)

Hi, Sami, good work. I've only made minor changes of syntax. I'll include your code in the copy at ca.wiki, but I prefer to avoid another dependency with Module:LuaLinq. When I have some time, I'll update your module with new versions on ca.wiki with some improvements for efficiency.

Sami At Ferḥat (discussiócontribucions)

Thanks Vriullop,

I've removed the dependency to LuaLinq (it was not really necessary there, but I heavily use on another module).

I've also added a new parameter (case (grammatical)) to the getParentValues function.

Each modification has its own edit in the page history.

Vriullop (discussiócontribucions)

Great.

I have some questions about your language, I work also on Wiktionary. I found a Catalan-Amazigh dictionary. It is about Northern Amazigh as a macrolanguage, for example the entry pare (father) translates baba as a general form and ibba as Kabyle (QBYL). Can I trust this dictionary? Can I use baba for Tashelhit, Central Atlas Tamazight and Tarifit, and ibba for Kabyle? Is the Tifinagh script, or Neo-Tifinagh, used for these languages?

Sami At Ferḥat (discussiócontribucions)

In Kabyle it's not ibba, it's baba.

I had a look at the website, the dictionary seems to be based on the Shilha language (+ they use tifinagh script and don't mark the schwa letter). There's another pan-amazigh dictionary but kabyle based, the entry for father is baba.

As for the entry ibba, it says that this word is found in central morocco (Kelaat-M'Gouna...etc.)

I think the first website copied data from the second without reading the Nota Bene and assumed it was Kabyle.

Vriullop (discussiócontribucions)

I chose this page at random but it confirms my suspicions that this dictionary should be taken with caution. Thanks.

Sami At Ferḥat (discussiócontribucions)

Vriullop,

Sorry to bother you for another lua question (but you're the expert ^^), it's just 3 lines of codes, is this the right way to project a dictionary into an array/list of values in lua?

local values = {} for _, v in ipairs(dictionary) do table.insert(values, v) end

It looks ugly and verbose.

Sami.

Vriullop (discussiócontribucions)

Hi, I'm not an expert. I made my first program in the 80s and now in my retirement I'm just playing with Lua and I'm happy to help if I can.

It looks really ugly, but it is only needed when converting it to a string. Use callParserFunction instead without any convertion: return f:callParserFunction('#babel', f.args)

Sami At Ferḥat (discussiócontribucions)

Hello Vriullop, I'm back to you after a year :/ I've seen that you've integrated the "cascade mode", I'm so honored! On mobile phone, it does not render well, I've fixed it with this edit . It uses ul li instead of " •" (But you can no longer use a separator, it's reset to string.Empty). Example: .

Resposta a «Module:Wikidata»