Hi everyone,

I'm trying to make an #ask query, using intermediates results to do more queries within.

I have this scenario:

I have several pages of a category A. Some of them are related to other pages of category B, through a "has B" property. Then, my B pages are related to pages of category C, through "has C" property, and finally my C pages have an attribute "att1", through "has att1" property, wich has defined a specific set of values.

I would like to make an "ask" query, asking for all my A pages, whose must have at least one B page, which must have at least one C page, and which must have the "att1 = SOME_VALUE", where some value should be a parameter.

I read about subqueries, doing something like:

{{#ask: [[Category::A]] [[has B::<q>[[Category::B]] [[has C::
                                                                                   <q>[[Category::C]] [[has att1::{{SOME_VALUE}}]]</q>]]
                                             </q>]]
|?att1
}}

Is this the right way to do this? is there a more elegant way?

One other thing, I would like that if the user doesn't complete the "SOME_VALUE" parameter, then return all the pages of category A. I tried this with the "+" and "*" characters, but didnt work. How is the best way to achieve this?

Thanks a lot in advance,

Marcelo.