Module:Wikidata/doc: Difference between revisions

Content deleted Content added
I have time travelled!
Tags: Reverted Mobile edit Mobile web edit
consistency
 
(9 intermediate revisions by 5 users not shown)
Line 1:
{{Ombox|image=[[ImageFile:Stop hand nuvola.svg|40px]]|type=delete|text=[[Module:Wikidata]] is [[deprecation|deprecated]]. Please use [[Module:WikidataIB]] or [[Module:Wd]] instead.}}
{{module rating|protected}}
{{High-use}}
Line 37:
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:
* <code><nowiki>{{#invoke:Wikidata|getValueFromID|Q151973{{Get QID|Richard Burton (actor) }}|P26|FETCH_WIKIDATA}}</nowiki></code>
will fetch a list of the linked values for 'spouse' (P26) from 'redirect page title [[Richard Burton' (Q151973actor) ]] (corresponding to Wikidata label {{Q|{{Get QID|Richard Burton (actor) }}}}) from anywhere in the English Wikipedia.
 
This means that testing environments may be set up in user space, but remember that these calls are classed as ''expensive'', so please use them as sparingly as possible.
Line 58:
* <code><nowiki>| data55 = {{#invoke:Wikidata|getValue|P26|{{{spouse|FETCH_WIKIDATA}}} }}</nowiki></code>
which causes the infobox to:
# not display spouse if the infobox parameter <code>|spouse</code> is set to be blank (as <code>"| spouse ="</code>})
# display the linked value(s) from Wikidata if the infobox parameter <code>|spouse</code> is not supplied
# display the local infobox parameter <code>|spouse</code> if it is supplied (e.g. <code>"|spouse = Hillary Rodham Clinton"</code>)
Line 110:
=== Testing spouse ===
Copy and paste the following into any article and preview it (please don't save!):
<syntaxhighlight lang="moinwikitext">
* - {{#invoke:Wikidata|getValue|P26|}}
* - {{#invoke:Wikidata|getValue|P26|FETCH_WIKIDATA}}
Line 141:
=== Testing birthplace ===
Copy and paste the following into any article and preview it (please don't save!):
<syntaxhighlight lang="moinwikitext">
* - {{#invoke:Wikidata|getValue|P19|}}
* - {{#invoke:Wikidata|getValue|P19|FETCH_WIKIDATA}}
Line 150:
=== Testing getValue, getRawValue and getDateValue ===
Copy and paste the following into any article and preview it (please don't save!):
<syntaxhighlight lang="wikitext">
<pre>
* - {{#invoke:Wikidata|getValue|P19|FETCH_WIKIDATA}}
* - {{#invoke:Wikidata|getValue|P26|FETCH_WIKIDATA}}
Line 159:
* - {{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|mdy}}
* - {{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y}}
</syntaxhighlight>
</pre>
This should return the Wikidata values for birthplace, spouse, citizenship, religion, gender, date of birth (twice) and year of birth, if they exist. The dob is first in dmy format and then in mdy.
 
=== Testing dates BC/BCE ===
Copy and paste the following into a short section of article such as [[Horace #See also]] and preview it (please don't save!):
<syntaxhighlight lang="wikitext">
<pre>
* - {{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y}}
* - {{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y|BCE}}
</syntaxhighlight>
</pre>
This should return 65 BC and 65 BCE, respectively.
 
Line 176:
[[Category:Wikidata modules]]
[[Category:Modules using data from Wikidata]]
}}</includeonly>fetch_wikidata