Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic MediaWiki:4.0.2 and Wikibase REL1_39 #5414

Open
zampaleu opened this issue Jan 30, 2023 · 7 comments
Open

Semantic MediaWiki:4.0.2 and Wikibase REL1_39 #5414

zampaleu opened this issue Jan 30, 2023 · 7 comments
Labels

Comments

@zampaleu
Copy link

I was trying to run Wikibase and SMW together, but it does not work .

It was working with previous version of SMW and Wikibase with this setting:

$wgExtraNamespaces[WB_NS_PROPERTY] = 'wb/property';
$wgExtraNamespaces[WB_NS_PROPERTY_TALK] = 'wb/property_talk';

Are some changes or new settings ?

@JeroenDeDauw
Copy link
Member

What does not work?

@zampaleu
Copy link
Author

[65fbe57470886b60bb71e1f7] /mediawiki/index.php/Special:NewProperty MediaWiki\Page\PageAssertionException: The given PageIdentity Special:Badtitle/NS122:NewProperty does not represent a proper page

Backtrace:

from /var/www/mediawiki/includes/page/WikiPageFactory.php(57)
#0 /var/www/mediawiki/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditFilterHookRunner.php(142): MediaWiki\Page\WikiPageFactory->newFromTitle()
#1 /var/www/mediawiki/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditFilterHookRunner.php(80): Wikibase\Repo\EditEntity\MediawikiEditFilterHookRunner->getContextForEditFilter()
#2 /var/www/mediawiki/extensions/Wikibase/repo/includes/EditEntity/StatsdTimeRecordingEditFilterHookRunner.php(47): Wikibase\Repo\EditEntity\MediawikiEditFilterHookRunner->run()
#3 /var/www/mediawiki/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditEntity.php(748): Wikibase\Repo\EditEntity\StatsdTimeRecordingEditFilterHookRunner->run()
#4 /var/www/mediawiki/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEditEntity.php(77): Wikibase\Repo\EditEntity\MediawikiEditEntity->attemptSave()
#5 /var/www/mediawiki/extensions/Wikibase/repo/includes/Specials/SpecialWikibaseRepoPage.php(194): Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEditEntity->attemptSave()
#6 /var/www/mediawiki/extensions/Wikibase/repo/includes/Specials/SpecialNewEntity.php(167): Wikibase\Repo\Specials\SpecialWikibaseRepoPage->saveEntity()
#7 /var/www/mediawiki/includes/htmlform/HTMLForm.php(725): Wikibase\Repo\Specials\SpecialNewEntity->Wikibase\Repo\Specials{closure}()
#8 /var/www/mediawiki/includes/htmlform/HTMLForm.php(615): HTMLForm->trySubmit()
#9 /var/www/mediawiki/extensions/Wikibase/repo/includes/Specials/SpecialNewEntity.php(111): HTMLForm->tryAuthorizedSubmit()
#10 /var/www/mediawiki/includes/specialpage/SpecialPage.php(701): Wikibase\Repo\Specials\SpecialNewEntity->execute()
#11 /var/www/mediawiki/includes/specialpage/SpecialPageFactory.php(1428): SpecialPage->run()
#12 /var/www/mediawiki/includes/MediaWiki.php(316): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#13 /var/www/mediawiki/includes/MediaWiki.php(904): MediaWiki->performRequest()
#14 /var/www/mediawiki/includes/MediaWiki.php(562): MediaWiki->main()
#15 /var/www/mediawiki/index.php(50): MediaWiki->run()
#16 /var/www/mediawiki/index.php(46): wfIndexMain()
#17 {main}

@JeroenDeDauw
Copy link
Member

The error comes from Wikibase. Presumably, something changed in the new Wikibase version you are using. So not an SMW issue.

@zampaleu
Copy link
Author

possible.. for me it is a problem with the mix of namespaces used by the extensions. but thanks anyway

@harshiteuro
Copy link

harshiteuro commented Mar 6, 2023

I am facing the same issue while trying Wikibase with SemanticMediawiki, I am using the follwing configuration-

MediaWiki | 1.38.5
Semantic MediaWiki | 4.1.0
WikibaseClient | – | GPL-2.0-or-later | Client for the Wikibase extension | The Wikidata team and others
WikibaseRepository | – | GPL-2.0-or-later | Structured data repository | The Wikidata team and others

for namespace conf. i am using

//to fix-Both extension Wikibase and Semantic MediaWiki add a namespace called "Property"
// $wgExtensionFunctions[] = function() {
// $GLOBALS['wgExtraNamespaces'][SMW_NS_PROPERTY] = 'smw/property';
// $GLOBALS['wgExtraNamespaces'][SMW_NS_PROPERTY_TALK] = 'smw/property_talk';
// };
// $wgExtensionFunctions[] = function() {
// $GLOBALS['wgExtraNamespaces'][SMW_NS_PROPERTY] = 'SemanticProperty';
// $GLOBALS['wgExtraNamespaces'][SMW_NS_PROPERTY_TALK] = 'SemanticProperty_talk';
// };

// extra permissions to avoid getting errors when creating new items or properties
// $wgGroupPermissions['user']['item-create'] = true;

@zampaleu can you assist me how you cope with this issue.

@baillyk
Copy link

baillyk commented May 16, 2024

You need to change the canonicalNames of the SMW Namespace property (e.g. to smw/property) in the SMW File extensions/SemanticMediaWiki/src/NamespaceManager.php.

The reason is, that the function getCanonicalNames() delivers hardcoded namespace names in newer versions that are not affected by setting the above wgExtraNamespaces config.
When a property is created, it is checked if the namespace exists. but smw will delete every namespace that conflicts with the canonicalnames. thus it deletes the wikibase namespace "property" and its corresponding id is no longer a valid page.

Solution:
change the function to something like this:

public static function getCanonicalNames() {
$canonicalNames = [
SMW_NS_PROPERTY => 'smw/Property',
SMW_NS_PROPERTY_TALK => 'smw/Property_talk',
SMW_NS_CONCEPT => 'smw/Concept',
SMW_NS_CONCEPT_TALK => 'smw/Concept_talk',
SMW_NS_SCHEMA => 'smw/schema',
SMW_NS_SCHEMA_TALK => 'smw/schema_talk',
SMW_NS_RULE => 'smw/Rule',
SMW_NS_RULE_TALK => 'smw/Rule_talk'
];

	return $canonicalNames;
}

@Nikerabbit
Copy link
Contributor

I'm using this code for 1.41 in LocalSettings.php:

// Avoid conflict with SMW namespaces. This hook needs to execute last.
$wgHooks['CanonicalNamespaces'][] = static function ( &$list ) {
        global $wgExtraNamespaces;
        $wgExtraNamespaces[WB_NS_PROPERTY] = $list[WB_NS_PROPERTY] = 'Wikibase_property';
        $wgExtraNamespaces[WB_NS_PROPERTY_TALK] = $list[WB_NS_PROPERTY_TALK] = 'Wikibase_property_talk';
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants