categorymembers as both generator and list

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

categorymembers as both generator and list

Magnus Manske-2
Hi,

I want use the api to list all pages that are in any of the categories
which are in Category:Category_redirects on commons. So I tried

http://commons.wikimedia.org/w/api.php?action=query&generator=categorymembers&gcmcategory=Category_redirects&list=categorymembers&gcmnamespace=14

but apparently it's not that easy...

IMHO "list=categorymembers" should not insist on "cmcategory", but
rather try to fall back to the generator list.

Additionally, the 500 limit could be imposed on the actual output; as
the generator is internal, it could have 5000 or unlimited (depending
on context).

Cheers,
Magnus

_______________________________________________
Mediawiki-api mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|

Re: categorymembers as both generator and list

Yuri Astrakhan
Magnus, this is done because categories (as well as all other lists)
are potentially huge in size, and might require paging. You do not
want to be in a situation where you asked for many titles, but only
retrieved some of the data for just the first - because then you will
have to continue from that point, plus re-submit all other items.

Now imagine that a generator made that list - so every time the
generator will have to remake that list, just so that the query may
continue from the parts of the first item.

All this may create extremely in-efficient execution. Hence, it is
easier for the client to make one request to get a list of categories,
and more requests to get info for each category.

On 7/16/07, Magnus Manske <[hidden email]> wrote:

> Hi,
>
> I want use the api to list all pages that are in any of the categories
> which are in Category:Category_redirects on commons. So I tried
>
> http://commons.wikimedia.org/w/api.php?action=query&generator=categorymembers&gcmcategory=Category_redirects&list=categorymembers&gcmnamespace=14
>
> but apparently it's not that easy...
>
> IMHO "list=categorymembers" should not insist on "cmcategory", but
> rather try to fall back to the generator list.
>
> Additionally, the 500 limit could be imposed on the actual output; as
> the generator is internal, it could have 5000 or unlimited (depending
> on context).
>
> Cheers,
> Magnus
>
> _______________________________________________
> Mediawiki-api mailing list
> [hidden email]
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>

_______________________________________________
Mediawiki-api mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|

how to emulate Special:Categories

jidanni
What parameters should I use to
http://radioscanningtw.jidanni.org/api.php to get the same results as
http://radioscanningtw.jidanni.org/index.php?title=Special:Categories&offset=5
I.e., all categories (whose category pages MAY be empty), whose names
start with "5"?

Or how about just how to emulate
http://radioscanningtw.jidanni.org/index.php?title=Special:Categories ?

_______________________________________________
Mediawiki-api mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|

Re: how to emulate Special:Categories

Daniel Cannon
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[hidden email] wrote:
> What parameters should I use to
> http://radioscanningtw.jidanni.org/api.php to get the same results as
> http://radioscanningtw.jidanni.org/index.php?title=Special:Categories&offset=5
> I.e., all categories (whose category pages MAY be empty), whose names
> start with "5"?
>
> Or how about just how to emulate
> http://radioscanningtw.jidanni.org/index.php?title=Special:Categories ?

You're probably looking for a query along the lines of
<http://radioscanningtw.jidanni.org/api.php?action=query&list=allpages&apnamespace=14&apfrom=5>.

- --
Daniel Cannon (AmiDaniel)

http://amidaniel.com
[hidden email]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHHsovFRAT5u/mSaMRAgGFAJ4t9zGu1RXiwel8xWlFIOhtFOH7hwCeJtMh
VN7bIWOUaSpCwfT7BbZC/gk=
=/UVs
-----END PGP SIGNATURE-----

_______________________________________________
Mediawiki-api mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|

Re: how to emulate Special:Categories

jidanni
DC> You're probably looking for a query along the lines of
DC> <http://radioscanningtw.jidanni.org/api.php?action=query&list=allpages&apnamespace=14&apfrom=5>.

Mwhahahaha, does that look anything like the content of
>> http://radioscanningtw.jidanni.org/index.php?title=Special:Categories&offset=5 ?

Didn't I say
> I.e., all categories (whose category pages MAY be empty) ?

_______________________________________________
Mediawiki-api mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|

Re: how to emulate Special:Categories

Roan Kattouw
In reply to this post by jidanni
[hidden email] schreef:

> What parameters should I use to
> http://radioscanningtw.jidanni.org/api.php to get the same results as
> http://radioscanningtw.jidanni.org/index.php?title=Special:Categories&offset=5
> I.e., all categories (whose category pages MAY be empty), whose names
> start with "5"?
>
> Or how about just how to emulate
> http://radioscanningtw.jidanni.org/index.php?title=Special:Categories ?
>
>  
Currently, that feature doesn't exist. I'll write list=allcategories
when I have time, probably next Monday or Tuesday.

Roan Kattouw

_______________________________________________
Mediawiki-api mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-api