Function "enableSemantics"

From semantic-mediawiki.org
Function "enableSemantics""enableSemantics" işlevi


Deprecated since Semantic MediaWiki 7.0.0Released on an unknown date and compatible with unknown versions of MediaWiki.: enableSemantics() is deprecated and no longer required. Use wfLoadExtension( 'SemanticMediaWiki' ); instead. See migration below.
Error screen shown due to a missing enableSemantics call in "LocalSettings.php"

The enableSemantics function should be added to the "LocalSettings.php" file to enable Semantic MediaWiki.

Migration[edit]

As of Semantic MediaWiki 7.0.0Released on an unknown date and compatible with unknown versions of MediaWiki., 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[edit]

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:

wfLoadExtension( 'SemanticMediaWiki' );
$smwgNamespace = 'https://example.org/id/';

Configuration preloading[edit]

The loadDefaultConfigFrom() and loadConfigFrom() methods on enableSemantics() are no longer available. Use require instead:

// Before (deprecated)
enableSemantics( 'example.org' )->loadDefaultConfigFrom( 'media.php' );

// After
wfLoadExtension( 'SemanticMediaWiki' );
require "$IP/extensions/SemanticMediaWiki/data/config/media.php";

See configuration preloading for details.

Usage[edit]

enableSemantics takes two parameters:

  • The domain name. This is used as URI-namespace in RDF.
  • The second parameter is optional and indicates whether the URI namespace is 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.1

Examples[edit]

enableSemantics( 'wiki.example.org' );
enableSemantics( 'example.org/id/' );

Specifying the protocol[edit]

enableSemantics( 'https://example.org/id/', true );

Empty identifier[edit]

For a local installation where no domain is available (or necessary), the enableSemantics function can be used simply with:

enableSemantics();

Context[edit]

Using the enableSemantics function 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

See also[edit]


References