Difference between revisions of "SMW queries"
(Tag: 2017 source edit) |
(Tag: 2017 source edit) |
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.
Contents
Creating page lists[edit | edit source]
{{#ask:
[[:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
|format=ul
|limit=4
}}
... further results
Notes:
[[:+]] show Pages in the Main namespace. [[Myspace:+]] shows pages in the namespace Myspace.
[[:+||Help:+]]shows pages in the Main namespace and in the namespace Help.
Output in category style[edit | edit source]
{{#ask:
[[:+]][[Modification date::+]]
|format=category
|limit=12
}}
A
B
Show pages from a category[edit | edit source]
{{#ask:
[[Category:Administration]]
| limit=4
| searchlabel=
| format=ol
}}
Seiten mit gleichem Namensanfang[edit | edit source]
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=ol
}}
- Visual version comparison (VisualDiff)
- VisualEditor
- VisualEditor/Tables/Examples
- VisualEditor/Version comparison
- VisualEditor: Insert Images
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
}}
| Visual version comparison (VisualDiff) |
| VisualEditor |
| VisualEditor/Tables/Examples |
| VisualEditor/Version comparison |
| VisualEditor: Insert Images |
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=datatablecurrently does not work with the BlueSpice skin. Instead, use the following syntax:
|format=table |class=datatable
| Visual version comparison (VisualDiff) |
| VisualEditor |
| VisualEditor/Tables/Examples |
| VisualEditor/Version comparison |
| VisualEditor: Insert Images |
Related info
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==
<syntaxhighlight lang="text">
{{#ask:
[[:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
|format=ul
|limit=4
}}
</syntaxhighlight><br />{{#ask:
[[:+]][[Modification date::+]]
|format=ul
|limit=4
}}
'''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''.
===Output in category style===
<syntaxhighlight>
{{#ask:
[[:+]][[Modification date::+]]
|format=category
|limit=12
}}
</syntaxhighlight>
{{#ask:
[[:+]][[Modification date::+]]
|format=category
|limit=12
}}
===Show pages from a category===
<syntaxhighlight lang="text">
{{#ask:
[[Category:Administration]]
| limit=4
| searchlabel=
| format=ol
}}
</syntaxhighlight>
{{#ask:
[[Category:Administration]]
| limit=4
| searchlabel=
| format=ol
}}
===Seiten mit gleichem Namensanfang===
<syntaxhighlight lang="text">
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=ol
}}
</syntaxhighlight>List of pages in the ''Main '' namespace and in the namespace ''Manual'' that begin with "Visu".
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=ol
}}
==Results format: Table==
===Format "broadtable"===
<syntaxhighlight lang="text">
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=broadtable
}}
</syntaxhighlight>
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=broadtable
}}
===Format "datatable"===
<syntaxhighlight lang="text">
{{#ask:
[[~Visu*]][[:+||Handbuch:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=table
| class=datatable
}}
</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:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=table
| class=datatable
}}
{{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:Organization]]
[[de:SMW-Abfragen]]
[[en:{{FULLPAGENAME}}]]| Line 118: | Line 118: | ||
}} | }} | ||
| − | {{Box Links-en|Topic1=[https://www.semantic-mediawiki.org/wiki/Help:Inline_queries SMW "ask" queries]}}<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:Organization]] | [[Category:Organization]] | ||
[[de:SMW-Abfragen]] | [[de:SMW-Abfragen]] | ||
[[en:{{FULLPAGENAME}}]] | [[en:{{FULLPAGENAME}}]] | ||