$smwgCategoryFeatures

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgCategoryFeatures
Description Sets the behaviour of the query features related to category handling
Default setting See below
Software Semantic MediaWiki
Since version
Until version still available
Configuration Query settings
Keyword category


$smwgCategoryFeatures is a configuration parameter that sets the behaviour of the query features related to category handling. The configuration parameter was introduced in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x.1 and deprecated the configuration parameters as indicated in the section on available options below.

Starting with Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. this parameter accepts an array of plain string keys instead of the SMW_CAT_* constants. The constant form still works but is deprecated and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki..2

Default setting[edit]

$smwgCategoryFeatures = [ 'redirect', 'instance', 'hierarchy' ];

This means that the three respective features as explained in the following sections on available options are enabled.

Available options[edit]

The options enabled by default are highlighted bold.
  • 'redirect' (formerly SMW_CAT_REDIRECT) – Set that redirects on categories should be detected and used as annotation values
NoteNote: This option replaces configuration parameter $smwgUseCategoryRedirectSet whether redirects on categories should be detected and used as annotation value.
  • 'instance' (formerly SMW_CAT_INSTANCE) – Sets that a category statement should be treated as an element of the category
NoteNote: This option replaces configuration parameter $smwgCategoriesAsInstancesSets whether a category statement should be treated as an element of the category.
  • 'hierarchy' (formerly SMW_CAT_HIERARCHY) – Sets that MediaWiki's subcategory hierarchy should be considered as hierarchy elements in the annotation process
NoteNote: This option replaces configuration parameter $smwgUseCategoryHierarchySets whether elements of the subcategory hierarchy are considered as hierarchy elements in the annotation process.
For further information on the available options listed above see the documentation pages of the respective deprecated configuration parameters as stated above.

Changing the default setting[edit]

To modify the setting to this configuration parameter, add one of the following lines to your "LocalSettings.php" file:

Removing a specific query feature related to category handling

To disable a specific feature e.g. that redirects on categories should be detected and used as annotation values just redefine the configuration parameter without including the corresponding string as shown in the above section on available options:

$smwgCategoryFeatures = [ 'instance', 'hierarchy' ];
Disabling all query features related to category handling

To disable all features related to category handling set an empty array:

$smwgCategoryFeatures = [];

Legacy constant form (deprecated since 7.0.0)[edit]

The constant form below is deprecated since Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki.. Use the string-array form shown above instead. It is documented here for wikis still running the constant form.

The default expressed with constants:

$smwgCategoryFeatures = SMW_CAT_REDIRECT | SMW_CAT_INSTANCE | SMW_CAT_HIERARCHY;

A specific feature can be removed with a bit-operation, e.g.:

$smwgCategoryFeatures = ( $smwgCategoryFeatures & ~SMW_CAT_REDIRECT );
NoteNote: Please use parentheses3 when combining different bit-operations to avoid a possible mismatch.

To disable all category handling features with the constant form, use SMW_CAT_NONE:

$smwgCategoryFeatures = SMW_CAT_NONE;

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:2806
  2. ^  | | | | | | | | |  Semantic MediaWiki: GitHub pull request gh:smw:6793
  3. ^  Bitwise Operators to use parentheses to ensure the desired precedence ...