Modulo:Wikidata/doc

Da Tematiche di genere.
Versione del 15 ago 2018 alle 17:32 di wiki>Realworldobject (Fixed typo)
(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)
Vai alla navigazione Vai alla ricerca

Module permitting basic data retrieval from items. It is mostly useful for other modules or for {{Data}}

A copy is available on test Wikidata

Functions callable from Lua

p.getClaims returns claims in a particular item that match a particular query

p.formatStatements(args): returns a string containing the statements given in the table args. Same keys as getClaims, plus formatting arguments:

  • lang (required) for the desired language
  • displayformat = the format in which the args should be returned. For example, for a string-type property displayformat = "weblink" returns a formatted weblink.
  • conj = the conjunction separating the statements. For example, conj = '<br />' will make a new line between each statement.
  • showqualifiers = the qualifiers that should be shown along with the mainsnak value

p.getLabel get the label of an entity

  • entity = entity ID with its Q or P
  • lang

Functions callable from wikitext

  • p.formatStatementsE same as p.formatStatements, except that "lang" is not required. It is most conveniently used from {{Data}} that takes exactly the same arguments.
  • p.getLabel get the label of an entity

Examples

Code Render Comment
{{#invoke:Wikidata|getLabel|entity=Q42}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q42)
{{#invoke:Wikidata|getLabel|entity=Q42|link=wikipedia}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|getLabel|entity=Q42|link=-}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|getLabel|entity=Q42|link=wikipedia|lang=ja}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|getLabel|entity=Q42|link=wikidata}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|getLabel|entity=Q42|link=wikidata|lang=ja}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p31}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q42) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P31)
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p31|lang=ja}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p569}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q42) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P569)
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p569|lang=ja}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p569|displayformat=raw}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q12418) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P186)
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|displayformat=raw}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|lang=ja}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|rank=valid}} Errore Lua: errore interno - l'interprete è uscito con stato 1. rank = "valid" accepts both "preferred" and "normal" values
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|numval=1}} Errore Lua: errore interno - l'interprete è uscito con stato 1. returns the number of values numval (priority to those with "rank= preferred", if there are not enough of them, also accepts "rank = normal")
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|qualifier=p518}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q12418) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P186) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P518) should only display values that have a p518 qualifier
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|showqualifiers=p518}} Errore Lua: errore interno - l'interprete è uscito con stato 1. shows the value of the p518 qualifier (if any) in addition to the main value
{{#invoke:Wikidata|formatStatementsE|item=Q83259|property=p669|showqualifiers=p670|delimiter=&#32;}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q83259) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P669) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P670) shows the value of the P670 qualifier (if any) in addition to the main value separated by a space
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=P276|sourceproperty=P854}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q12418) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P276) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P854)
{{#invoke:Wikidata|formatStatementsE|item=Q11879536|property=P460|withsource=Q1645493}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q11879536) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P460) Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q1645493)
{{#invoke:Wikidata|formatStatementsE|item=Q11879536|property=P460|withsource=Q1645493|showsource=true}} Errore Lua: errore interno - l'interprete è uscito con stato 1.
{{#invoke:Wikidata|formatStatementsE|item=Q153|property=P231|showsource=true}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q153) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P231)
{{#invoke:Wikidata|formatStatementsE|item=Q205309|property=P793|sorttype=inverted}} Errore Lua: errore interno - l'interprete è uscito con stato 1. Errore Lua: errore interno - l'interprete è uscito con stato 1. (Q205309) Errore Lua: errore interno - l'interprete è uscito con stato 1. (P793)

See also