Wikipedia:Category intersection/Transclude intersections into categories

This is one variant for a proposed category intersection feature.

Mockups

 * Intersection page before it is named: Intersection:Actor::American people::People of African descent]]
 * Category page after being associated with an intersection: Category:African-American actors]]
 * Intersection page after it is named; Intersection:Actor::American people::People of African descent]]

Defining categories as intersections
Once an intersection page is displayed, the user will be able to assign it to a category by entering a new category name. At the bottom of the page there would be the prompt, "Wikipedia does not currently have a category like this. If you would like to create a new subcategory that is the intersection of these categories:  {list of selected categories}, enter a name for the category here _______ and select 'create'". Etc...

There would also be instructions and links to the relevant policies. If the user enters the name of a category page that already exists they would be informed and asked to enter a different name, or abort. If a category name already exists only an administrator will be able to assign an intersection to the category or make other changes to the intersection (more about this below).

Once a valid name is entered the category page would be created. The user would then have the opportunity to edit this page. The procedure for editing category pages would not change. The user could add descriptive text and categories.

Once linked by this process, the intersection would be automatically transcluded whenever the category page is displayed. Likewise, the category page would be displayed whenever the corresponding intersection set is requested by checking off categories listed at the bottom of an article.

Categories that are defined as the intersection of primary categories will not need to have any articles in them. Instead they will create a list of articles on the fly that match the defined intersection. For example, the category Category:African American actors would be defined as the intersection of Category:Actors and Category:American people and Category:People of African descent. The resulting intersection will be all actors who are also Americans, who are also people of African descent.

Managing categories
Administrators will be able to edit and delete Intersection pages. Intersection pages, once created, will contain a link to the linked category page as well as the option of having some other parameters. The page would be editable text, just like other Wikipedia pages. For example, the intersection page Intersection:Actors::American people::People of African descent might have this text:


 * Category=African American actors
 * Sort=American people
 * Copy=Yes
 * Depopulate=Yes
 * SubcatCopy=No
 * SubcatDepopulate=No

The first parameter "Category=" is the category to which the intersection page gets transcluded. Whenever a category gets renamed, the linked intersection page would also need to be edited to reflect the name change. Adding this level of indirection makes it very easy to rename categories that are defined as intersections. No articles would have to be edited because they will remain in the same primary categories.

The second parameter "Sort=" tells the software which category to use as the sort order (piping). If not defined, the first categories sort order will be used.

It would be very useful with this proposal to have the software or a bot automatically move miscategorized articles to the correct primary categories. This could be done by adding the "Copy" and "Depopulate" flags to the Intersection page. The "Copy" parameter tells the software to copy all articles put in the linked category to the parent categories of the intersection. The "Depopulate" parameter tells the software to remove any articles placed in the category. If both are used, the category will be depopulated after copying the articles to the parents. (If any of these flags are missing, the default is "No".) In the example above, any articles that get added to Category:African American actors would be automatically copied to Category:Actors, Category:American people and Category:People of African descent and then removed from Category:African American actors.

The ability to turn an existing category into an intersection category is part of the elegance of the system. Only an administrator would be able to do this because an on-the-fly intersection cannot be assigned to a category that already exists. So the process is that there has to be agreement to change the nature of the category, perhaps occurring at WP:CFD, and then an administrator edits the intersection page and sets the flag to copy and depopulate the articles. The software will copy all the articles to the categories specified by the linked intersection as the converted category is depopulated. Part of the process of changing a category would be checking to see that all the articles in the category will actually belong in the parents, and creating a "See also:" section for articles that should remain associated with the category. In the example above it might be an eponymous article or list (List of African-Amreican actors).

Once the parameters are set, if someone miscategorizes an article into a category that is linked to an intersection, the software or bot would move it to its correct categories. If there is a time lag, the category could be listed in grey to show that it will not be there for long.

This system will also make it much easier to maintain the categorization system. When any category gets renamed, it can be easily moved by editing the intersection between the category with old name and the category with the new name. The parameters for Intersection:New name::Old name would be set as follows:


 * Category=Old Name
 * Sort=Old Name
 * Copy=Yes
 * Depopulate=Yes
 * SubcatCopy=Yes
 * SubcatDepopulate=Yes

Note that by also placing a redirect in the category page, a completely functional category redirect would be in place. All miscategorized articles will end up categorized in the correct primary categories, and people looking for the misnamed category will be redirected to the correct one.

If one primary category is a subset of another, the parameters can be set so that any articles added to the smaller set will also be added to the larger set. For example, the intersection of Actors and Film actors could be set so that any article added to Film actors gets added to Actors as well. The setting to do this would be as follows:


 * Category=Film actors
 * Sort=Film actors
 * Copy=Yes
 * Depopulate=No
 * SubcatCopy=No
 * SubcatDepopulate=No

It is also possible to set the parameters to delete a category by editing any intersection using the category as follows:


 * Category=Name of category to be deleted
 * Copy=no
 * Depopulate=Yes
 * SubcatCopy=No
 * SubcatDepopulate=Yes

Templates can be created to simplify this process. For instance there could be intersection templates for "Move", "Redirect", "Duplicate" and "Delete" that would set the parameters correctly.

Protecting the system: Administrator edits of category intersections
All the powerful features of this option are in the new intersection namespace. No categories will be renamed, moved, copied or depopulated unless an administrator edits the parameters to make the change. Vandals will not be able to wreak havoc on the system by assigning Intersections to existing categories. The only ability given to most users will be the ability to assign previously unassigned intersections to new categories. Users will keep all the powers they now have to create category pages. New categories assigned to intersections can be easily deleted with a single edit.