Wikidata/Notes/Inclusion syntax v0.4

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search
Correct.svg This page is currently a draft. More information pertaining to this may be available on the talk page.
Ambox important.svg
New Version (May 2013) This is a subset of the previous draft!

This page describes the data inclusion syntax for the Wikibase client, by which the properties of data items can be included and rendered on a wiki page using templates. In short: This is how we want Wikipedia articles to include data from Wikidata.

The inclusion syntax presented here is meant to work for very simple cases, and only for them.

Complicated cases are to be realized using Lua.

Accessing Item Data[edit]

Properties[edit]

Properties of a Wikidata Item can be used via the #property parser function:

 {{#property:P36}}
 {{#property:capital}}

This will provide a representation of the value of the capital property of the page's default item. The default item is the Wikidata item that is associated with this page via language links.

The property label is case sensitive. It is also possible to use the identifier of the property (this is more stable against changes of the label of a property).

Properties of different items[edit]

To access properties of a different item, it has to be specified explicitly, either by ID or by their Wikipedia title.

 {{#property:capital|of=Q183}}
 {{#property:capital|of=Germany}}

(Note: this is not implemented yet - see bugzilla:47930)

  • However, using Scribunto, msg = mw.message.newRawMessage("{{#property:capital}}"):title("Germany"):text() will return "Bonn, Berlin" from any page. (Presently this result will not be updated when the Wikidata entry is updated) This workaround has been intentionally rendered inoperative.[1] You can use Wikidata if you run an external site that is free to make use of its API.

Work in progress[edit]

This section has outdated information. Please help update it, or bring attention to it on the community discussion page.
Listed properties are in use but work may not be complete.