query members of 2 categories

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

query members of 2 categories

andre

Hello,

I have been using Mediawiki API on a few projects.
I now need to query the API for pages, members of 2 categories.
The pages have to be members of BOTH Category:Graduation_work and Category:2013

I've tried with:
api.php?format=json&action=query&list=categorymembers&cmlimit=500&cmtitle=Category:Graduation_work&cmtitle=Category:2013

but I realized that what the request is doing is asking only for the members of last category, that is Category:2013.

How could I request only the pages that are member of BOTH categories?


I have been searching, but found no answer.
Help would be very much appreciated :)
cheers
a


--
pinknoi.so
bibliotecha.info

--..,___.--,--'-,---..-.--+--.,,-,,...

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

Re: query members of 2 categories

Magnus Manske-2

On Thu, Apr 2, 2015 at 11:05 AM andre <[hidden email]> wrote:

Hello,

I have been using Mediawiki API on a few projects.
I now need to query the API for pages, members of 2 categories.
The pages have to be members of BOTH Category:Graduation_work and Category:2013

I've tried with:
api.php?format=json&action=query&list=categorymembers&cmlimit=500&cmtitle=Category:Graduation_work&cmtitle=Category:2013

but I realized that what the request is doing is asking only for the members of last category, that is Category:2013.

How could I request only the pages that are member of BOTH categories?


I have been searching, but found no answer.
Help would be very much appreciated :)
cheers
a


--
pinknoi.so
bibliotecha.info

--..,___.--,--'-,---..-.--+--.,,-,,...

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: query members of 2 categories

andre
Thanks Magnus,

Yes, it is expectable that no pages appear in both of these categories, as this was not a query Wikipedia to but a wiki
installation I work on, at http://pzwiki.wdka.nl/mw-mediadesign/

Do you know if it is possible to do the same kind of category intersection Quick Intersection performs, using the MW API?

a



On 04/02/2015 01:56 PM, Magnus Manske wrote:

> https://tools.wmflabs.org/quick-intersection/index.php?lang=en&project=wikipedia&cats=Graduation_work%0D%0A2013&ns=0&depth=12&max=30000&start=0&format=html&redirects=&callback=&norun
>
> (there don't appear to be any pages in both of these categories, though)
>
> On Thu, Apr 2, 2015 at 11:05 AM andre <[hidden email]> wrote:
>
>>
>> Hello,
>>
>> I have been using Mediawiki API on a few projects.
>> I now need to query the API for pages, members of 2 categories.
>> The pages have to be members of BOTH Category:Graduation_work and
>> Category:2013
>>
>> I've tried with:
>> api.php?format=json&action=query&list=categorymembers&
>> cmlimit=500&cmtitle=Category:Graduation_work&cmtitle=Category:2013
>>
>> but I realized that what the request is doing is asking only for the
>> members of last category, that is Category:2013.
>>
>> How could I request only the pages that are member of BOTH categories?
>>
>>
>> I have been searching, but found no answer.
>> Help would be very much appreciated :)
>> cheers
>> a
>>
>>
>> --
>> pinknoi.so
>> bibliotecha.info
>>
>> --..,___.--,--'-,---..-.--+--.,,-,,...
>>
>> _______________________________________________
>> 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
>


--
pinknoi.so
bibliotecha.info

--..,___.--,--'-,---..-.--+--.,,-,,...

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

Re: query members of 2 categories

bawolff

If you use list=search, and search for incategory:2013 incategory:Graduation_work, it should give you a list of things in both cats, provided the wiki has CirrusSearch installed (this includes all wikimedia wikis).

--bawolff
On Apr 2, 2015 9:12 AM, "andre" <[hidden email]> wrote:
>
> Thanks Magnus,
>
> Yes, it is expectable that no pages appear in both of these categories, as this was not a query Wikipedia to but a wiki
> installation I work on, at http://pzwiki.wdka.nl/mw-mediadesign/
>
> Do you know if it is possible to do the same kind of category intersection Quick Intersection performs, using the MW API?
>
> a
>
>
>
> On 04/02/2015 01:56 PM, Magnus Manske wrote:
> > https://tools.wmflabs.org/quick-intersection/index.php?lang=en&project=wikipedia&cats=Graduation_work%0D%0A2013&ns=0&depth=12&max=30000&start=0&format=html&redirects=&callback=&norun
> >
> > (there don't appear to be any pages in both of these categories, though)
> >
> > On Thu, Apr 2, 2015 at 11:05 AM andre <[hidden email]> wrote:
> >
> >>
> >> Hello,
> >>
> >> I have been using Mediawiki API on a few projects.
> >> I now need to query the API for pages, members of 2 categories.
> >> The pages have to be members of BOTH Category:Graduation_work and
> >> Category:2013
> >>
> >> I've tried with:
> >> api.php?format=json&action=query&list=categorymembers&
> >> cmlimit=500&cmtitle=Category:Graduation_work&cmtitle=Category:2013
> >>
> >> but I realized that what the request is doing is asking only for the
> >> members of last category, that is Category:2013.
> >>
> >> How could I request only the pages that are member of BOTH categories?
> >>
> >>
> >> I have been searching, but found no answer.
> >> Help would be very much appreciated :)
> >> cheers
> >> a
> >>
> >>
> >> --
> >> pinknoi.so
> >> bibliotecha.info
> >>
> >> --..,___.--,--'-,---..-.--+--.,,-,,...
> >>
> >> _______________________________________________
> >> 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
> >
>
>
> --
> pinknoi.so
> bibliotecha.info
>
> --..,___.--,--'-,---..-.--+--.,,-,,...
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: query members of 2 categories

andre
thank you so much bawolff.
I dont have yet CirrusSeach installed, so I couldn't test in the wiki I am working with.
However I tested it in Wikipedia, searching pages in both incategory:Synthpop & incategory:2010s_in_music:

https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=incategory:Synthpop&srsearch=incategory:2010s_in_music

I'll need to get CirrusSearch installed :)
cheers!


On 04/02/2015 03:00 PM, bawolff wrote:

> If you use list=search, and search for incategory:2013
> incategory:Graduation_work, it should give you a list of things in both
> cats, provided the wiki has CirrusSearch installed (this includes all
> wikimedia wikis).
>
> --bawolff
> On Apr 2, 2015 9:12 AM, "andre" <[hidden email]> wrote:
>>
>> Thanks Magnus,
>>
>> Yes, it is expectable that no pages appear in both of these categories,
> as this was not a query Wikipedia to but a wiki
>> installation I work on, at http://pzwiki.wdka.nl/mw-mediadesign/
>>
>> Do you know if it is possible to do the same kind of category
> intersection Quick Intersection performs, using the MW API?
>>
>> a
>>
>>
>>
>> On 04/02/2015 01:56 PM, Magnus Manske wrote:
>>>
> https://tools.wmflabs.org/quick-intersection/index.php?lang=en&project=wikipedia&cats=Graduation_work%0D%0A2013&ns=0&depth=12&max=30000&start=0&format=html&redirects=&callback=&norun
>>>
>>> (there don't appear to be any pages in both of these categories, though)
>>>
>>> On Thu, Apr 2, 2015 at 11:05 AM andre <[hidden email]> wrote:
>>>
>>>>
>>>> Hello,
>>>>
>>>> I have been using Mediawiki API on a few projects.
>>>> I now need to query the API for pages, members of 2 categories.
>>>> The pages have to be members of BOTH Category:Graduation_work and
>>>> Category:2013
>>>>
>>>> I've tried with:
>>>> api.php?format=json&action=query&list=categorymembers&
>>>> cmlimit=500&cmtitle=Category:Graduation_work&cmtitle=Category:2013
>>>>
>>>> but I realized that what the request is doing is asking only for the
>>>> members of last category, that is Category:2013.
>>>>
>>>> How could I request only the pages that are member of BOTH categories?
>>>>
>>>>
>>>> I have been searching, but found no answer.
>>>> Help would be very much appreciated :)
>>>> cheers
>>>> a
>>>>
>>>>
>>>> --
>>>> pinknoi.so
>>>> bibliotecha.info
>>>>
>>>> --..,___.--,--'-,---..-.--+--.,,-,,...
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>
>>
>> --
>> pinknoi.so
>> bibliotecha.info
>>
>> --..,___.--,--'-,---..-.--+--.,,-,,...
>>
>> _______________________________________________
>> 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
>


--
pinknoi.so
bibliotecha.info

--..,___.--,--'-,---..-.--+--.,,-,,...

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

Re: query members of 2 categories

bawolff

You need to have both in a single srsearch parameter. E.g. https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=incategory:Synthpop+incategory:2010s_in_music

--bawolff
On Apr 3, 2015 7:07 AM, "andre" <[hidden email]> wrote:
>
> thank you so much bawolff.
> I dont have yet CirrusSeach installed, so I couldn't test in the wiki I am working with.
> However I tested it in Wikipedia, searching pages in both incategory:Synthpop & incategory:2010s_in_music:
>
> https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=incategory:Synthpop&srsearch=incategory:2010s_in_music
>
> I'll need to get CirrusSearch installed :)
> cheers!
>
>
> On 04/02/2015 03:00 PM, bawolff wrote:
> > If you use list=search, and search for incategory:2013
> > incategory:Graduation_work, it should give you a list of things in both
> > cats, provided the wiki has CirrusSearch installed (this includes all
> > wikimedia wikis).
> >
> > --bawolff
> > On Apr 2, 2015 9:12 AM, "andre" <[hidden email]> wrote:
> >>
> >> Thanks Magnus,
> >>
> >> Yes, it is expectable that no pages appear in both of these categories,
> > as this was not a query Wikipedia to but a wiki
> >> installation I work on, at http://pzwiki.wdka.nl/mw-mediadesign/
> >>
> >> Do you know if it is possible to do the same kind of category
> > intersection Quick Intersection performs, using the MW API?
> >>
> >> a
> >>
> >>
> >>
> >> On 04/02/2015 01:56 PM, Magnus Manske wrote:
> >>>
> > https://tools.wmflabs.org/quick-intersection/index.php?lang=en&project=wikipedia&cats=Graduation_work%0D%0A2013&ns=0&depth=12&max=30000&start=0&format=html&redirects=&callback=&norun
> >>>
> >>> (there don't appear to be any pages in both of these categories, though)
> >>>
> >>> On Thu, Apr 2, 2015 at 11:05 AM andre <[hidden email]> wrote:
> >>>
> >>>>
> >>>> Hello,
> >>>>
> >>>> I have been using Mediawiki API on a few projects.
> >>>> I now need to query the API for pages, members of 2 categories.
> >>>> The pages have to be members of BOTH Category:Graduation_work and
> >>>> Category:2013
> >>>>
> >>>> I've tried with:
> >>>> api.php?format=json&action=query&list=categorymembers&
> >>>> cmlimit=500&cmtitle=Category:Graduation_work&cmtitle=Category:2013
> >>>>
> >>>> but I realized that what the request is doing is asking only for the
> >>>> members of last category, that is Category:2013.
> >>>>
> >>>> How could I request only the pages that are member of BOTH categories?
> >>>>
> >>>>
> >>>> I have been searching, but found no answer.
> >>>> Help would be very much appreciated :)
> >>>> cheers
> >>>> a
> >>>>
> >>>>
> >>>> --
> >>>> pinknoi.so
> >>>> bibliotecha.info
> >>>>
> >>>> --..,___.--,--'-,---..-.--+--.,,-,,...
> >>>>
> >>>> _______________________________________________
> >>>> 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
> >>>
> >>
> >>
> >> --
> >> pinknoi.so
> >> bibliotecha.info
> >>
> >> --..,___.--,--'-,---..-.--+--.,,-,,...
> >>
> >> _______________________________________________
> >> 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
> >
>
>
> --
> pinknoi.so
> bibliotecha.info
>
> --..,___.--,--'-,---..-.--+--.,,-,,...
>
> _______________________________________________
> 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