Jump to content

Module:Wikidata/doc

Gikan sa Wikipedia, ang gawasnong ensiklopedya

This is the documentation page for Module:Wikidata

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

A copy is available on test Wikidata

Functions callable from Lua

[usba ang wikitext]

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

  • item (required): its Qid
  • property (required) property that the claims should have
  • withqualfier = qualifiers that the statement should have
  • withrank = rank of the statement ; 'preferred', 'normal', 'deprecated' or 'valid' (ie normal and preferred). By default = preferred.
  • sourceproperty = this property should be used in the source
  • source = the source that should be provided in the statement (if sourceproperty is not provided, the property used is p248)
  • excludespecial = set to true if you do not want to get "novalue" and "somevalue".
  • numval = if you want to set a maximum number of values to be returned
  • sorttype = set to "chronological" to get the statements in chronological order using the p. 580, p. 582 and p. 585 qualifiers. Set to "inverrted for chronological order. From a Lua module, you can also define your own sorting criteria.
  • showsource = set to "true" if you want the source of the statement to be displayed.

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
  • format = the format in which the args should be returned. For example, for a string-type property displayformat = "weblink" returns a formatted weblink.
  • conjtype = the conjunction separating the statements. For example, conj = '<br />, will make a new linke between each statement.
  • showqualifier = 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

[usba ang 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.