Discuss $smwg­Namespaces­With­Semantic­Links

From semantic-mediawiki.org

Contents

Thread titleRepliesLast modified
Suggested clarification122:35, 8 February 2019
Can't activate smw on custom namespace208:45, 10 December 2018
The status of NS_PROPRTY104:25, 30 September 2018
Talk Namespace with semantic links311:59, 31 March 2015
Not returning properties and/or categories in custom namespaces1402:16, 22 May 2014

Suggested clarification

Perhaps it should be clarified in the documentation that even though the namespace "Property" is not among those for which $smwgNamespacesWithSemanticLinks is set by default, this doesn't affect the ability to use Property pages and annotate them with special properties, as these are part of the SMW system.

16:54, 7 February 2019

This is true. Though not listed, "Property" and "Concept" but not "smw/schama" may be annotated.

22:35, 8 February 2019
 

Can't activate smw on custom namespace

Edited by another user.
Last edit: 15:43, 7 December 2018

Hi,
I have created a 'Bibliography' namespace, using the usual Mediawiki procedure. This is what I added in LocalSettings.php:

define("NS_BIBLIOGRAPHY", 3000);
define("NS_BIBLIOGRAPHY_TALK", 3001);
$wgExtraNamespaces[NS_BIBLIOGRAPHY] = "Bibliography";
$wgExtraNamespaces[NS_BIBLIOGRAPHY_TALK] = "Bibliography_talk";

The new namespace was successfully created. Then I activated smw on the new namespace, using: $smwgNamespacesWithSemanticLinks[NS_BIBLIOGRAPHY] = true;

When I run the update script I have this php message

PHP Notice: Use of undefined constant NS_BIBLIOGRAPHY - assumed 'NS_BIBLIOGRAPHY' in /var/lib/mediawiki/LocalSettings.php on line 251

The line is that one of $smwgNamespacesWithSemanticLinks, so I changed the NS_BIBLIOGRAPHY to 'NS_BIBLIOGRAPHY'. Anyway also after this change, smw doesn't work on the new namespace, even after rebuildData.php.
Any ideas?
My configuration is the following

MediaWiki 1.31.1
PHP 7.0.32-0ubuntu0.16.04.1 (apache2handler)
MySQL 5.7.24-0ubuntu0.16.04.1
ICU 55.1
Elasticsearch 5.6.1
Lua 5.1.5
SMW 3.0

Thanks for any help! Lorenzo

10:24, 7 December 2018

As always I am somewhat amazed why people constantly fail to configure this. You are not alone here and I do not know why. Anyways here is how you do this and the order is imperative.

## Define custom namespaces // Must set before invoking Semantic MediaWiki
define( 'NS_BIBLIOGRAPHY', 3000 );
define( 'NS_BIBLIOGRAPHY_TALK', 3001 );

## Name custom namespaces // Must set before invoking Semantic MediaWiki
$wgExtraNamespaces[NS_BIBLIOGRAPHY] = 'Bibliography';
$wgExtraNamespaces[NS_BIBLIOGRAPHY_TALK] = 'Bibliography_talk';

## Semantic MediaWiki
enableSemantics( www.example.com );
$smwgNamespacesWithSemanticLinks[NS_BIBLIOGRAPHY] = true; // Must set after invoking Semantic MediaWiki
15:49, 7 December 2018

Well, you are right that was exactly the problem. I am sorry I didn't check carefully documentation and older discussions.

Thanks for the help! Bye,
Lorenzo

08:43, 10 December 2018
 
 

The status of NS_PROPRTY

The default list of domains for which $smwgNamespacesWithSemanticLinks is set to true doesn't include the Property namespace, and indeed an example is given for the enabling of semantic annotation for pages therein.

However at the same time Property pages are annotated with special properties as part of their definition process. So does this mean that only special properties are enabled by default for property pages?

If so, then maybe this is worth stating.

15:51, 29 September 2018

> However at the same time Property pages are annotated with special properties as part of their definition process. So does this mean that only special properties are enabled by default for property pages?

[0] contains the default setting for namespaces defined by SMW which includes SMW_NS_PROPERTY therefore annotations work out of the box and are not limited to special properties.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/NamespaceManager.php#L203-L217

04:25, 30 September 2018
 

Talk Namespace with semantic links

I disagree with the statement "In fact, is is not obvious what a meaningful property of a talk page could be." For instance it could be used to tag proposals for enhancements of articles / wiki pages if it is not clear whether these changes should be committed to the page directly (the wiki way), e.g. because it currently does not comply with the site guidelines. -- Anyhow, I use a semantic "recently-change" #ask query in my SMW, and I would like to see Talk Pages on that list as well. However, even though NS_TALK is set to true both in the initial $GLOBALS['smwgNamespacesWithSemanticLinks'] array and in an extra $wgNamespacesToBeSearchedDefault[NS_TALK] = true; statement (both are after the enableSemantics()-statement), the edit page keeps telling me I cannot use semantic annotations, and consequently the talk pages do not show up in my recently-changed-#ask-query. I start to wonder whether this works at all. Has anybody seen or get to work semantic annotations in SMW talk namespace? Oleander Hans (talk)

12:15, 30 March 2015

Well, if you look long enough for a meaningful reason you will find one. Reality has it that everything seems possible, so I will remove this sentence.

About your issue. I just tested on my test wiki by adding

$smwgNamespacesWithSemanticLinks[NS_TALK] = true;

after the enableSemantics call and indeed properties may now be set and they also pop up in my query results. Also the help message at the top tells me that I may now add annotations to the talk pages in main talk. There must be something else in the water at your end since I cannot confirm your findings.

15:31, 30 March 2015

It eventually turned out our admin had moved the wiki directory to a new location while leaving the old copy in place. Thus I was editing a localsettings.php to no effect... Sorry for the false alarm, and thank you for the (as always) kind and patient response.

11:59, 31 March 2015
 

That was written long ago, when properties belonged to the pages' subjects, not the pages themselves; and a talk page has no subject. Now than several special properties like Modification date are introduced, this is not the case.

02:51, 31 March 2015
 

Not returning properties and/or categories in custom namespaces

I've been trying to get results across a number of namespaces and am at my wit's end.

What I've done:

  • Set $smwgNamespaceIndex = 100; in LocalSettings.php BEFORE including SMW
  • Edited my SMW_Settings.php to add
NS_BLOG => true,
NS_FOO => true,
  • Run the repair and upgrade options on Special:SMWAdmin.

The query reads:


It picks up both of those categories in the main namespace, as well as in other namespaces like User and Help, but will not pick up anything in Blog or Foo.

Help?

17:54, 9 April 2013

You have to enable your cusom namespace to also store semantic annotations, e.g. with $smwgNamespacesWithSemanticLinks[NS_BLOG] = true;. Do this after you invoked the Semantic MediaWiki extension. Please never edit settings files but the LocalSettings.php file. Otherwise you are destined to run into trouble. Cheers

11:41, 20 April 2013

Doing that (after reverting my SMW_Settings.php) results in an error:

Notice: Use of undefined constant NS_BLOG - assumed 'NS_BLOG' in /home/xmm/public_html/w/LocalSettings.php on line 218 Warning: Cannot modify header information - headers already sent by (output started at /home/xmm/public_html/w/LocalSettings.php:218) in /home/xmm/public_html/w/includes/WebResponse.php on line 38 Warning: Cannot modify header information - headers already sent by (output started at /home/xmm/public_html/w/LocalSettings.php:218) in /home/xmm/public_html/w/includes/WebResponse.php on line 38

Any idea why?

17:38, 30 April 2013

Seems like you did something wrong with the definition of your namespace. See custom namespaces. Something like the following should be in your LocalSettings.php before the inclusion of extensions:

## Define namespaces
define( "NS_BLOG", 1030 );
define( "NS_BLOG_TALK", 1031 );

## Name namespaces
$wgExtraNamespaces[NS_BLOG] = "Blog";
$wgExtraNamespaces[NS_BLOG_TALK] = "Blog_talk";
18:35, 30 April 2013

Thanks! I've tracked down the problem, I think - unfortunately not how to fix it.

The issue is that the namespaces in question are Wikilog namespaces. The extension requires me to use

Wikilog::setupNamespace( 100, 'Blog', 'Blog_talk' );

to set up the namespace. If I try it the proper way, the semantic asks work, but the wikilogs aren't wikilogs. If I try it the wikilog way, the semantic asks don't work.

I've tried moving things around to have wikilog define its namespaces before smw is included, but it doesn't seem to make a difference.

19:43, 30 April 2013