Help:Configuration parameter "$smwgNamespacesWithSemanticLinks"

Jump to: navigation, search
edit with form (experimental)

Title $smwgNamespacesWithSemanticLinks
Description Defines for which namespaces the semantic links and annotations are to be evaluated.
Default setting See below
Software Semantic MediaWiki
First version supported 0.7
Last version supported still available
Configuration Installation · Namespace
Keyword Namespace

$smwgNamespacesWithSemanticLinks is a configuration parameter that is used to define for which namespaces the semantic links and annotations are to be evaluated. Usually this setting gets changed if the respective wiki contains custom namespaces, which should use semantic functionality. The setting was introduced in Semantic MediaWiki 0.7.

On pages within namespaces which are disabled with false with the default setting or for custom namespaces explicitly not activated by adding it to the parameter, annotations can be given but are silently ignored. This is useful since, e.g., talk pages usually do not have attributes and the like. Pages without annotations will also be ignored during full RDF export, unless they are referred to from another page.

Default setting

$GLOBALS['smwgNamespacesWithSemanticLinks'] = array(
	NS_MAIN => true,
	NS_TALK => false,
	NS_USER => true,
	NS_USER_TALK => false,
	NS_PROJECT => true,
	NS_PROJECT_TALK => false,
	NS_IMAGE => true,
	NS_IMAGE_TALK => false,
	NS_MEDIAWIKI => false,
	NS_TEMPLATE => false,
	NS_HELP => true,
	NS_HELP_TALK => false,
	NS_CATEGORY => true,

The default setting was last changed with SMW 1.9.0 by removing the namespaces "Property", "Type" and "Concept" from the array.

Changing the default setting

To add a custom namespace, e.g. "Foo" insert

$smwgNamespacesWithSemanticLinks[NS_FOO] = true;

into your "LocalSettings.php" file after enabling semantics with

enableSemantics( '' );

where [NS_FOO] is the namespace constant that was defined for namespace "Foo".

If you insert a namespace defined by an extension the namespace constant set by the respective extension will have to be used, e.g.

$smwgNamespacesWithSemanticLinks[NS_PROPERTY] = true;

for namespace "Property" defined by Semantic MediaWiki.

In case you would like to add several namespaces insert them line by line e.g.

$smwgNamespacesWithSemanticLinks[NS_FOO] = true;
$smwgNamespacesWithSemanticLinks[NS_PROPERTY] = true;

If the behaviour for the namespaces covered by the default setting should be changed insert e.g.

$smwgNamespacesWithSemanticLinks[NS_USER] = false;

to disable semantic for the "User" namespace.

See also