From SMW+ Semantic Enterprise Wiki

Jump to: navigation, search
Procedure: Trees Using Inline Queries
<StarRating/>
Applies to version
This documentation page applies to all SMW+ versions from 1.4.2 to the most current version.
     

Trees Using Inline Queries 1.4.2

Description
  • How to create trees using inline queries


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:

Tree Driven by an Inline Query

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".

This page was last modified on 13 March 2009, at 14:46.This page has been accessed 535 times.
toolstools
tools
SemanticTreeview close tree