Help:Wikidata
This page provides help, with the most common questions about using Wikidata in Wikipedia and templates, as described bellow.
You can also search all Wikipedia's help pages using the search box below, or browse the Help menu or the Help directory.
Wikidata is a collaboratively edited knowledge base hosted by the Wikimedia Foundation. It is a common source of open data that Wikimedia projects such as Wikipedia can use, and anyone else, under a public domain license.
In this page there is a basic explanation about how to use Wikipedia Tools and Language links with Wikidata, in an easy language for newbies, in the first part; and, in the second, about how to use Wikidata elements for Wikipedia templates.
Access from Wikipedia and links
[edit]From a Wikipedia page, you can go to the link "Wikidata item", using "Tools" in the lateral pane (in the left), to see and edit it. Also in Tools, there is another link to "page information", where is "Wikidata item ID", that contains the QID (for example: Q171 or "None").
QID (or Q number) is the unique identifier of a data item on Wikidata, comprising the letter "Q" followed by one or more digits. It is used to help people and machines understand the difference between items with the same or similar names, e.g., there are several places in the world called London and many people called James Smith. This number appears next to the name at the top of each Wikidata item.
You can go to the page of the same item in the Wikimediasphere (that is, Wikimedia sister projects) using the links under "In other projects", also in the lateral pane.
Finally, you can go to other Wikipedia language links of the item, clicking in "Languages" in the lateral pane. In a similar way to clicking "Wikimedia item", you can use "Edit links" there.
Templates
[edit]This help page is a how-to guide. It explains concepts or processes used by the Wikipedia community. It is not one of Wikipedia's policies or guidelines, and may reflect varying levels of consensus. |
Here, we are going to see how to use data from Wikidata in enwiki templates.
Data model
[edit]How to link to Wikidata items and QID from Wikipedia:
- d:item = en:article title
- d:Q-number = identity for enwiki:article title
- Example:
- (todo).
Template building: using data from Wikidata
[edit]Inclusion of data values may be achieved by using mediawiki-like WP:MAGICWORDs.
Simple
[edit]Fetching instance of (P31) for this page; and cause of death (P509) for Douglas Adams (Q42):
- Using #property
{{#property:P31}}
→ Wikimedia help page{{#property:P509|from=Q42}}
→ myocardial infarction
Automatic links can be created where they exist:
- Using #statements
{{#statements:P31}}
→ Wikimedia help page{{#statements:P509|from=Q42}}
→ myocardial infarction
By module or template
[edit]To fetch data from Wikidata with or without a link to the connected Wikipedia article and with many other features:
For example: {{wikidata|label|raw}}
returns the Q-identifier (also known as QID or identifier) of the Wikidata item connected to the current page (e.g. "Q55").
Label (also name) is the main name given to identify an entity (i.e. an item or a property). E.g.: the item with the item identifier d:Q7378 has the English label "elephant". Every entity has exactly one label in a given human language. Labels do not need to be unique. Descriptions and aliases are used to distinguish between entities with the same label. Wikidata pages do not have labels, but titles. It's a type of term.
Raw means that will return the Q-identifier or P-identifier instead of the regular label.
In infoboxes
[edit]Module:WikidataIB was developed to provide the tools necessary for drawing information from Wikidata into infoboxes on Wikipedia. It allows infobox fields to draw information from Wikidata while ensuring that local values take priority and that unsourced information is filtered out by default. It also gives the infobox designer the opportunity to make the enabling of Wikidata controllable on a per-article basis ("opt-in").
- Example of conversion
- An infobox like {{Infobox writer}} has a field for "Occupation" with its value defined like this:
| data7 = {{{occupation|}}}
- That could be updated to bring information from Wikidata using the
getValue
function from the module, which has a template shortcut {{wdib}}. Occupation is P106: | data7 = {{wdib |fwd={{{fetchwikidata|}}} |P106 |qid={{{qid|}}} | {{{occupation|}}} }}
- That would import the sourced occupations of the connected page (or any other page if qid is set) unless the local parameter
|occupation=
is given a value in an article, when that value takes preference over anything in Wikidata. But this does not happen until|fetchwikidata=ALL
is set in the infobox of the article. - For example, for Douglas Adams (Q42), we would get:
- screenwriter, novelist, science fiction writer, writer, musician
- The pen icon is automatically added at the end of each field that fetches its value from Wikidata and gives a direct link to the place on Wikidata where the value(s) came from. It can be suppressed by setting
|noicon=true
. - Although the values are linked, there is a string-handling function that will capitalise the first letter, regardless of whether the value is linked or is part of a list:
{{#invoke:String2 |ucfirst | {{wdib|fwd=ALL|P106|qid=Q42}} }}
→ Screenwriter, novelist, science fiction writer, writer, musician- Examples of some of the functionality can be found at Module talk:WikidataIB/testing.
Tracking
[edit]- Tracking categories
- In Category:Wikidata there is
- Tracking & using
To track the data in or missing from one or more Wikidata properties; or to indicate that template or module uses a Wikidata property or properties, where available.
- {{Tracks Wikidata}}
- {{Uses Wikidata}}
A property (also attribute) describes the data value of a statement and can be thought of as a category of data, for example "color" for the data value "blue". Properties, when paired with values, form a statement in Wikidata. Properties are also used in qualifiers. Properties have their own pages on Wikidata and are connected to items, resulting in a linked data structure.