Module:Wikidata/doc: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 2:
This module is a modification of the original at [[Module:Sandbox/Tom Morris]] which was created 19 May 2013.
 
== Methods ==
The module "{{BASEPAGENAME}}" contains:
*The amodule call"{{BASEPAGENAME}}" (getValue)contains the following methods, that allowsallow the calling script to retrieve the value(s) of any type (wiki-linked, if possible) for any property from Wikidata by supplying the property ID as the first parameter.:
* <tt>getValue</tt>: Returns wiki-linked values, if applicable. All other values with be output like <tt><nowiki>{{#property:}}</nowiki></tt>.
* a call (getRawValue) that allows the calling script to retrieve the non-linked value(s) for any property from Wikidata by supplying the property ID as the first parameter.
* <tt>getRawValue</tt>: Returns non-linked property values and numbers with the thousand separator. All other values with be output like <tt><nowiki>{{#property:}}</nowiki></tt>.
* a call (<tt>getDateValue)</tt>: thatSpecial allows the calling scriptmethod to retrievereturn theformatted datedates. value(s) for any property from Wikidata by supplying the property ID as the first parameter.The Defaultefault date format is [day month year]; an optional third parameter can be added for other date formats: for [month day, year], add "mdy"; for [month year], add "my"; for year only, add "y".
 
For each of these, Wikidata qualifier values (if present) can be retrieved by using getQualifierValue (only wiki-linked values), getRawQualifierValue,the orfollowing getQualifierDateValue.methods:
* <tt>getQualifierValue</tt>: returns only wiki-linked values, if applicable.
* <tt>getRawQualifierValue</tt>: returns non-linked values
* <tt>getQualifierDateValue</tt>: returns formatted dates
 
If the property is not defined in Wikidata for the article that invokes this code, then an empty string ("") is returned.