$smwg­Namespace­Index

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgNamespaceIndex
Description Sets the index of the first namespace to be used by Semantic MediaWiki
NoteNote: Avoid changing the setting of this configuration parameter if you can.
Default setting
100
Software Semantic MediaWiki
Since version
Until version
Configuration Installation · Namespace
Keyword namespace


$smwgNamespaceIndex is a configuration parameter that was used to set the first namespace index to be used by Semantic MediaWiki. The configuration parameter was introduced in Semantic MediaWiki 0.7Released on 28 April 2007 and compatible with MW 1.8.x - 1.10.x. and removed with Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x..

Removed in Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x.. $smwgNamespaceIndex no longer exists. Semantic MediaWiki's six namespaces are now declared in extension.json. To use non-default namespace indices, define the namespace constants directly in "LocalSettings.php" before the wfLoadExtension( 'SemanticMediaWiki' ) call, which is MediaWiki core's documented relocation mechanism since MediaWiki 1.30. A wiki that still sets $smwgNamespaceIndex after upgrading fails to boot with a RemovedNamespaceIndexException that contains a ready-to-copy define() block calculated from the previous offset.1

Relocating the namespace indices (since 7.0.0)[edit]

To use non-default namespace indices, place define() calls for the six constants before loading the extension and set the values to suit your wiki:

define( 'SMW_NS_PROPERTY',      202 );
define( 'SMW_NS_PROPERTY_TALK', 203 );
define( 'SMW_NS_CONCEPT',       208 );
define( 'SMW_NS_CONCEPT_TALK',  209 );
define( 'SMW_NS_SCHEMA',        212 );
define( 'SMW_NS_SCHEMA_TALK',   213 );

wfLoadExtension( 'SemanticMediaWiki' );

The values above are the defaults used by Semantic MediaWiki. Change them to the namespace indices you want, ensuring they are even numbers that do not collide with namespaces used by MediaWiki or by other extensions such as extension "Page Forms"Allows to create and use forms for adding and editing pages with and without semantic data (which uses 106 and 107).

Historical reference[edit]

The information below describes the removed $smwgNamespaceIndex setting and is retained for reference. It no longer applies as of Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x.; use the define() mechanism described above instead.

The setting was needed if you already had custom namespaces on your wiki whose namespace indices collided with the indices 102 to 111 used by Semantic MediaWiki (102, 103, 108, 109, 112, 113, 114 and 115) and extension "Page Forms"Allows to create and use forms for adding and editing pages with and without semantic data (106, 107) and other extensions.

The default was:

$smwgNamespaceIndex = 100;

This index number was set implicitly and meant that the allocation of namespace indices used started at 100 with Semantic MediaWiki using the namespace indices 102, 103, 108, 109, 112, 113, 114 and 115.

The setting was changed like e.g.:

$smwgNamespaceIndex = 112;

This meant that Semantic MediaWiki would use the namespace indices 114, 115, 120, 121, 124, 125, 126 and 127.

The index number that replaced the default setting had to be the smallest even namespace number that was not in use yet. It had to be an even number and not smaller than 100 as well as not equal to 102, 104, 106, 108 or 110. If you manually set the namespace index to e.g. 112 the actual index usage by Semantic MediaWiki started with namespace index 114, i.e. the index was always up by two in comparison to the setting. This behaviour used to avoid a namespace collision with a now omitted namespace called "Relation" which was supported from version 0.2 to 1.4.3 (legacy support from version 1.0 to 1.4.3) and used index 100.

See also[edit]

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:6772