Template:Tree

From Wikidata
Jump to navigation Jump to search
Documentation icon Template documentation[view · edit · history · purge ]

Template allowing to output trees from Wikidata content. Based on Module:Tree.

Usage

{{Tree|property=|items=|recursion=|lang=}}

Parameters

Parameter name Description Default value required or optional?

property The numeric identifier of the property to base the tree on ie the XX part in PXX. empty required
items The base item(s) identifiers use to start the tree. List of QXX identifiers separated by spaces. empty required
recursion Maximum height of the tree 10 optional
lang Language code in which the labels will be found en optional

Additional information

The template is intended to be used in the following namespaces: no namespace specified

The template is intended to be used by the following user groups: no user group specified

Symbols

Tack with bowl to the right

The tack symbol with a bowl to the right "⊸" means "end of the branch". There are no further child items for that branch.

Small three dots

Small three dots "…" means "child item abbreviated". There is further child item for that branch, but it is abbreviated because it already exceeded the recursion limit. If you want to show abbreviated items, increase the recursion number setting.

Infinity symbol and Upwards arrow

Infinity symbol and upwards arrow "∞ ↑" means infinite loop is detected (i.e. a child branch is in fact linking back to one of its own ancesters previously listed in the tree). The same item is linked with one or more symbols between parentheses (like at sign "@", asterisk "*", or sharp "#").

Other symbols

One or more symbols between parenthses (like at sign "@", asterisk "*", or sharp "#") are used when same item appears twice or more times in different branches of the tree. Same items are abbreviated by these symbols except the last occurrence.

Huge tree

Huge tree sometimes exceeds the limit of expensive parser function count (w:en:WP:EXPENSIVE). When accessing one Wikidata item page through Lua function (for example mw.wikibase.getEntity() for any entity not already loaded in a small internal cache for the currently rendered page), it increments an internal Wikibase counter by one.

If the internal counter reaches the expensive parser function count threshold, this template returns an error: Lua error: too many expensive function calls. And it automatically categorizes the current page into Category:Pages with too many expensive parser function calls. In such case, try decreasing recursion number setting for shortening tree.

As of 2017, maximum expensive parser function count was 500, so it is not possible to render huge tree which includes over 500 items. You can check the current expensive parser function count of each page by following manner.

Go to "Edit" mode → "Show preview" → Scroll down to around the middle of the preview page → Click and open the "Parser profiling data:" table → Check Expensive parser function count shown there, like 142/500. These statistics reports can also found without using edit preview on any page, by looking for the HTML code at end of the main content of the generated page, where they are represented as HTML comments.

Example

{{Tree|property=40|items=Q1154861|recursion=50}}

See also