Using results from an #ask as parameter in another #ask

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using results from an #ask as parameter in another #ask

Pål Habberstad
Hi!

If my first #ask returns has country=Country00001 (and this page has its
own properties), for example has name=Italy, has population=70.000.000
and so on. Can I use the text "Country00001" as a parameter in another
#ask, to get access to the properties of that page?

First #ask:

{{#ask:
[[Category:Europe]]
|?has country <- Country00001 is one of the rows returned
}}

Second #ask:

{{#ask:
[[Country00001]] <- set by parameter, but how?
|?has name
|?has population
}}

How can I pass the result from one #ask as a parameter to anohter?

Regards, Pål
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using results from an #ask as parameter in another #ask

James HK
Hi,

> If my first #ask returns has country=Country00001 (and this page has its
> own properties), for example has name=Italy, has population=70.000.000
> and so on. Can I use the text "Country00001" as a parameter in another
> #ask, to get access to the properties of that page?

Under the assumption that you use 2.5.*, you can employ an iterative
property chain as demonstrated by [0, 1] otherwise you would need the
template format to apply the second query onto the results of the
first.

[0] https://www.semantic-mediawiki.org/w/index.php?title=Special:Ask&x=-5B-5BCategory%3ACity-5D-5D-20-5B-5BLocated-20in%3A%3A%2B-5D-5D%2F-3FLocated-20in%2F-3FLocated-20in.population%3DHas-20population&format=broadtable&link=all&headers=show&searchlabel=...%20further%20results&class=sortable%20wikitable%20smwtable&offset=&limit=50&mainlabel=
[1] https://www.semantic-mediawiki.org/wiki/Help:Property_chains_and_paths

Cheers

On 5/21/17, Pål Habberstad <[hidden email]> wrote:

> Hi!
>
> If my first #ask returns has country=Country00001 (and this page has its
> own properties), for example has name=Italy, has population=70.000.000
> and so on. Can I use the text "Country00001" as a parameter in another
> #ask, to get access to the properties of that page?
>
> First #ask:
>
> {{#ask:
> [[Category:Europe]]
> |?has country <- Country00001 is one of the rows returned
> }}
>
> Second #ask:
>
> {{#ask:
> [[Country00001]] <- set by parameter, but how?
> |?has name
> |?has population
> }}
>
> How can I pass the result from one #ask as a parameter to anohter?
>
> Regards, Pål
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using results from an #ask as parameter in another #ask

Pål Habberstad
Thanks for the reply!

So there is no way to read the results from one query into variables? By
using the Extension:Variables I managed to use the variable as an parameter:

{{#vardefine:pageParameter|Area00003}}

{{#ask:
[[{{#var:pageParameter}}]]
|?Has description=Description
|?Har name=Name
}}

But I don't see how the result from a query can be put into the
{{#vardefine:pageParameter|QUERYRESULT HERE}}

Are there any examples on how to use the "template format to apply the
second query onto the results of the first"?

I'll explore the property chain more. Is it possible to "reach" pages
more than one page ahead this way? For example:

{{#ask:
[[Product00001]]
|?Has name=
|?Has tag=
|?Has price=
|?Has vendor.Has name
|?Has vendor.Has operatingsystem.Has name <- have to look up values from
two other pages
}}

Cheers
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Loading...