Tree format query does not render as a nested list

From semantic-mediawiki.org

Hi everyone,

I'm a bit of a SMW beginner and I was just recently playing around with this result format.

Unfortunately, I don't seem to understand how it is supposed to work.

If I take the example query from the help page and substitute Category:Place with Category:City, it just renders a plain, old unordered list without any nesting.

Example:

{{#ask: [[Category:City]] [[Located in::+]]
 | format = tree
 | parent = Located in
 | limit = 5
}}

Result:



Shouldn't the cities be grouped by country, or am I misunderstanding something here? Or do I need to include the parent pages in the query somehow?

14:46, 7 November 2017

The issue is that the countries e.g. Netherlands are not assigned to the "City" category. In your query you are asking for pages which are in the category "City" only. Have a look at more examples in the sandbox wiki.

15:05, 8 November 2017

Thanks for the reply. Seems like I overestimated what a result format can do.

Including a country in the query does indeed have the desired effect:

{{#ask:
 [[Germany]]
 OR
 [[Category:City]] [[Located in::Germany]]
 | format = tree
 | parent = Located in
 | limit = 5
}}

Result:



Nice :)

18:58, 8 November 2017

Some result formats indeed need a special data structure to work on. Here it appears more to be a matter of selecting pages. Have a look at inferencing too.

22:27, 8 November 2017