Thanks Roan.
Roan Kattouw wrote:
Aryeh Gregor schreef: http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=...
Note that namespaces with an ID of 100 or higher are specific to enwiki and may have different names or not be used at all on other wikis. To get an accurate list for another wiki, ask that wiki's api.php .
Your above link helped me a lot. I am only concerned about the English Version of the Wikipedia – so I think that is all I need. I was afraid that there might have been other values of “namespace” but the result of
SELECT page_namespace, page_title FROM wikidb.page WHERE (page_namespace < -2 OR page_namespace >15) AND page_namespace != 100 AND page_namespace != 101;
confirms that there are no custom namespaces other than those listed in your Link. So I am good here.
As for redirects: yes, you'll want to do something like:
SELECT page_namespace, page_title, rd_namespace, rd_title FROM page LEFT JOIN redirect ON rd_from=page_id;
Actually you simply need a JOIN here i.e. Inner Join (that would eliminate the NULLs) something like
SELECT page_namespace, page_title, rd_namespace, rd_title FROM wikidb.page JOIN wikidb.redirect ON rd_from=page_id;
(NOTE: I did not rebuild the Redirect Table, but I simply imported it as it is provided in SQL format with the other Wiki Dumps.)
My problem is the following:
I cannot understand why there are more redirects in the redirect table than there are in the pages in the Page table with the redirect flag set.
select count(*) from wikidb.redirect ; --- Gives 3422938
while
select count(*) from wikidb.page where page_is_redirect=1; --- Gives 3242340
Why should there be this difference? Are there redirects that are not listed in the Page Table?
Also SELECT count(*) FROM wikidb.page JOIN wikidb.redirect ON rd_from=page_id; --- Gives 3210708
Any ideas why the difference? Thanks again, O. O.