Function "enableSemantics
"
The enableSemantics
function should be added to the "LocalSettings.php" file to enable Semantic MediaWiki.
The use of the enableSemantics
function has been enforced starting with Semantic MediaWiki 3.1.0Released on 23 September 2019 and compatible with MW 1.31.0 - 1.33.x.1 to avoid issues and misuse of MediaWiki's extension registration mechanism by erroneously adding wfLoadExtension( 'SemanticMediaWiki' )
to the "LocalSettings.php" file.
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.2
Usage[edit]
Using the enableSemantics
function ensures that:
- An URI related namespace is setup 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$smwgNamespacesWithSemanticLinks
Defines for which namespaces the semantic links and annotations are to be evaluated
If changes to the configuration parameter $smwgNamespaceIndex
Sets the index of the first namespace to be used by Semantic MediaWiki are necessary, please follow the instructions in connection with enableSemantics
.3
$smwgNamespace
Sets the namespace of exported URIs is used as an identifier of the wiki that should not change. A change would turn the respective URI into a different entity which in fact it is not.45
Parameters[edit]
The function defines the following parameters:
- The first parameter represents the URI-namespace
- The second parameter indicates whether the URI namespace is completed or not
Examples[edit]
Domain identifier[edit]
enableSemantics( 'https://example.org/id/', true );
Alternatively a setting like the following is possible:
enableSemantics( 'example.org/id/' );
Empty identifier[edit]
For a local installation where no domain is available (or necessary), the enableSemantics
function can be used simply with:
enableSemantics();
See also[edit]
- Help page on installing Semantic MediaWiki
- Help page on configuration preloading
- Help page on the extension registration mechanism
- Help page on importing vocabulary
- Help page on pretty URIs
References
- ^ | Semantic MediaWiki: GitHub pull request gh:smw:4119
- ^ Semantic MediaWiki: GitHub pull request gh:smw:4684
- ^ | Semantic MediaWiki: User mailing list thread "ExportRDF error: not a valid URI"
- ^ <semantic-mediawiki.org>: GitHub issue comment gh:smwo:26:307169823
- ^ | HTTPS and the Semantic Web/Linked Data