Meta:Wikidata/Notes/Inclusion syntax

From OODA WIKI

Template: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 OODA WIKI 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

Properties

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

To access properties of a different item, it has to be specified explicitly by its ID. (This was implemented in phab:T49930.)

  • {{#property:P36|from=Q183}} → {{#property:P36|from=Q183}}
  • {{#property:capital|from=Q183}} → {{#property:capital|from=Q183}}

Specification of the item by its OODA WIKI title is not implemented yet:

  • {{#property:P36|from=Germany}} → {{#property:P36|from=Germany}}
  • {{#property:capital|from=Germany}} → {{#property:capital|from=Germany}}
  • 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.
  • Another workaround: Scribunto function mw.wikibase.getEntityIdForTitle (not implemented yet - phab:T74815)

Property rank and multiple values

If a Wikidata property value has a "deprecated rank", {{#property:}} will not display it:

If a Wikidata property has multiple values, {{#property:}} will only display the highest ranked values:

Check the existence of the property

Checks whether the property exists on wikidata to display an infobox using #if:

Work in progress