Topic on Extension talk:Semantic MediaWiki

Semantic MediaWiki and Wikibase - renaming the namespace 'property'

1
MW Kappa (talkcontribs)

In our wiki (MW 1.35.5) we are running the extensions Semantic MediaWiki (4.0.0) and Wikibase. Semantic MediaWiki and Wikibase both add a namespace called property. This results in a conflict. The documentation of the extension Semantic Wikibase proposes to rename either the Wikibase property namespace or the Semantic MediaWiki property namespace (https://github.com/ProfessionalWiki/SemanticWikibase#semantic-wikibase) (4.2.2022). However, the solution suggested there did not work for us. We therefore would like

  1. to share our experience with the solution suggested for Semantic Wikibase
  2. to share our solution of renaming the Semantic MediaWiki property namespace
  3. to ask the Semantic MediaWiki community, whether there is a better solution which can be coded in the LocalSettings file rather than in the extension's core

Semantic Wikibase: suggestion for renaming the Wikibase property namespace or the Semantic MediaWiki property namespace

The suggested solution at https://github.com/ProfessionalWiki/SemanticWikibase#semantic-wikibase is:

"Renaming the Wikibase property namespace:

$wgExtraNamespaces[WB_NS_PROPERTY] = 'WikibaseProperty';
$wgExtraNamespaces[WB_NS_PROPERTY_TALK] = 'WikibaseProperty_talk';

Renaming the SMW property namespace:

$wgExtensionFunctions[] = function() {
    $GLOBALS['wgExtraNamespaces'][SMW_NS_PROPERTY] = 'SemanticProperty';
    $GLOBALS['wgExtraNamespaces'][SMW_NS_PROPERTY_TALK] = 'SemanticProperty_talk';
};

You can choose what to rename these namespaces to."

The problems we encountered with this solution are:

  • If the Wikibase namespace is renamed the properties will not be transferred into the triple store database (Blazegraph).
  • If the Semantic MediaWiki namespace is renamed with the variable $wgExtensionFunctions the renaming does not take effect in all places where it should. One example: the page 'Special:RecentChanges' lists a property 'highest point (P1)'. When hovering over the associated link, the message correctly shows 'Property:P1'. A click on this link, however, leads to a non-existing page 'SemanticProperty:P1'.

Another solution for renaming the Semantic MediaWiki property namespace

Our current solution is

  • entry in LocalSettings.php
 $wgExtraNamespaces[102] = "SemanticProperty";
 $wgExtraNamespaces[103] = "SemanticProperty_talk";
 wfLoadExtension( 'SemanticMediaWiki' );
 enableSemantics( 'localhost' );
  • renaming the namespace in $IP/extensions/SemanticMediaWiki/src/NamespaceManager.php
public static function getCanonicalNames() {
		$canonicalNames = [
			# SMW_NS_PROPERTY      => 'Property',			// original version
			# SMW_NS_PROPERTY_TALK => 'Property_talk',		// original version
			SMW_NS_PROPERTY      => 'SemanticProperty',		// renaming
			SMW_NS_PROPERTY_TALK => 'SemanticProperty_talk',	// renaming
			SMW_NS_CONCEPT       => 'Concept',
			SMW_NS_CONCEPT_TALK  => 'Concept_talk',
			SMW_NS_SCHEMA        => 'smw/schema',
			SMW_NS_SCHEMA_TALK   => 'smw/schema_talk',
			SMW_NS_RULE          => 'Rule',
			SMW_NS_RULE_TALK     => 'Rule_talk'
		];
		return $canonicalNames;

Questions

We dislike the intervention in the core of the extension. Does anybody have a better suggestion? We would appreciate comments on our experience and approach. MW Kappa (talk) 15:39, 4 February 2022 (UTC)

Reply to "Semantic MediaWiki and Wikibase - renaming the namespace 'property'"