Excluding hidden super-categories

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

Excluding hidden super-categories

Max Vlasov
Hi, 

my software uses sub- and super- category enumeration while trying to avoid hidden categories. There's no problem with sub- (?action=query&prop=categories&titles=....&clshow=!hidden), but there's no corresponding parameter for super-categories ( ?action=query&list=categorymembers&cmtitle= ... ). Is there a way to avoid contradictory states when both are used? Or maybe to achieve hidden avoiding for super-categories some other way?

I asked about this four years ago, but not at the list (https://www.mediawiki.org/wiki/Topic:Ra34est5vsl7fxdc), no answers at the time, probably something changed since then or someone would give me some workaround

Thanks in advance,

Max

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

Re: Excluding hidden super-categories

Bartosz Dziewoński
You can use 'categorymembers' as a generator, and use 'prop=categoryinfo' to display information about whether each category is hidden. You can't use this to filter the results, but you can do that in your application code and it still saves a lot of extra queries.

Example:
https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=categoryinfo&generator=categorymembers&formatversion=2&gcmtitle=Category%3AWikipedia_article_cleanup&gcmtype=subcat&gcmlimit=max

On Tue, Jun 27, 2017 at 4:26 PM, Max Vlasov <[hidden email]> wrote:
Hi, 

my software uses sub- and super- category enumeration while trying to avoid hidden categories. There's no problem with sub- (?action=query&prop=categories&titles=....&clshow=!hidden), but there's no corresponding parameter for super-categories ( ?action=query&list=categorymembers&cmtitle= ... ). Is there a way to avoid contradictory states when both are used? Or maybe to achieve hidden avoiding for super-categories some other way?

I asked about this four years ago, but not at the list (https://www.mediawiki.org/wiki/Topic:Ra34est5vsl7fxdc), no answers at the time, probably something changed since then or someone would give me some workaround

Thanks in advance,

Max

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




--
Matma Rex

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

Re: Excluding hidden super-categories

Max Vlasov
Thanks, Bartosz.

I will probably use such method, at least it allows filtering of some kind.

It's interesting that "Contents" is a hidden category, this was a part of my problem.
I'm not sure now what should I use as a root (roots) of the category explorer. The task is more complex since I need it to be language agnostic. Currently the root is Contents and it is retrieved for any language from the page api.php?action=query&titles=Category:Contents&prop=langlinks.
Is the category "Articles" is more suitable for the task, being the direct sub-category of Contents, not hidden?

Max





On Tue, Jun 27, 2017 at 6:00 PM, Bartosz Dziewoński <[hidden email]> wrote:
You can use 'categorymembers' as a generator, and use 'prop=categoryinfo' to display information about whether each category is hidden. You can't use this to filter the results, but you can do that in your application code and it still saves a lot of extra queries.

Example:
https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=categoryinfo&generator=categorymembers&formatversion=2&gcmtitle=Category%3AWikipedia_article_cleanup&gcmtype=subcat&gcmlimit=max

On Tue, Jun 27, 2017 at 4:26 PM, Max Vlasov <[hidden email]> wrote:
Hi, 

my software uses sub- and super- category enumeration while trying to avoid hidden categories. There's no problem with sub- (?action=query&prop=categories&titles=....&clshow=!hidden), but there's no corresponding parameter for super-categories ( ?action=query&list=categorymembers&cmtitle= ... ). Is there a way to avoid contradictory states when both are used? Or maybe to achieve hidden avoiding for super-categories some other way?

I asked about this four years ago, but not at the list (https://www.mediawiki.org/wiki/Topic:Ra34est5vsl7fxdc), no answers at the time, probably something changed since then or someone would give me some workaround

Thanks in advance,

Max

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




--
Matma Rex

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



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