SMW queries

Here you can see some examples for simple queries using the metadata of a wiki page. You can add these queries to any wiki page.

Creating page lists[edit | edit source]

Show pages in a particular namespace[edit | edit source]

{{#ask:
[[:+]]  <!-- find all pages in the main namespace -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
|format=ul
|limit=4
}}

Output example in list style format:

... further results


Notes:


[[:+]] shows pages from the Main namespace.

[[Myspace:+]] shows pages from the namespace Myspace.

[[:+||Help:+]] shows pages from both the Main namespace and the namespace Help (=OR argument)

Output in category style[edit | edit source]

{{#ask:
[[:+]][[Modification date::+]]
|format=category
|limit=12
}}

Output example:

Show pages from a category[edit | edit source]

{{#ask: 
[[Category:Administration]] 
| limit=4 
| searchlabel=
| format=ol 
}}
  1. Config manager
  2. Extended statistics

Pages that start with the same page name string[edit | edit source]

{{#ask: 
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=ol 
}}

List of pages in the Main namespace and in the namespace Manual that begin with "Visu".


Results format: Table[edit | edit source]

Format "broadtable"[edit | edit source]

{{#ask: 
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=broadtable
}}



Format "datatable"[edit | edit source]

{{#ask: 
[[~Visu*]][[:+||Handbuch:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=table
| class=datatable
}}
Important!The format declaration
|format=datatable 
currently does not work with the BlueSpice skin. Instead, use the following syntax:
|format=table
|class=datatable



Related info


Discussions