For categories, list=backlinks&blnamespace=14 returns the categories that link to the specified page -- that is, categories whose descriptions link to that page -- whereas prop=categories returns the categories that contain the specified page. These are two distinct relationships.
For portals, the software has no built-in notion of a portal "containing" a page, but you've defined it this way:
>
The <links> element contains <pl> items in namespaces 0
(articles), 14 (categories), and 100 (portals). I interpret that as
"Portal:Novels contains these items", meaning that in tree terms it is
the parent of those items, or that those items "belong to
Portal:Novels".
That is, by your definition, "portal X links to page Y" and "portal X contains page Y" are the same relationship. So list=backlinks&blnamespace=100 (which returns the portal pages that link to the specified page) is equivalent to your hypothetical prop=portals (which would return the portal pages that contain the specified page).
Does that make sense?
-Ran Ari-Gur
(user "Ruakh" on WMF projects)
I'm sorry, I didn't mean to criticize. What I was trying to do is to validate that list=backlinks and prop=categories are querying for the same relationship if the backlinks namespace is set for categories, using blnamespace=14. If they were two ways to query for the same relationship between pages, then the results should be the same, but they are not.
I've been able to verify that prop=categories returns the correct relationship, because the inverse (list=categorymembers) returns the inverse result. If prop=categories indicates that A is a parent of B, then list=categorymembers correctly indicates that B is a child of A.
So what I'm trying to do is find the same relationship for portal pages (namespace=100). list=categorymembers also correctly returns the children who are portals, but I don't know how to find the parents that are portals.
Thanks in advance,
Robert
-----Original Message-----
From: Andre Engels [mailto:andreengels@gmail.com]
Sent: Sunday, March 20, 2011 10:15 AM
To: Robert Crowe
Cc: MediaWiki API announcements & discussion
Subject: Re: [Mediawiki-api] Portals vs categories
On Sun, Mar 20, 2011 at 5:43 PM, Robert Crowe <robert@ourwebhome.com> wrote:
> Thanks André, but after testing it seems that backlinks returns something else. For example this query:
>
> http://en.wikipedia.org/w/api.php?action=query&titles=Category:Voltaire&prop=categories
>
> Returns:
>
> <query>
> <pages>
> <page pageid="3465227" ns="14" title="Category:Voltaire">
> <categories>
> <cl ns="14" title="Category:Categories named after French people" />
> <cl ns="14" title="Category:Categories named after philosophers" />
> <cl ns="14" title="Category:Categories named after writers" />
> </categories>
> </page>
> </pages>
> </query>
>
> But this query:
>
> http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitle=Category:Voltaire&blnamespace=14&bllimit=500
>
> Returns:
>
> <query>
> <backlinks />
> </query>
>
> If I just use "Voltaire" instead of "Category:Voltaire" then I think it's looking at a different page, right? The results are different, and don't match the first query results:
>
> <query>
> <backlinks>
> <bl pageid="3465227" ns="14" title="Category:Voltaire" />
> <bl pageid="15582893" ns="14" title="Category:Novels by Voltaire" />
> </backlinks>
> </query>
You criticize my request because another request does not give the
same result as a third request... I understand less and less of what
you are trying to do.
--
André Engels, andreengels@gmail.com
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api