Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
PricePedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Wikidata/doc
(section)
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Usage == === Example: spouse (P26) === * <code><nowiki>{{#invoke:Wikidata|getValue|P26|}}</nowiki></code> = returns nothing, so suppresses the display of spouse in an infobox * <code><nowiki>{{#invoke:Wikidata|getValue|P26|FETCH_WIKIDATA}}</nowiki></code> = 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 Clinton]]) * <code><nowiki>{{#invoke:Wikidata|getValue|P26|[[Hillary Rodham Clinton]]}}</nowiki></code> = returns [[Hillary Rodham Clinton]], allowing an infobox to use a local value rather than the value stored in Wikidata. === Example in Infobox template === Inside an infobox definition, it may be called like this: * <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>) Optionally, it could be called as: * <code><nowiki>| data55 = {{#invoke:Wikidata|getValue|P26|{{{spouse|}}} }}</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>} # not display spouse 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>) # display the linked value(s) from Wikidata if the infobox parameter is locally set to FETCH_WIKIDATA See [[Module:WikidataIB]] for a modification that allows fields, on a per article basis, to be blacklisted so that they never display. It also allows the editor to specify, on a per article basis, which fields may be automatically fetched from Wikidata when local parameter is supplied; the default is none, allowing an infobox to be modified to accept Wikidata without any change in the articles using the infobox until the functionality is enabled in the article. === Example:birth place === This works in just the same way as the calls above: * <code><nowiki>{{#invoke:Wikidata|getValue|P19|}}</nowiki></code> = returns nothing, so suppresses the display of birth place in an infobox * <code><nowiki>{{#invoke:Wikidata|getValue|P19|FETCH_WIKIDATA}}</nowiki></code> = 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]]) * <code><nowiki>{{#invoke:Wikidata|getValue|P19|[[Hope, Arkansas|Hope]]}}</nowiki></code> = returns [[Hope, Arkansas|Hope]], allowing an infobox to use a local value rather than the value stored in Wikidata. === Example:gender === We don't want the returned value linked, so use: * - <code><nowiki>{{#invoke:Wikidata|getRawValue|P21|FETCH_WIKIDATA}}</nowiki></code> === Example:date of birth === If we want the date of birth in dmy format, we use: * - <code><nowiki>{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|dmy}}</nowiki></code> If we want the date of birth in mdy format, we use: * - <code><nowiki>{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|mdy}}</nowiki></code> If we want a year of birth, we use: * - <code><nowiki>{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y}}</nowiki></code> If we want a year of birth that may be BC, but should read "BCE", we use: * - <code><nowiki>{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y|BCE}}</nowiki></code> === Example: Linking to Wikidata item === Use the following code to just retrieve the Q-ID: * - <code><nowiki>{{#invoke:Wikidata|pageId}}</nowiki></code> Linking to Wikidata used the usual Wiki markup: * - <code><nowiki>[[d:{{#invoke:Wikidata|pageId}}|Name of Link]]</nowiki></code> === Example: Linking to another wiki page === Use code like this to link to another wiki. English Wikivoyage in the example: * - <code><nowiki>[[voy:{{#invoke:Wikidata|getSiteLink|enwikivoyage}}|Name of Link]]</nowiki></code>
Summary:
Please note that all contributions to PricePedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
PricePedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)