Last modified: 2014-08-06 14:57:42 UTC
While a query like {{#ask: [[{{PAGENAME}}]] | ?Category }} works flawlessly on a page (and returns the categories a page is in), it returns nothing on category pages (where it should list "parent" categories).
I can't directly see if this is a bug or not. Some notes: First, on page Category:Foo, {{PAGENAME}} returns "Foo". Thus, the query becomes {{#ask: [[Foo]] | ?Category }} If there is no page Foo, or it is in no category, then the result is empty. Second, should you specify {{#ask: [[Category:Foo]] | ?Category }} then you're essentially selecting all pages in category Foo, and asking in which categories each page is. However, I've tested with {{#ask: [[:Category:Foo]] | ?Category }} and got no results, where I expected one - so I'll leave it to Markus et al. to check things further.
Hi Jan, thanks for looking into this. You're right, {{#ask: [[{{PAGENAME}}]] | ?Category }} on a category page would not select "the page I (the query) am on", but instead the pages of that category... But what I actually meant was your third query - which should definitely return the parent categories as result, imo.
As of SMW 2.0 doing #ask/#show on a "Category" page results in: - {{#ask: [[{{FULLPAGENAME}}]] | ?Category }} will return all pages the Category is assigned to - {{#show: {{FULLPAGENAME}} |?Subcategory of }} will show all parent categories the category is assigned to