Demo:Table formats compared

From semantic-mediawiki.org
Table of Contents

Table format[edit]

class=sortable wikitable smwtable[edit]

This is the default result format for queries with printout statements, so |format=table does not need to be specified explicitly. Same applies to |class=sortable wikitable smwtable which is the default class for this result format.

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |mainlabel=City
 |sort=Population
 |order=descending
 |headers=plain
}}
Result
CityPopulationSize in km²
Berlin3,520,061891.85 km²344.34 sqmi
Munich1,353,186310.43 km²119.86 sqmi
Cologne1,080,394405.02 km²156.38 sqmi
Frankfurt679,664248.31 km²95.87 sqmi
Stuttgart606,588207.36 km²80.06 sqmi
Würzburg126,63587.63 km²33.83 sqmi

class=table[edit]

This example uses the twitter bootstrap classes. It only works, because this wiki uses the "Chameleon" skin.

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |mainlabel=City
 |sort=Population
 |order=descending
 |headers=plain
 |class=table
}}
Result
CityPopulationSize in km²
Berlin3,520,061891.85 km²344.34 sqmi
Munich1,353,186310.43 km²119.86 sqmi
Cologne1,080,394405.02 km²156.38 sqmi
Frankfurt679,664248.31 km²95.87 sqmi
Stuttgart606,588207.36 km²80.06 sqmi
Würzburg126,63587.63 km²33.83 sqmi

class=datatable[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |mainlabel=City
 |sort=Population
 |order=descending
 |headers=plain
 |format=table
 |class=datatable
}}
Result
CityPopulationSize in km²
Berlin3,520,061891.85 km²344.34 sqmi
Munich1,353,186310.43 km²119.86 sqmi
Cologne1,080,394405.02 km²156.38 sqmi
Frankfurt679,664248.31 km²95.87 sqmi
Stuttgart606,588207.36 km²80.06 sqmi
Würzburg126,63587.63 km²33.83 sqmi

class=datatable compact cell-border[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |mainlabel=City
 |sort=Population
 |order=descending
 |headers=plain
 |format=table
 |class=datatable compact cell-border
}}
Result
CityPopulationSize in km²
Berlin3,520,061891.85 km²344.34 sqmi
Munich1,353,186310.43 km²119.86 sqmi
Cologne1,080,394405.02 km²156.38 sqmi
Frankfurt679,664248.31 km²95.87 sqmi
Stuttgart606,588207.36 km²80.06 sqmi
Würzburg126,63587.63 km²33.83 sqmi

Datatables format[edit]

Note that this result format is provided by extension "Semantic Result Formats"Provides additional formats for semantic queries.
Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |mainlabel=City
 |sort=Population
 |order=descending
 |headers=plain
 |format=datatables
}}
Result

Broadtable format[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |mainlabel=City
 |sort=Population
 |order=descending
 |headers=plain
 |format=broadtable
}}
Result
CityPopulationSize in km²
Berlin3,520,061891.85 km²344.34 sqmi
Munich1,353,186310.43 km²119.86 sqmi
Cologne1,080,394405.02 km²156.38 sqmi
Frankfurt679,664248.31 km²95.87 sqmi
Stuttgart606,588207.36 km²80.06 sqmi
Würzburg126,63587.63 km²33.83 sqmi