Templates used to create a tabular output combined with math formats
From semantic-mediawiki.org
< Demo:Examples | Queries
| Templates for joining output | |
|---|---|
| This page shows an example for the template format used to create a tabular output combined with math formats. | |
| Format | |
| Keywords | |
| Table of Contents | |
These examples require Semantic MediaWiki 1.9.2Released on 18 April 2014 and compatible with MW 1.19.0 - 1.22.x. or newer due to an enhancement to the
userparam parameter.1 Also note the changes that were made in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x., i.e. the names of the variables and the name of the result format changed.2 See the help page result format "Plainlist"Outputs results in a comma separated list, with additional outputs shown in parentheses. The output does not provide class attributes to HTML elements (default for queries without printout statements). for further information.
Examples
Without extra conditionals
- Syntax
{{#ask:
[[Category:City]]
[[Located in::Germany]]
|?Population
|?Area
|format=plainlist
|template=Template/Math/Table
|introtemplate=Template/Math/Table/Intro
|outrotemplate=Template/Math/Table/Outro
|link=none
}}
- Result
| City | Population | Area |
|---|---|---|
| Berlin | 3,520,061 | |
| Cologne | 1,080,394 | 405.02 km² |
| Frankfurt | 679,664 | 248.31 km² |
| Munich | 1,353,186 | 310.43 km² |
| Stuttgart | 606,588 | 207.35 km² |
| Würzburg | 126,635 | 87.63 km² |
| Average | 1,227,754.667 | 0 km² |
| Total | 7,366,528 | 0 km² |
With additional conditionals
- Syntax
{{#ask:
[[Category:City]]
[[Located in::Germany]]
|?Population
|?Area
|format=plainlist
|template=Template/Math/Table
|introtemplate=Template/Math/Table/Intro
|outrotemplate=Template/Math/Table/Outro
|link=none
|limit=3
|searchlabel=
}}
- Result
| City | Population | Area |
|---|---|---|
| Berlin | 3,520,061 | |
| Cologne | 1,080,394 | 405.02 km² |
| Frankfurt | 679,664 | 248.31 km² |
| Average | 1,760,039.667 | 0 km² |
| Total | 5,280,119 | 0 km² |
The templates used to create the examples:
- Template:Template/Math/Table
- Template:Template/Math/Table/Intro
- Template:Template/Math/Table/Outro: the one inheriting query conditions, limit and offset
References
- ^ Semantic MediaWiki: GitHub pull request gh:smw:217
- ^ Semantic MediaWiki: GitHub pull request gh:smw:3130