Notice: Use of undefined constant …

From semantic-mediawiki.org

Notice: Use of undefined constant …

A message of this kind appears when certain constants are not available in time for them to be processed. To prevent this from happening, make sure that the relevant PHP expressions appear in the right order.

SMW constants

Constants that come with SMW become available only after the following has been added:

wfLoadExtension( 'SemanticMediaWiki' ); // required since SMW 4.0.0
enableSemantics( 'example.org' );

Configuration settings such as $smwgParserFeatures, which expects that constants like SMW_PARSER_STRICT are available, must be added below these lines, after the call to enableSemantics().

Namespace constants

The error message may appear because SMW namespace constants (SMW_NS_PROPERTY, SMW_NS_TYPE and SMW_NS_CONCEPT) are delayed due to the parameter $smwgNamespaceIndex being a prerequisite and its initialization has to happen first it can be processed. To resolve this you have to add

wfLoadExtension( 'SemanticMediaWiki' ); // required since SMW 4.0.0
enableSemantics( 'example.org' );

prior to any parameter (e.g. $wgContentNamespaces, $wgNamespacesToBeSearchedDefault and $wgNamespaceProtection) making reference to these namespace constants.

In case you choose to manually set $smwgNamespaceIndex to something other than the default value of 102, you must do this above the enableSemantics() call.