Module:Wikidata/doc
Appearance
![]() | This is a documentation subpage for टेम्पलेट:Terminate sentence It may contain usage information, categories and other content that is not part of the original module page. |
This module is a cosmetic modification of the original at Module:Sandbox/Tom Morris which was created 19 May 2013.
The module "Wikidata" contains:
- a call (getSpouse) that allows the calling script to retrieve the value for spouse (property P26) from Wikidata.
- a call (getBirthPlace) that allows the calling script to retrieve the value for birth_place (property P19) from Wikidata.
If the property is not defined in Wikidata for the article that invokes this code, then an empty string ("") is returned.
Usage
Spouse
{{#invoke:Sandbox/RexxS|getSpouse|}}
= returns nothing, so suppresses the display of spouse in an infobox{{#invoke:Sandbox/RexxS|getSpouse|FETCH_WIKIDATA}}
= 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){{#invoke:Sandbox/RexxS|getSpouse|[[Hillary Clinton]]}}
= returns Hillary Clinton, allowing an infobox to use a local value rather than the value stored in Wikidata.
Inside an infobox definition, it may be called like this:
| data55 = {{#invoke:Sandbox/RexxS|getSpouse|{{{spouse|FETCH_WIKIDATA}}} }}
which causes the infobox to:
- not display spouse if the infobox parameter
|spouse
is set to be blank (as"| spouse ="
} - display the linked value(s) from Wikidata if the infobox parameter
|spouse
is not supplied - display the local infobox parameter
|spouse
if it is supplied (e.g."|spouse = Hillary Clinton"
)
Birth place
This works in just the same way as the calls above:
{{#invoke:Sandbox/RexxS|getBirthPlace|}}
= returns nothing, so suppresses the display of spouse in an infobox{{#invoke:Sandbox/RexxS|getBirthPlace|FETCH_WIKIDATA}}
= 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){{#invoke:Sandbox/RexxS|getBirthPlace|[[Hope, Arkansas|Hope]]}}
= returns Hope, allowing an infobox to use a local value rather than the value stored in Wikidata.
Parameters
- A single, unnamed parameter is supplied. This may be null, "FETCH_WIKIDATA", or any other string (within the module it is assigned to the local variable
spouse_input
)
Examples
Testing getSpouse
Copy and paste the following into any article and preview it (please don't save!):
* - {{#invoke:Sandbox/RexxS|getSpouse|}} * - {{#invoke:Sandbox/RexxS|getSpouse|FETCH_WIKIDATA}} * - {{#invoke:Sandbox/RexxS|getSpouse|[[Hillary Clinton]]}}
In Bill Clinton you should get:
In Barack Obama you should get:
In Richard Burton you should get:
In Franz Kafka]] you should get:
- -
- -
- - Hillary Clinton
Testing getBirthplace
Copy and paste the following into any article and preview it (please don't save!):
* - {{#invoke:Sandbox/RexxS|getBirthPlace|}} * - {{#invoke:Sandbox/RexxS|getBirthPlace|FETCH_WIKIDATA}} * - {{#invoke:Sandbox/RexxS|getBirthPlace|[[Newport]]}}