Wikidata:Notes/Inclusion syntax

Wikidata contains claims/statements regarding properties of items (see also Wikidata:Glossary), e.g. item Q183 (Germany) contains the claim/statement that Property:P36 (capital) of this item has as value item Q64 (Berlin).

On the page about item Q183 on a wiki on which Phase 2 of Wikidata has been deployed, {{#property:p36}} gives the title of the page on that wiki about item Q64.

For example, on en:Germany it would give "Berlin", the title of the page en:Berlin, while on it:Germania it would give "Berlino", the title of the page it:Berlino.

The retrieval code need not occur explicitly in the wikitext of the page. For example, the local copy of item Q8478926 (retrieval template Wikidata), in this case it:Template:Wikidata, can be used: {{wikidata|p36}} on it:Germania would also give "Berlino".

There may be multiple values for the property of an item, either by its nature or in the case of multiple claims/statements with respect to, in principle, a single value:

{{wikidata|p47}}, referring to Property:P47 ("shares border with"), on en:Germany would give "Denmark, Poland, Czech Republic, Austria, Switzerland, France, Luxembourg, Belgium, Netherlands", while on it:Germania it would give "Danimarca, Polonia, Repubblica Ceca, Austria, Svizzera, Francia, Lussemburgo, Belgio, Paesi Bassi". The order corresponds to that on Q183.

If in a wiki there is no page for one of the resulting items (or if it has not been linked yet to the corresponding Wikidata item), the output for the page title is an empty string. In the case of multiple results the commas and one blank space after each comma are preserved, so one can distinguish between, for example "there are two values of type "item", one of which is ..", and "there is one value of type "item", namely ..".

Tests and demos edit

A limitation of Wikidata, also for tests and demos of inclusion syntax, is that data about a subject can only be retrieved on a single page per wiki, the regular page about the subject. Thus it cannot be retrieved on e.g. a user page or a help page.

For tests and demos one can use separate example data or copies of existing data, which are put on a Wikidata item page created for this purpose, e.g. Q4115189 (Wikidata Sandbox). (However, it does not seem possible to copy the data content of an item page in one go, it seems one can only copy data one by one.)

Also one can use en:Special:ExpandTemplates etc. and put the name of the local page about the item, e.g. "Germany", in the context title box, and the inclusion syntax in the input text box. One can also create a link to the ExpandTemplates page with some or all of this prefilled in the boxes, for example:

where "47" and "Germany" can be changed as desired.

For multiple examples of data retrieval with a fixed pattern of wikitext one can use a template such as en:Template:Wikidata value.

See also edit