$smwg­Namespaces­With­Semantic­Links

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgNamespacesWithSemanticLinks
Description Defines for which namespaces the semantic links and annotations are to be evaluated
Default setting See below
Software Semantic MediaWiki
Since version
Until version 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 configuration parameter was introduced in Semantic MediaWiki 0.7Released on 28 April 2007 and compatible with MW 1.8.x - 1.10.x..

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[edit]

$smwgNamespacesWithSemanticLinks = [
	NS_MAIN => true,
	NS_TALK => false,
	NS_USER => true,
	NS_USER_TALK => false,
	NS_PROJECT => true,
	NS_PROJECT_TALK => false,
	NS_FILE => true,
	NS_FILE_TALK => false,
	NS_MEDIAWIKI => false,
	NS_MEDIAWIKI_TALK => false,
	NS_TEMPLATE => false,
	NS_TEMPLATE_TALK => false,
	NS_HELP => true,
	NS_HELP_TALK => false,
	NS_CATEGORY => true,
	NS_CATEGORY_TALK => false
];

The default setting was last changed with Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x. by removing the namespaces "Property", "Type" and "Concept" from the array. Note that the namespaces provided by Semantic MediaWiki with the exception of the "smw/schema" namespace may still be annotated.

Changing the default setting[edit]

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

$smwgNamespacesWithSemanticLinks[NS_FOO] = true;

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

enableSemantics( 'example.org' );

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_WIDGET] = true;

for namespace "Widget" defined by extension "Widget" (MediaWiki.org).


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

$smwgNamespacesWithSemanticLinks[NS_FOO] = true;
$smwgNamespacesWithSemanticLinks[NS_WIDGET] = 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 annotations on namespace "User".

See also[edit]