On 07/11/12 13:44, Marcelo Chiaradía wrote:
> 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?

This is the right way. We are open to proposals for nicer looking 
syntax, but the general approach is correct.

>
> 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?

You need to omit the [[has att1::...]] altogether if you do not want any 
restriction on this property. You can use an #ifeq to do this whenever 
{{SOME_VALUE}} is empty.

Cheers,

Markus



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to