scribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-locationscribunto-lua-error-location Modulo:Wikidata/doc - Tematiche di genere

Modulo:Wikidata/doc

Versione del 15 ago 2018 alle 17:32 di wiki>Realworldobject (Fixed typo)
(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)

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}} Modulo:Wikidata:727: attempt to index field 'wikibase' (a nil value) Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q42)
{{#invoke:Wikidata|getLabel|entity=Q42|link=wikipedia}} Modulo:Wikidata:727: attempt to index field 'wikibase' (a nil value)
{{#invoke:Wikidata|getLabel|entity=Q42|link=-}} Modulo:Wikidata:727: attempt to index field 'wikibase' (a nil value)
{{#invoke:Wikidata|getLabel|entity=Q42|link=wikipedia|lang=ja}} Modulo:Wikidata:727: attempt to index field 'wikibase' (a nil value)
{{#invoke:Wikidata|getLabel|entity=Q42|link=wikidata}} Modulo:Wikidata:727: attempt to index field 'wikibase' (a nil value)
{{#invoke:Wikidata|getLabel|entity=Q42|link=wikidata|lang=ja}} Modulo:Wikidata:727: attempt to index field 'wikibase' (a nil value)
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p31}} Errore script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q42) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P31)
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p31|lang=ja}} Errore script: la funzione "formatStatementsE" non esiste.
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p569}} Errore script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q42) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P569)
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p569|lang=ja}} Errore script: la funzione "formatStatementsE" non esiste.
{{#invoke:Wikidata|formatStatementsE|item=Q42|property=p569|displayformat=raw}} Errore script: la funzione "formatStatementsE" non esiste.
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186}} Errore script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q12418) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P186)
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|displayformat=raw}} Errore script: la funzione "formatStatementsE" non esiste.
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|lang=ja}} Errore script: la funzione "formatStatementsE" non esiste.
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|rank=valid}} Errore script: la funzione "formatStatementsE" non esiste. rank = "valid" accepts both "preferred" and "normal" values
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|numval=1}} Errore script: la funzione "formatStatementsE" non esiste. 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 script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q12418) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P186) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P518) should only display values that have a p518 qualifier
{{#invoke:Wikidata|formatStatementsE|item=Q12418|property=p186|showqualifiers=p518}} Errore script: la funzione "formatStatementsE" non esiste. 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 script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q83259) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P669) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (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 script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q12418) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P276) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P854)
{{#invoke:Wikidata|formatStatementsE|item=Q11879536|property=P460|withsource=Q1645493}} Errore script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q11879536) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P460) Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q1645493)
{{#invoke:Wikidata|formatStatementsE|item=Q11879536|property=P460|withsource=Q1645493|showsource=true}} Errore script: la funzione "formatStatementsE" non esiste.
{{#invoke:Wikidata|formatStatementsE|item=Q153|property=P231|showsource=true}} Errore script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q153) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P231)
{{#invoke:Wikidata|formatStatementsE|item=Q205309|property=P793|sorttype=inverted}} Errore script: la funzione "formatStatementsE" non esiste. Errore Lua in Modulo:Wd alla linea 196: attempt to index field 'wikibase' (a nil value). (Q205309) Errore Lua in Modulo:Wikidata_label alla linea 265: attempt to index field 'wikibase' (a nil value). (P793)

See also