hw>Mlink-rodrigue
No edit summary
 
No edit summary
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
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.
Here you can see some examples for simple queries using the  properties of a wiki page. This functionality is provided by the bundled extension Semantic MediaWiki. You can add these queries to any wiki page.


==Creating page lists==
== Content droplet "Data query" ==
Starting with BlueSpice 4.3, basic SMW data queries can be added directly with the ''Content droplet'' "Data query":
 
# '''Click''' on the ''Content droplets'' menu item in the visual editor.
# '''Select''' ''Data query'' under ''Lists.''[[File:Droplet Data query.png|alt=Screenshot of the Content droplet selection for "Lists"|center|thumb|500x500px|Content droplet "Data query"]]
# '''Click''' ''Insert''. This opens the droplet inspector.
# '''Fill in''' the query options (parameter). Each setting has a tooltip that explains exactly what values you can enter.[[File:Droplet Data query parameter.png|alt=Data query parameters|center|thumb|Data query parameters]]
# '''Click''' ''Save''.
The list of filtered pages is then displayed on the wiki page.
 
==Creating page lists manually==
If you need more flexible, customizable queries, you can add the queries directly in source edit mode. Below are a few examples to get you started.
 
=== Show pages in a particular namespace ===
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{#ask:
{{#ask:
[[:+]]
[[:+]] <!-- find all pages in the main namespace -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
|format=ul
|format=ul
|limit=4
|limit=4
}}
}}
</syntaxhighlight><br />{{#ask:
</syntaxhighlight>Output example in list style format:<span /><br />{{#ask:
[[:+]][[Modification date::+]]
[[:+]][[Modification date::+]]
|format=ul
|format=ul
Line 15: Line 28:
}}
}}


'''Notes:'''
<span><br /></span>'''Notes:'''
 
<code><nowiki>[[:+]]</nowiki></code>                     show Pages in the ''Main'' namespace. <code><nowiki>[[Myspace:+]]</nowiki></code>  shows pages in the namespace ''Myspace''.


<code><nowiki>[[:+||Help:+]]</nowiki></code>shows pages in the Main namespace and in the namespace ''Help''.
* <code><nowiki>[[:+]]</nowiki></code>                      shows pages from the ''Main'' namespace.
* <code><nowiki>[[Myspace:+]]</nowiki></code>      shows pages from the namespace ''Myspace''.
* <code><nowiki>[[:+||Help:+]]</nowiki></code>   shows pages from both the ''Main'' namespace and the namespace ''Help'' (=OR argument)


===Output in category style===
===Output in category style===
<syntaxhighlight>
<syntaxhighlight lang="text">
{{#ask:
{{#ask:
[[:+]][[Modification date::+]]
[[:+]][[Modification date::+]]
Line 28: Line 41:
|limit=12
|limit=12
}}
}}
</syntaxhighlight>
</syntaxhighlight>Output example:{{#ask:
{{#ask:
[[:+]][[Modification date::+]]
[[:+]][[Modification date::+]]
|format=category
|format=category
Line 40: Line 52:
[[Category:Administration]]  
[[Category:Administration]]  
| limit=4  
| limit=4  
| searchlabel=
| format=ol
}}
</syntaxhighlight>Showing 4 results for pages in category Administration including pages from subcategories:{{#ask:
[[Category:Administration]]
| limit=4
| searchlabel=
| format=ol
}}
==== Combine categories ====
Different arguments can be linked using the <code>OR</code> operator:<syntaxhighlight lang="text">
{{#ask:
[[Category:Administration]] OR [[Category:Bearbeiten]]
| limit=10
| searchlabel=
| searchlabel=
| format=ol  
| format=ol  
}}  
}}  
</syntaxhighlight>
</syntaxhighlight>
==== Pages from main category (without subcategories) ====
<syntaxhighlight lang="text">
{{#ask:  
{{#ask:  
[[Category:Administration]]  
[[Category:Administration|+depth=0]]
| limit=4
| limit=10
| searchlabel=
| format=ol
}}
</syntaxhighlight>Here 10 pages from the category Administration are displayed exclusively pages from the subcategories:{{#ask:
[[Category:Administration|+depth=0]]  
| limit=10
| searchlabel=  
| searchlabel=  
| format=ol
| format=ol
}}
}}


===Seiten mit gleichem Namensanfang===
==== Subcategories of a page ====
<syntaxhighlight lang="text">
{{#ask:
[[Subcategory of::Administration]] [[Modification date::+]]<!-- nötig um gelöschte Seiten u. Redirects zu filtern -->
|format=ul
}}
</syntaxhighlight>
Output of the subcategories of the category "Administration"
{{#ask: [[Subcategory of::Administration]] [[Modification date::+]]
|format=ul
}}
===Pages that start with the same page name string===
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{#ask:  
{{#ask:  
Line 90: Line 137:
}}
}}


 
<span><br /></span>
===Format "datatable"===
===Format "table" with filter (datatable)===
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{#ask:  
{{#ask:  
Line 102: Line 149:
}}
}}
</syntaxhighlight>
</syntaxhighlight>
{{Box Note|boxtype=important|Note text=The format declaration  <pre>|format=datatable </pre> currently does not work with the BlueSpice skin. Instead, use the following syntax:
<pre>
|format=table
|class=datatable
</pre>}}


{{#ask:  
{{#ask:  
Line 118: Line 159:
}}
}}


{{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 />
==Date queries ==
=== Today===
To ask for all pages that have been approved today:<syntaxhighlight lang="text">
{{#ask:
[[QM/Approval date::>>{{#time:Y-m-d|now -1day}}]]
}}
 
</syntaxhighlight>
 
=== Before or after ===
Shows all pages in the main namespace that were last edited before 2024 with the year of the last edit:<syntaxhighlight lang="text">
{{#ask:
[[Modification date::<{{#time:Y|2024}}]] [[:+]]
|?Modification date#-F[Y]
|format=ul
|headers=hide
}}
 
</syntaxhighlight>Date formatting: https://www.semantic-mediawiki.org/wiki/Help:Type_Date
 
== Search operators ==
If you want to look for results in a particular range, you can use search operators. See: https://semantic-mediawiki.org/wiki/Help:Search_operators#comparators
 
== <span class="mw-headline">Templates</span> ==
Customized output formats can be created using templates. The documentation for this can be found at [https://www.semantic-mediawiki.org/wiki/Help:Using_templates semantic-mediawiki.org.]
 
Here we show you some useful tips when working with templates.
 
=== Suppressing the namespace prefix ===
By default, the namespace prefix of a page is suppressed in the output formats "ul", "ol" (and other formats). However, if you are working with a template and therefore use the ''link=none'' parameter in the ask query, because you generate the link in the template yourself, then the page name is displayed with the namespace prefix. Sample query of all pages in the QM namespace: <div>
<nowiki>{{#ask: </nowiki>[[QM:+]][[Modification date::+]]
<nowiki>|</nowiki>format=plaintext
<nowiki>|</nowiki>template=mytemplate
<nowiki>|</nowiki><nowiki>link=none
}}</nowiki>
</div>The output here is in the format '''''QM:My Page'''''.


To remove the namespace prefix, use the following syntax in the template, e.g. to generate an unordered list:<div>
*<nowiki>[[{{FULLPAGENAME:{{{1}}}}}|{{PAGENAME:{{{1}}}}}]]</nowiki>
</div>In this example, the full page name is linked via the "magic word" <nowiki>{{FULLPAGENAME}}</nowiki> and the page name without namespace prefix <nowiki>{{PAGENAME}}</nowiki> is used as the link label. The resulting output  is  '''''My Page'''''.{{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]|Topic3=[https://semantic-mediawiki.org/wiki/Help:Using_templates Using templates to create output formats]}}
[[Category:Organization]]
[[Category:Organization]]
[[de:SMW-Abfragen]]
[[de:SMW-Abfragen]]
[[en:{{FULLPAGENAME}}]]
[[en:{{FULLPAGENAME}}]]

Latest revision as of 12:12, 16 June 2025

Here you can see some examples for simple queries using the properties of a wiki page. This functionality is provided by the bundled extension Semantic MediaWiki. You can add these queries to any wiki page.

Content droplet "Data query"

Starting with BlueSpice 4.3, basic SMW data queries can be added directly with the Content droplet "Data query":

  1. Click on the Content droplets menu item in the visual editor.
  2. Select Data query under Lists.
    Screenshot of the Content droplet selection for "Lists"
    Content droplet "Data query"
  3. Click Insert. This opens the droplet inspector.
  4. Fill in the query options (parameter). Each setting has a tooltip that explains exactly what values you can enter.
    Data query parameters
    Data query parameters
  5. Click Save.

The list of filtered pages is then displayed on the wiki page.

Creating page lists manually

If you need more flexible, customizable queries, you can add the queries directly in source edit mode. Below are a few examples to get you started.

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)

Output in category style

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

Show pages from a category

{{#ask: 
[[Category:Administration]] 
| limit=4 
| searchlabel=
| format=ol 
}}
Showing 4 results for pages in category Administration including pages from subcategories:
  1. Config manager
  2. Extended statistics
  3. Extension/AdhocTranslation
  4. Footer

Combine categories

Different arguments can be linked using the OR operator:
{{#ask: 
[[Category:Administration]] OR [[Category:Bearbeiten]]
| limit=10 
| searchlabel=
| format=ol 
}}

Pages from main category (without subcategories)

{{#ask: 
[[Category:Administration|+depth=0]] 
| limit=10
| searchlabel=
| format=ol 
}}
Here 10 pages from the category Administration are displayed exclusively pages from the subcategories:
  1. Config manager
  2. Extended statistics
  3. Extension/AdhocTranslation
  4. Footer
  5. Main navigation
  6. Namespace manager
  7. Translations in a Wiki farm (TranslationTransfer)

Subcategories of a page

{{#ask: 
[[Subcategory of::Administration]] [[Modification date::+]]<!-- nötig um gelöschte Seiten u. Redirects zu filtern -->
|format=ul
}}

Output of the subcategories of the category "Administration"

Pages that start with the same page name string

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

Format "broadtable"

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



Format "table" with filter (datatable)

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


Date queries

Today

To ask for all pages that have been approved today:
{{#ask:
[[QM/Approval date::>>{{#time:Y-m-d|now -1day}}]]
}}

Before or after

Shows all pages in the main namespace that were last edited before 2024 with the year of the last edit:
{{#ask:
[[Modification date::<{{#time:Y|2024}}]] [[:+]]
|?Modification date#-F[Y]
|format=ul
|headers=hide
}}
Date formatting: https://www.semantic-mediawiki.org/wiki/Help:Type_Date

Search operators

If you want to look for results in a particular range, you can use search operators. See: https://semantic-mediawiki.org/wiki/Help:Search_operators#comparators

Templates

Customized output formats can be created using templates. The documentation for this can be found at semantic-mediawiki.org.

Here we show you some useful tips when working with templates.

Suppressing the namespace prefix

By default, the namespace prefix of a page is suppressed in the output formats "ul", "ol" (and other formats). However, if you are working with a template and therefore use the link=none parameter in the ask query, because you generate the link in the template yourself, then the page name is displayed with the namespace prefix. Sample query of all pages in the QM namespace:
{{#ask: QM:++Property "Modification date" has a restricted application area and cannot be used as annotation property by a user.
|format=plaintext
|template=mytemplate
|link=none
 }}
The output here is in the format QM:My Page. To remove the namespace prefix, use the following syntax in the template, e.g. to generate an unordered list:
*[[{{FULLPAGENAME:{{{1}}}}}|{{PAGENAME:{{{1}}}}}]]
In this example, the full page name is linked via the "magic word" {{FULLPAGENAME}} and the page name without namespace prefix {{PAGENAME}} is used as the link label. The resulting output is My Page.

Related info


PDF exclude - start

To submit feedback about this documentation, visit our community forum.

PDF exclude - end