<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.americanmusicclub.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=134.134.137.73</id>
	<title>The Official Website for Mark Eitzel &amp; American Music Club - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.americanmusicclub.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=134.134.137.73"/>
	<link rel="alternate" type="text/html" href="https://wiki.americanmusicclub.com/wiki/Special:Contributions/134.134.137.73"/>
	<updated>2026-04-05T08:48:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.7</generator>
	<entry>
		<id>https://wiki.americanmusicclub.com/index.php?title=Module:Wikidata/doc&amp;diff=19073</id>
		<title>Module:Wikidata/doc</title>
		<link rel="alternate" type="text/html" href="https://wiki.americanmusicclub.com/index.php?title=Module:Wikidata/doc&amp;diff=19073"/>
		<updated>2015-02-08T12:13:39Z</updated>

		<summary type="html">&lt;p&gt;134.134.137.73: remove sandbox&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{module rating|alpha}}&lt;br /&gt;
This module is a modification of the original at [[Module:Sandbox/Tom Morris]] which was created 19 May 2013.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
The module &amp;quot;{{BASEPAGENAME}}&amp;quot; contains the following methods, that allow the calling script to retrieve the value for any property from Wikidata by supplying the property ID as the first parameter:&lt;br /&gt;
* &amp;lt;tt&amp;gt;getValue&amp;lt;/tt&amp;gt;: Returns wiki-linked values, if applicable. All other values with be output like &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{#property:}}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;, regardless of their rank.&lt;br /&gt;
* &amp;lt;tt&amp;gt;getRawValue&amp;lt;/tt&amp;gt;: Returns non-linked property values and numbers with the thousand separator. All other values with be output like &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{#property:}}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* &amp;lt;tt&amp;gt;getDateValue&amp;lt;/tt&amp;gt;: Special method to return formatted dates. The default date format is [day month year]; an optional third parameter can be added for other date formats: for [month day, year], add &amp;quot;mdy&amp;quot;; for [month year], add &amp;quot;my&amp;quot;; for year only, add &amp;quot;y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Wikidata qualifier values (if present) can be retrieved by the following methods:&lt;br /&gt;
* &amp;lt;tt&amp;gt;getQualifierValue&amp;lt;/tt&amp;gt;: returns only wiki-linked values, if applicable.&lt;br /&gt;
* &amp;lt;tt&amp;gt;getRawQualifierValue&amp;lt;/tt&amp;gt;: returns non-linked values&lt;br /&gt;
* &amp;lt;tt&amp;gt;getQualifierDateValue&amp;lt;/tt&amp;gt;: returns formatted dates&lt;br /&gt;
&lt;br /&gt;
If the property is not defined in Wikidata for the article that invokes this code, then an empty string (&amp;quot;&amp;quot;) is returned.&lt;br /&gt;
&lt;br /&gt;
Other methods:&lt;br /&gt;
* &amp;lt;tt&amp;gt;pageId&amp;lt;/tt&amp;gt;: returns the Wikidata id (Q…) of the current page or nothing if the page is not connected to Wikidata&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
* For the generalized case (getValue), two unnamed parameters are supplied. The first is the ID of the property that is to be retrieved (e.g. P19 for birthplace or P26 for spouse). The second may be null, &amp;quot;FETCH_WIKIDATA&amp;quot;, or any other string, which becomes the returned value.&lt;br /&gt;
* For the generalized unlinked case (getRawValue), two unnamed parameters are supplied. The first is the ID of the property that is to be retrieved (e.g. P21 for gender). The second may be null, &amp;quot;FETCH_WIKIDATA&amp;quot;, or any other string, which becomes the returned value.&lt;br /&gt;
* For the generalized date case (getDateValue), three unnamed parameters are supplied. The first is the ID of the property that is to be retrieved (e.g. P569 for date of birth). The second may be null, &amp;quot;FETCH_WIKIDATA&amp;quot;, or any other string, which becomes the returned value. The third is the format that the date should be returned in, either dmy, mdy, my, or y.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
=== Example:spouse ===&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getValue|P26|}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; = returns nothing, so suppresses the display of spouse in an infobox&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getValue|P26|FETCH_WIKIDATA}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; = returns the linked value(s) of property P26 (spouse) stored in wikidata for the corresponding article (e.g. for article [[Bill Clinton]], it returns [[Hillary Rodham Clinton]])&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getValue|P26|[[Hillary Clinton]]}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; = returns [[Hillary Clinton]], allowing an infobox to use a local value rather than the value stored in Wikidata.&lt;br /&gt;
&lt;br /&gt;
=== Example in Infobox template ===&lt;br /&gt;
Inside an infobox definition, it may be called like this:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;| data55 = {{#invoke:Wikidata|getValue|P26|{{{spouse|FETCH_WIKIDATA}}} }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
which causes the infobox to:&lt;br /&gt;
# not display spouse if the infobox parameter &amp;lt;code&amp;gt;|spouse&amp;lt;/code&amp;gt; is set to be blank (as &amp;lt;code&amp;gt;&amp;quot;| spouse =&amp;quot;&amp;lt;/code&amp;gt;}&lt;br /&gt;
# display the linked value(s) from Wikidata if the infobox parameter &amp;lt;code&amp;gt;|spouse&amp;lt;/code&amp;gt; is not supplied&lt;br /&gt;
# display the local infobox parameter &amp;lt;code&amp;gt;|spouse&amp;lt;/code&amp;gt; if it is supplied (e.g. &amp;lt;code&amp;gt;&amp;quot;|spouse = Hillary Clinton&amp;quot;&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Optionally, it could be called as:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;| data55 = {{#invoke:Wikidata|getValue|P26|{{{spouse|}}} }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
which should behave as the parameter does now, unless the parameter is set to FETCH_WIKIDATA when it displays the linked value(s) fetched from Wikidata.&lt;br /&gt;
&lt;br /&gt;
=== Example:birth place ===&lt;br /&gt;
This works in just the same way as the calls above:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getValue|P19|}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; = returns nothing, so suppresses the display of birth place in an infobox&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getValue|P19|FETCH_WIKIDATA}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; = returns the linked value(s) of property P19 (place of birth) stored in wikidata for the corresponding article (e.g. for article [[Bill Clinton]], it returns [[Hope, Arkansas]])&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getValue|P19|[[Hope, Arkansas|Hope]]}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; = returns [[Hope, Arkansas|Hope]], allowing an infobox to use a local value rather than the value stored in Wikidata.&lt;br /&gt;
&lt;br /&gt;
=== Example:gender ===&lt;br /&gt;
We don&#039;t want the returned value linked, so use:&lt;br /&gt;
* - &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getRawValue|P21|FETCH_WIKIDATA}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example:date of birth ===&lt;br /&gt;
If we want the date of birth in dmy format, we use:&lt;br /&gt;
* - &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|dmy}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we want the date of birth in mdy format, we use:&lt;br /&gt;
* - &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|mdy}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example: Linking to Wikidata item ===&lt;br /&gt;
Use the following code to just retrieve the Q-ID:&lt;br /&gt;
* - &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Wikidata|pageId}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Linking to Wikidata used the usual Wiki markup:&lt;br /&gt;
* - &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[d:{{#invoke:Wikidata|pageId}}|Name of Link]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Testing spouse ===&lt;br /&gt;
Copy and paste the following into any article and preview it (please don&#039;t save!):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P26|}}&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P26|FETCH_WIKIDATA}}&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P26|[[Hillary Clinton]]}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In [[Bill Clinton]] you should get:&lt;br /&gt;
* -&lt;br /&gt;
* - [[Hillary Rodham Clinton]]&lt;br /&gt;
* - [[Hillary Clinton]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In [[Barack Obama]] you should get:&lt;br /&gt;
* -&lt;br /&gt;
* - [[Michelle Obama]]&lt;br /&gt;
* - [[Hillary Clinton]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In [[Richard Burton]] you should get:&lt;br /&gt;
* -&lt;br /&gt;
* - [[Sally Burton]], [[Elizabeth Taylor]]&lt;br /&gt;
* - [[Hillary Clinton]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In [[Franz Kafka]] you should get:&lt;br /&gt;
* -&lt;br /&gt;
* -&lt;br /&gt;
* - [[Hillary Clinton]]&lt;br /&gt;
&lt;br /&gt;
=== Testing birthplace ===&lt;br /&gt;
Copy and paste the following into any article and preview it (please don&#039;t save!):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P19|}}&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P19|FETCH_WIKIDATA}}&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P19|[[Newport]]}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Try [[William Ellery]] and check that the Wikidata call correctly disambiguates.&lt;br /&gt;
&lt;br /&gt;
=== Testing getValue, getRawValue and getDateValue ===&lt;br /&gt;
Copy and paste the following into any article and preview it (please don&#039;t save!):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P19|FETCH_WIKIDATA}}&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P26|FETCH_WIKIDATA}}&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P27|FETCH_WIKIDATA}}&lt;br /&gt;
* - {{#invoke:Wikidata|getValue|P140|FETCH_WIKIDATA}}&lt;br /&gt;
* - {{#invoke:Wikidata|getRawValue|P21|FETCH_WIKIDATA}}&lt;br /&gt;
* - {{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|dmy}}&lt;br /&gt;
* - {{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|mdy}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This should return the Wikidata values for birthplace, spouse, citizenship, religion, gender and date of birth (twice) if they exist. The dob is first in dmy format and then in mdy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#ifeq:{{SUBPAGENAME}}|sandbox||&lt;br /&gt;
[[Category:Wikidata]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>134.134.137.73</name></author>
	</entry>
</feed>