User:DexDor/Namespaces and categories
{{Categorization essay|User:DexDor/NSCat}}
Every Wikipedia page (e.g. an article, a talk page or even a redirect) is in a single namespace. Many/most Wikipedia pages are also in one or more categories. This essay contains the results of an analysis of how these 2 schemes interact - i.e. how pages in each namespace fit into the category structure. In particular, it identifies combinations of namespace and category that are not valid for any pages - for example, there should be no user talk pages below :Category:Articles and there should be no articles below :Category:Wikipedians.
This analysis only considers the combination of namespace and some of the highest level Wikipedia categories - e.g. :Category:Wikipedia books and :Category:Disambiguation pages. A diagram showing the relevant part of the category structure can be found below the table.
Namespace-category matrix
Note: The information in this matrix should not be used directly to support an argument about whether or not a particular page should be in a parent category. However, this matrix may indicate where the applicable policy/guideline can be found.
The analysis was carried out in 2014-2016 using category intersection tools. Some aspects of the analysis are currently incomplete and may not incorporate later changes to the categorization structure.
=Explanation of matrix=
The matrix is designed so that each page in the English Wikipedia satisfies the criteria for one (and only one) of the rows.Note: Currently there may be a small number of pages that don't fit any row of this matrix. Which row a page matches is determined primarily by which namespace the page is in; for some namespaces other criteria are also considered -
- Some rows are only applicable to disambiguation pages (i.e. pages that are under :Category:Disambiguation pages) or non-disambiguation pages. The column headed "D?" indicates whether each row includes disambiguation pages - "Y" means only dab pages, "N" means excluding dab pages and "-" means either.
- Some rows are only applicable to hard redirects or to pages that are not hard redirects. The column headed "R?" indicates whether each row includes hard redirects. "Y" means only hard redirects, "N" means excluding hard redirects and "-" means either.
- Some rows are only applicable to subpages. The column headed "S?" indicates whether each row includes subpages. "Y" means only subpages, "N" means excluding subpages and "-" means either. Subpages are not allowed in some namespaces.
- Some rows are only applicable to pages that are, or are not, in certain categories.
Having identified which row of the matrix a page belongs to the coloured cells on that row then indicate which high-level categories the page should/may be in (green cells) and should not be in (pink cells). The matrix can also be used in the opposite way; for a particular high-level category it is possible to go down the corresponding column to see what types of pages are expected to be in that category. Amber cells indicate where there is currently uncertainty about whether or not that is a valid combination. A more detailed key to the colours is provided below the matrix.
Note: Some pages belong in several columns and a small number of pages don't belong in any of the (current) columns.{{Efn|E.g. many of the pages that are directly in :Category:Wikipedia disambiguation.}}
=Matrix=
:Note: watchlisting this page will not show changes to the matrix - for that it's necessary to watchlist a separate page.
{{User:DexDor/Cmtp|3}}Note: After the template has been changed it may be necessary to {{purge}} this page.
=Top-level category structure=
The diagram below shows some (probably the most important) categories at the top levels of the category structure. The two-letter codes are those used in the matrix above.
{{User:DexDor/Cttp|
(C|)}}
Finding and fixing anomalies
Category intersection tools can be used to detect pages that are at an anomalous combination of namespace and high level categories; the appropriate changes to the categorization can then be made. Links to some category intersection queries and advice on fixing the mis-categorizations discovered can be found at User:DexDor/FHL.
The matrix above shows that there are some pairs of columns for which there are no types of pages, apart from category pages, that are valid in both of those columns. For example, there are no rows for which there is a green cell in both the CA and CE columns - i.e. there should be no pages in both :Category:Articles and :Category:Wikipedia essays. Thus, there should be no categories at that intersection. This can be checked using a category intersection [https://petscan.wmflabs.org/?language=en&project=wikipedia&depth=5&categories=Wikipedia%20essays%0D%0AArticles&ns%5B14%5D=1&output_compatability=quick-intersection&interface_language=en&active_tab= query] on the Category namespace. However, it's rare to find categories mis-categorized in this way so in general it's best just to look for (non-category) pages that are at an anomalous namespace/category combination as that will also uncover most incorrectly categorized categories (assuming that the category contains at least one page).
Maintenance of the matrix
The namespace-category matrix shown above is generated using a template (User:DexDor/Cmtp). The advantage of using a template rather than placing the details directly in this page is that parameters can be used to control how the template is displayed - thus, the template can generate both the compact format shown above and a longer more detailed format used during development/maintenance of the matrix. There is also a similar template which expands the CA column into lower level article categories.
To be done:
- Remove all unnecessary detail (including references) from the compact format of the matrix.
- Fix all "TBD"s (if possible).
- Have the number of months before a cell is flagged as "OLD" depend on the importance (e.g. whether it affects CA and how often pages get put in it).
- Ensure every "no" cell as a "N" note.
- Ensure every "tbd" cell as a "T" note.
- Ensure every "some"/"all" cell is linked to at least one example.
- Refresh all "OLD" cells.
- Seek suggestions for improvements from other editors.
- Consider whether checking of some cells could be improved by AWB, bots or database reports.
- Move from User namespace to Wikipedia namespace (but would then have to explain each edit, length might increase unless use short names for templates).
- Make other language Wikipedias aware of this (sharing ideas).
- Improve the documentation of the templates used in this.
- Should any more rows be split?
- Reduce the number of pages that don't match any row.
- Complete the diagram showing the top of the category hierarchy (and simplify that where possible).
Comments (e.g. about the status of a particular namespace-category combination or about the formatting of this page) are welcome on the talk page.
See also
Notes
{{Notelist|30em}}
References
{{Reflist}}