From SMW+ Semantic Enterprise Wiki
- Applies to version
- Description
- How to create trees using inline queries
- Prerequisites
- Audience
- Associated Components
You can use the #tree parser function in combination with so-called inline queries, which dynamically include query results into pages. The basic way of writing an inline query is to use the parser function #ask. In inline queries, the query string, any printout statements, and the output format are directly given as parameters. The general syntax
for #ask is as follows:
{{#ask: <argument 1>|<argument 2>|...}}
The following example shows how to use an inline query in combination with the #tree parser function:
{{#tree:id=test|root=Locations|
*Cities
{{#ask:[[Category:City]]||format=template|template=Querytree}}
}}
Note – Notice that only the format template can be combined with inline queries.
Here we ask for all articles that belong to the category City. The template Querytree simply contains a formatting instruction for second-level bullet points and the parameter {{{1}}}, which refers to the first printout statement.
<includeonly>
** {{{1}}}
</includeonly>
The tree will then be rendered as depicted in the following figure:
For more information on inline queries, see Inline Queries or the documentation on the Semantic MediaWiki Web site.
- Copyright © 2009 ontoprise GmbH.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the article "GNU Free Documentation License".





