Last edited 2 years ago
by WikiSysop

4 SMW queries

(Changed categories.)
(Changed categories.)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<bookshelf src="Book:Administration" />
Here you can see some examples for simple queries using the  page properties. You can add these queries to any page.
Here you can see some examples for simple queries using the  page properties. You can add these queries to any page.


Line 59: Line 60:
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{#ask:  
{{#ask:  
[[~Edit*]][[+]]
[[~Edit*]][[:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5  
| limit=5  
Line 67: Line 68:
</syntaxhighlight>List of pages in the ''ES '' namespace that begin with "Edit".
</syntaxhighlight>List of pages in the ''ES '' namespace that begin with "Edit".
{{#ask:  
{{#ask:  
[[~Edit*]][[+]]
[[~Edit*]][[:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5  
| limit=5  
Line 79: Line 80:
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{#ask:  
{{#ask:  
[[~Edit*]][[+]]
[[~Edit*]][[:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5  
| limit=5  
Line 88: Line 89:


{{#ask:  
{{#ask:  
[[~Edit*]][[+]]
[[~Edit*]][[:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5  
| limit=5  
Line 99: Line 100:
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{#ask:  
{{#ask:  
[[~Edit*]][[+]]
[[~Edit*]][[:+]]
[[Modification date::+]]<!-- nötig um gelöschte Seiten zu filtern -->
[[Modification date::+]]<!-- nötig um gelöschte Seiten zu filtern -->
|?Last editor is
|?Last editor is
Line 110: Line 111:


{{#ask:  
{{#ask:  
[[~Edit*]][[+]]
[[~Edit*]][[:+]]
[[Modification date::+]]<!-- nötig um gelöschte Seiten zu filtern -->
[[Modification date::+]]<!-- nötig um gelöschte Seiten zu filtern -->
|?Last editor is
|?Last editor is
Line 120: Line 121:


{{Box Links-en|Topic1=[https://www.semantic-mediawiki.org/wiki/Help:Inline_queries SMW "ask" queries]|Topic2=[https://www.semantic-mediawiki.org/wiki/Help:Result_formats SMW result formats]}}<br />
{{Box Links-en|Topic1=[https://www.semantic-mediawiki.org/wiki/Help:Inline_queries SMW "ask" queries]|Topic2=[https://www.semantic-mediawiki.org/wiki/Help:Result_formats SMW result formats]}}<br />
[[Category:Administration]]

Latest revision as of 11:35, 30 September 2022

Here you can see some examples for simple queries using the page properties. You can add these queries to any page.

4.1 Creating page lists

4.1.1 Show pages in a particular namespace

{{#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)

4.1.2 Output in category style

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

Output example:

4.1.3 Show pages from a category

{{#ask: 
[[Category:Administration]] 
| limit=4 
| searchlabel=
| format=ol 
}}
  1. Blog
  2. Category manager
  3. Footer
  4. Namespace manager

4.1.4 Pages that start with the same page name string

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

List of pages in the ES namespace that begin with "Edit".

  1. Edit articles
  2. Edit articles/Tables

4.2 Results format: Table

4.2.1 Format "broadtable"

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


4.2.2 Format "datatable"

{{#ask: 
[[~Edit*]][[:+]]
[[Modification date::+]]<!-- nötig um gelöschte Seiten zu filtern -->
|?Last editor is
| searchlabel=
| format=table
| class=datatable
}}



Related info