Jump to content

Module:Wikidata/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by RexxS (talk | contribs) at 18:09, 25 August 2013 (create documentation). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

This module is a cosmetic modification of the original at Module:Sandbox/Tom Morris which was created 19 May 2013.

The module "Wikidata" contains one available call (getSpouse) that allows the calling script to retrieve the value for spouse (property P26) from Wikidata.

Usage

  • {{#invoke:{{BASEPAGENAME}}|getSpouse|}} = returns nothing, so suppresses the display of spouse in an infobox
  • {{#invoke:{{BASEPAGENAME}}|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:{{BASEPAGENAME}}|getSpouse|[[Hillary Rodham Clinton]]}} = returns Hillary Rodham 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:{{BASEPAGENAME}}|getSpouse|{{{spouse|FETCH_WIKIDATA}}} }}

which causes the infobox to:

  1. not display spouse if the infobox parameter |spouse is not supplied
  2. display the linked value(s) from Wikidata if the infobox parameter |spouse is set to be blank (as "| spouse ="}
  3. display the local infobox parameter |spouse if it is supplied (e.g. "|spouse = Hillary Clinton")

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: 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: