Module:Wikidata/doc: Difference between revisions

Content deleted Content added
update documentation
Methods: update documentation
Line 24:
* <tt>getSiteLink</tt>: gets name of a page in given in argument wiki (like enwikiquote for English Wikiquote).
* <tt>Dump</tt>: spies the structured data. It uses the same arguments as ViewSomething. Try this with preview only to see results. That helps you a lot in developing Lua scripts that access the data. If used without arguments, it dumps everything including labels, descriptions, references and interwiki links. See [https://en.wikipedia.org/w/index.php?title=Module_talk%3AWikidata&diff=652812891&oldid=650633541#Is_it_possible_to_get_value.28s.29_in_structured_tree_by_this_Module.3F]
* <kbd>getImageLegend </kbd>: returns an image legend (image is property P18; image legend is property P2096).
 
*: Call as <code><nowiki>{{#invoke:Wikidata |getImageLegend | <PARAMETER> | lang=<ISO-639code> |id=<QID>}}</nowiki></code>
*: Returns PARAMETER, unless it is equal to "FETCH_WIKIDATA", from Item QID (expensive call). If QID is omitted or blank, the current article is used (not an expensive call). If lang is omitted, it uses the local wiki language, otherwise it uses the provided ISO-639 language code.
*: The label is returned from the first image with 'preferred' rank; or from the first image with 'normal' rank if no image has preferred rank.
 
=== Arbitrary Access ===
As of 16 September 2015, it is now possible to fetch data from other articles by using their QID.
The following call:
* <code><nowiki>{{#invoke:Wikidata|getValueFromID|<QID>|<Property>|FETCH_WIKIDATA}}</nowiki></code>
will do the same as getValue, but takes an extra parameter, which is the QID of the Wikidata item that you want to get the property value from.
For example: