Thanks a lot for your answer. By the way, is there any extension needed to run sub-queries?


2012/11/9 Markus Krötzsch <>
On 09/11/12 09:37, Yury Katkov wrote:
Well you can also use template format if you don't like subqueries... It
would also help you to use the intermediate results.

That would let you "see" the intermediate results (otherwise, there is no way to find out which of, say, the "has C" values was "responsible" for having a line in the result). If you really need this, and the information cannot be retrieved later (e.g. if you know that there is only one "has C" on any page anyway), then templates might help.

However, using templates with queries to format other queries is generally a bad approach that is extremely inefficient and will use a lot of memory and CPU to display a page (results are fetched from the database, rendered as wikitext, re-parsed as queries, which are used to fetch more results, ...); it will only work at all of your inner results are very limited in number.


On Wed, Nov 7, 2012 at 5:44 PM, 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>]]

    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,


    LogMeIn Central: Instant, anywhere, Remote PC access and management.
    Stay in control, update software, and manage PCs from one command center
    Diagnose problems and improve visibility into emerging IT issues
    Automate, monitor and manage. Do more in less time with Central
    Semediawiki-devel mailing list

Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:

Semediawiki-devel mailing list