| Status: | effective |
| Progress: | 100% |
| Version: | 7.0.0+ |
Function "enableSemantics"
enableSemantics() is deprecated and no longer required. Use wfLoadExtension( 'SemanticMediaWiki' ); instead. See migration below.1

enableSemantics call was missing from "LocalSettings.php". This enforcement no longer applies, as wfLoadExtension alone is sufficient.The enableSemantics function was historically added to the "LocalSettings.php" file to enable Semantic MediaWiki. As of Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. it is deprecated: calling it emits a deprecation warning but has no other effect, and only wfLoadExtension( 'SemanticMediaWiki' ) is required.
Migration
As of Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x., enableSemantics() is deprecated. Calling it emits a deprecation warning but has no other effect. To enable Semantic MediaWiki, only wfLoadExtension is needed:
wfLoadExtension( 'SemanticMediaWiki' );
RDF namespace URI
The RDF namespace URI (configuration parameter $smwgNamespaceSets the namespace of exported URIs) is now automatically derived from Special:URIResolver when not explicitly set. If you previously passed a domain to enableSemantics() and need a custom URI, set $smwgNamespace directly:2
wfLoadExtension( 'SemanticMediaWiki' );
$smwgNamespace = 'https://example.org/id/';
Namespace indices
The configuration parameter $smwgNamespaceIndexSets the index of the first namespace to be used by Semantic MediaWiki setting was removed in Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x.. To use non-default namespace indices, define the six SMW_NS_* constants directly in "LocalSettings.php" before the wfLoadExtension( 'SemanticMediaWiki' ) call. See configuration parameter $smwgNamespaceIndexSets the index of the first namespace to be used by Semantic MediaWiki for the ready-to-copy snippet.
Configuration preloading
The loadDefaultConfigFrom() and loadConfigFrom() methods on enableSemantics() were removed in Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x.. As of Semantic MediaWiki 7.3.0Released on 16 September 2026 and compatible with MW 1.43.x - 1.46.x., list default profiles in configuration parameter $smwgConfigProfilesApplies configuration profiles shipped with Semantic MediaWiki instead:
// Before (removed)
enableSemantics( 'example.org' )->loadDefaultConfigFrom( 'media.php' );
// After
wfLoadExtension( 'SemanticMediaWiki' );
$smwgConfigProfiles = [ 'media' ];
Unlike before, a profile's settings now take precedence over the same settings in the "LocalSettings.php" file. See configuration preloading for custom profiles and for versions before 7.3.0.
Legacy behaviour
enableSemantics function before Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x., retained for reference. The function is now a deprecated no-op.
Before Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x., enableSemantics took two parameters:
- The domain name, used as URI namespace in RDF.
- An optional second parameter indicating whether the URI namespace was already completed or not.
Since Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x. a configuration preloading feature is available as a mechanism to preload a set of configurations.3
Examples
enableSemantics( 'wiki.example.org' );
enableSemantics( 'example.org/id/' );
Specifying the protocol
enableSemantics( 'https://example.org/id/', true );
Empty identifier
For a local installation where no domain was available (or necessary), the enableSemantics function could be used simply with:
enableSemantics();
Context
Loading Semantic MediaWiki (with wfLoadExtension, formerly enableSemantics) ensures that:
- An URI related namespace is set up for the RDF export and the SPARQLStore replication process
- Namespace constants (e.g.
SMW_NS_PROPERTY) are accessible in the "LocalSettings.php" file when making changes to configuration parameters like configuration parameter$smwgNamespacesWithSemanticLinksDefines for which namespaces the semantic links and annotations are to be evaluated
See also
- Help page on installing Semantic MediaWiki
- Help page on configuration preloading
- Help page on extension registration mechanism
- Help page on importing vocabulary
- Help page on pretty URIs
References
- ^ Semantic MediaWiki: GitHub pull request gh:smw:6372
- ^ | Semantic MediaWiki: User mailing list thread "ExportRDF error: not a valid URI"
- ^ Semantic MediaWiki: GitHub pull request gh:smw:4684