I'm able to list the categories that a page belongs to, and the categories that a category contains. I'm also able to list the portals that a category contains, but I can't seem to find a way to list the portals that a page or category belongs to. Is there a way to do that?
Thanks in advance,
Robert
On Sat, Mar 19, 2011 at 7:49 PM, Robert Crowe robert@ourwebhome.com wrote:
I'm able to list the categories that a page belongs to, and the categories that a category contains. I'm also able to list the portals that a category contains, but I can't seem to find a way to list the portals that a page or category belongs to. Is there a way to do that?
What does it mean for a page or category to "belong to a portal"?
I think of this as a tree, even though I know it's a graph. If I send a query like this:
http://en.wikipedia.org/w/api.php?action=parse&page=Portal:Novels
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".
If I send a query like this:
http://en.wikipedia.org/w/api.php?cmtitle=Category:Literature&action=que...
The <categories> element contains <cl> items that are the categories that contain Category:Literature, the parent categories. Similarly for pages.
So I'm able to list the categories that are the parents of a given category or page, but I can't seem to find a way to list the portals that are the parents of a given category or page. Is there a way to do that? Basically I'm just trying to navigate the tree.
Thanks in advance,
Robert
-----Original Message----- From: Andre Engels [mailto:andreengels@gmail.com] Sent: Saturday, March 19, 2011 12:44 PM To: MediaWiki API announcements & discussion Cc: Robert Crowe Subject: Re: [Mediawiki-api] Portals vs categories
On Sat, Mar 19, 2011 at 7:49 PM, Robert Crowe robert@ourwebhome.com wrote:
I'm able to list the categories that a page belongs to, and the categories that a category contains. I'm also able to list the portals that a category contains, but I can't seem to find a way to list the portals that a page or category belongs to. Is there a way to do that?
What does it mean for a page or category to "belong to a portal"?
On Sun, Mar 20, 2011 at 2:58 AM, Robert Crowe robert@ourwebhome.com wrote:
I think of this as a tree, even though I know it's a graph. If I send a query like this:
http://en.wikipedia.org/w/api.php?action=parse&page=Portal:Novels
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".
If I send a query like this:
http://en.wikipedia.org/w/api.php?cmtitle=Category:Literature&action=que...
The <categories> element contains <cl> items that are the categories that contain Category:Literature, the parent categories. Similarly for pages.
So I'm able to list the categories that are the parents of a given category or page, but I can't seem to find a way to list the portals that are the parents of a given category or page. Is there a way to do that? Basically I'm just trying to navigate the tree.
http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitl...
(replace Voltaire by whichever page you're interested in)
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&...
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&bltitl...
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>
Thanks in advance,
Robert
-----Original Message----- From: Andre Engels [mailto:andreengels@gmail.com] Sent: Saturday, March 19, 2011 11:08 PM To: MediaWiki API announcements & discussion Cc: Robert Crowe Subject: Re: [Mediawiki-api] Portals vs categories
On Sun, Mar 20, 2011 at 2:58 AM, Robert Crowe robert@ourwebhome.com wrote:
I think of this as a tree, even though I know it's a graph. If I send a query like this:
http://en.wikipedia.org/w/api.php?action=parse&page=Portal:Novels
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".
If I send a query like this:
http://en.wikipedia.org/w/api.php?cmtitle=Category:Literature&action=que...
The <categories> element contains <cl> items that are the categories that contain Category:Literature, the parent categories. Similarly for pages.
So I'm able to list the categories that are the parents of a given category or page, but I can't seem to find a way to list the portals that are the parents of a given category or page. Is there a way to do that? Basically I'm just trying to navigate the tree.
http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitl...
(replace Voltaire by whichever page you're interested in)
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&...
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&bltitl...
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.
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&...
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&bltitl...
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.
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)
On Sun, Mar 20, 2011 at 1:42 PM, Robert Crowe robert@ourwebhome.com wrote:
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&...
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&bltitl...
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
Thanks Ran! Yes, that makes perfect sense. I was unclear about what exactly a portal is, whether it is like more like a category or more like a page. My hope was that it included the notion of "containing" other things, like categories do, but you've clarified that portals do not include that, and that categories list=backlinks&blnamespace=14 and prop=categories return two distinct relationships.
Thanks again,
Robert
-----Original Message----- 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)
?action=query&list=backlinks and filter the pagenames to what ever you consider a "portal", such as a page starting with "Portal:" or being in some sort of portal namespace
On Sat, Mar 19, 2011 at 2:49 PM, Robert Crowe robert@ourwebhome.com wrote:
I'm able to list the categories that a page belongs to, and the categories that a category contains. I'm also able to list the portals that a category contains, but I can't seem to find a way to list the portals that a page or category belongs to. Is there a way to do that?
Thanks in advance,
Robert
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org