Function "enableSemantics"

From semantic-mediawiki.org
Error screen shown due to a missing enableSemantics call in "LocalSettings.php"

enableSemantics is a convenience function to be added to the "LocalSettings.php" file to enable Semantic MediaWiki.

The use of enableSemantics has been enforced starting with Semantic MediaWiki 3.1.0Released on 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 "LocalSettings.php".

Usage[edit]

Using enableSemantics ensures that:

If changes to the configuration parameter $smwgNamespaceIndexSets the index of the first namespace to be used by Semantic MediaWiki are necessary, please follow the instructions in connection with enableSemantics.2

It is strongly recommended to not change the setting of this function after the initial setup of the wiki, not even if you switch from "http://" to "https://" or to a completely different domain like e.g. <example.org> to <beispiel.de>. The reason is that the URI from configuration parameter $smwgNamespaceSets 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.34

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), enableSemantics can be used simply with:

enableSemantics();

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:4119
  2. ^  Semantic MediaWiki: User mailing list thread "ExportRDF error: not a valid URI"
  3. ^  <semantic-mediawiki.org>: GitHub issue comment gh:smwo:26:307169823
  4. ^  HTTPS and the Semantic Web/Linked Data