Demo:Standard table examples

From semantic-mediawiki.org
Jump to: navigation, search
NoteNote: This demo page is about the table format. If you want to use the broadtable format just add |format=broadtable to the example queries provided.

Simple table example

{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |format=table
 |mainlabel=City
}}

This produces the following output:

CityPopulationSize in km²
Berlin3,520,061891.85 km²
344.343 sqmi
Cologne
Frankfurt679,664248.31 km²
95.872 sqmi
Munich1,353,186310.43 km²
119.857 sqmi
Stuttgart606,588207.36 km²
80.062 sqmi
Würzburg

"class" parameter example

{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |format=table
 |mainlabel=City
 |class=datatable
}}

This produces the following output:

CityPopulationSize in km²
Berlin3,520,061891.85 km²
344.343 sqmi
Cologne
Frankfurt679,664248.31 km²
95.872 sqmi
Munich1,353,186310.43 km²
119.857 sqmi
Stuttgart606,588207.36 km²
80.062 sqmi
Würzburg
NoteNote: This example will only work after this wiki was upgraded to use Semantic MediaWiki 3.0.0 and later.

"transpose" parameter example

{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |format=table
 |transpose=true
 |mainlabel=City
}}

This produces the following output:

CityBerlinCologneFrankfurtMunichStuttgartWürzburg
Population3,520,061679,6641,353,186606,588
Size in km²891.85 km²
344.343 sqmi
248.31 km²
95.872 sqmi
310.43 km²
119.857 sqmi
207.36 km²
80.062 sqmi

"sep" parameter example

{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Has point of interest=Point of Interest
 |format=table
 |sep=, 
 |mainlabel=City
}}

This produces the following output:

CityPoint of Interest
BerlinBrandenburg Gate, Museumsinsel, Reichstag
Cologne
Frankfurt
MunichDom zu Unserer Lieben Frau, Schloss Nymphenburg
Stuttgart
Würzburg

The output without using the "sep" parameter (default behaviour):

CityPoint of Interest
BerlinBrandenburg Gate
Museumsinsel
Reichstag
Cologne
Frankfurt
MunichDom zu Unserer Lieben Frau
Schloss Nymphenburg
Stuttgart
Würzburg