User:أحمد/mediawiki-extensions-SemanticCategoriesIntersection

From mediawiki.org

This is a proposal for an extension to facilitate the model of atomic categories paired with basic category set-operations; mainly the intersection of two categories.

This could simplify the organisation of several types of wikis. For example:

[[Category:German science fiction authors]] could be replaced with the intersection of the two atomic categories [[category:german people]] and [[category:science fiction authors]]

Many proposals are being considered for category math implementations and UI. See for example wikipedia:Wikipedia:Category intersection and meta:Category math

None of these have yet been incorporated in the core MW code, and it is unknown when/if any will be.

There are also extensions that implement similar functionality:

and hacks such as http://smw.referata.com/wiki/Replace_list_of_pages_in_a_Category_by_a_semantic_query which depends on Extension:CSS and Extension:SMW

However, neither of the above implemented methods integrate seamlessly with the current category system and UI. They require the transclusion of page lists in regular pages, or the creation of category pages which content has been muted from display, or in the case of SMW Concepts, a concept that is separate from the category system.

The approach described here depends on SMW and aims to be almost seamless with how categories are perceived by the user.

Approach[edit]

By semantically marking certain categories, their names could be joined together when they are present on a page, in a way that results in the name of a compound/intersected category under which the page is also categorised.

This gives the user a visual aid on the existence of the intersected category in the same manner other categories are displayed on the page, and allows users to immediately navigate to the intersected category and browse its contents.

Example[edit]

assume:

  • [[Category:Science fiction authors]] is assigned the semantic property [[intersects with categories::People by country]]
  • [[Category:People from Germany]] is categorised under [[category:People by country]] and is assigned the semantic property[[category intersection label::from Germany]]

Now for every page categorised under both [[category:People from Germany]] and [[category:Science fiction authors]] (such as wikipedia:Andreas Eschbach for example) an automatic category is added, i.e. the page is categorised under it, which name is derived from the other two categories. So that the result would be:

[[Category:Science fiction authors]] [[category:People from Germany]] [[category:Science fiction authors from Germany]]

The automatically added category, i.e [[category:Science fiction authors from Germany]] should be visually distinguishable, probably by being grouped under a label such as "automatic categories:", or by being surrounded by parentheses.

Optionally, an atomic category could be marked as to not be displayed when intersecting with certain other categories, probably by assigning them - or their meta-categories - a semantic property such as [[hidden when intersected with category::X]]

Notes[edit]

The [[Intersects with categories::]] property is assigned to a category under which all categories to be affected by this behaviour are categorised. This makes it practical to add new categories in that class without having to manually mark them in a special way other than the logical meta-categorisation process which the users are already accustomed to.

The same mechanism could be extended to allow for more than two atomic categories to be intersected and a compound category created from their names. A method would then be needed to mark the ordering by which their intersection labels are concatenated to produce a compound category name that makes sense to human readers.