Extension talk:Semantic Extra Special Properties

From MediaWiki.org
Jump to: navigation, search

Contents

Thread titleRepliesLast modified
Undefined variable: firstAuthor113:26, 30 April 2013
Getting a fatal error: Call to undefined method WikiPage::getCreator()315:27, 26 April 2013
EUSER sorted by number of edits?409:10, 1 April 2013
Thank you!121:24, 25 March 2013
WMF git repo819:19, 31 October 2012
Cannot see any output from this extension122:41, 27 October 2012
Problems with v0.2.3307:39, 29 March 2012
Add code for mimetype and mediatypes and some other changes ...605:23, 9 February 2012
Convert to patch for SMW?719:55, 2 February 2012
Changes to your code313:11, 5 January 2012

Undefined variable: firstAuthor

Hi. I'm running SESP version 0.2.8 alpha and when I run runJobs.php I'm getting the following error:

Notice: Undefined variable: firstAuthor in /var/www/webapps/wiki/extensions/Semantic-Extra-Special-Properties/SemanticExtraSpecialProperties.hooks.php
on line 255
Initialisation value '' is not a number.
Backtrace:
#0 /var/www/webapps/wiki/extensions/Semantic-Extra-Special-Properties/SemanticExtraSpecialProperties.hooks.php(276): SMWDINumber->__construct(NULL)
#1 [internal function]: SemanticESP::sespUpdateDataBefore(Object(SMWSQLStore3), Object(SMWSemanticData))
#2 /var/www/webapps/wiki/includes/Hooks.php(216): call_user_func_array('SemanticESP::se...', Array)
#3 /var/www/webapps/wiki/includes/GlobalFunctions.php(3856): Hooks::run('SMWStore::updat...', Array)
#4 /var/www/webapps/wiki/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php(216): wfRunHooks('SMWStore::updat...', Array)
#5 /var/www/webapps/wiki/extensions/SemanticMediaWiki/includes/SMW_ParseData.php(374): SMWStore->updateData(Object(SMWSemanticData))
#6 /var/www/webapps/wiki/extensions/SemanticMediaWiki/includes/SMW_ParseData.php(518): SMWParseData::storeData(Object(ParserOutput), Object(Title), true)
#7 [internal function]: SMWParseData::onLinksUpdateConstructed(Object(LinksUpdate))
#8 /var/www/webapps/wiki/includes/Hooks.php(216): call_user_func_array('SMWParseData::o...', Array)
#9 /var/www/webapps/wiki/includes/GlobalFunctions.php(3856): Hooks::run('LinksUpdateCons...', Array)
#10 /var/www/webapps/wiki/includes/LinksUpdate.php(99): wfRunHooks('LinksUpdateCons...', Array)
#11 /var/www/webapps/wiki/includes/job/RefreshLinksJob.php(49): LinksUpdate->__construct(Object(Title), Object(ParserOutput), false)
#12 /var/www/webapps/wiki/maintenance/runJobs.php(80): RefreshLinksJob->run()
#13 /var/www/webapps/wiki/maintenance/doMaintenance.php(105): RunJobs->execute()
#14 /var/www/webapps/wiki/maintenance/runJobs.php(110): require_once('/var/www/webapp...')
#15 {main}

I guess this is a bug?

Thanks

Mitchelln (talk)15:25, 26 April 2013

did you run the SMW update script (from either Special:SMWAdmin or command line)?

rotsee (talk)13:26, 30 April 2013
 

Getting a fatal error: Call to undefined method WikiPage::getCreator()

Hi I'm running MS 1.19.3, SMW 1.8 and Semantic Extra Special Properties 0.2.7.

When I save a page I get the following error:

Fatal error: Call to undefined method WikiPage::getCreator() in /var/www/webapps/intranet/extensions/SemanticExtraSpecialProperties/SemanticExtraSpecialProperties.hooks.php on line 126

I guess something has been depreciated.

Mitchelln (talk)11:38, 19 December 2012

0.2.7 actually requires MediaWiki 1.20+, which is where the method was introduced! It's mentioned in the Readme, but could be more clear, I guess.

rotsee (talk)21:59, 20 December 2012

Unfortunately, MW 1.20 breaks a number of extensions and also skinning (again). This is why I have to use the LTS version of MW. I guess this means I cannot use this extension any more :(

Mitchelln (talk)10:24, 23 April 2013

This has been addressed in 0.2.8 alpha : I can use this extension again, yay!

Thanks for the fix.

Mitchelln (talk)15:27, 26 April 2013
 
 
 

EUSER sorted by number of edits?

I would like to show all contributors of an article sorted by the number of edits each user has done so far.
Can I use EUSER to achieve this?
If not, can you think of a workaround or maybe a new extra property?

Thanks for your help!

Stefahn (talk)16:40, 22 March 2013

That should be possible, you can count the edits for a user by doing something like {{#ask:[[Page author::USERNAME]]|format=count}}, see i.e. http://xn--ssongsmat-v2a.nu/ssm/S%C3%A4songsmat:Anv%C3%A4ndarlista

rotsee (talk)21:20, 25 March 2013

It seems that {{#ask:[[Page author::USERNAME]]|format=count}} gives me the total number of edits a user did on the entire wiki.
I rather wanted to have the number of edits the user did on a particular page. Is that possible as well? Thanks!

Stefahn (talk)16:42, 27 March 2013

Oh, I see. No, that's not possible, as far as I can see. How about creating an extension that provides a magic work for getting that number, and then setting a property using that magic word?

rotsee (talk)21:30, 31 March 2013

Thanks for the suggestion. If I'm more familiar with extension programming I might look into it. Would be perfect if I could show the percentages each user contributed (instead of the number of edits, which is misleading sometimes).

Meanwhile I used Extension:Contributors - after some tweaks I got it running and now it shows the number of edits (Example).

Stefahn (talk)09:10, 1 April 2013
 
 
 
 

Thank you!

This looks like a great extension!

Previously I was using some hacks like this: http://smw.referata.com/wiki/Add_page_metadata_properties_to_a_page_(using_ED)


I have an idea for a similar extension that could be merged here... something along the lines of 'Semantic Property Properties'... basically to add a bunch of 'special' properties to each semantic property in the wiki. For example, which forms, pages, templates (classes) use the property, and what unique values the property has, and a count of each value.

Cheers,

Dan Bolser (talk)12:17, 22 February 2013

Unique values and count would be nice, but how would you keep those properties updated? The values are likely to change much, much more often than the property page is edited, so I guess you would need to purge all relevant property pages every time an article is saved?

rotsee (talk)21:24, 25 March 2013
 

WMF git repo

First of all: great work on this extension! :)

I'd be very neat to have it in the WMF git repo stuff like most of the other SMW extensions which makes it easier for interested developers (which includes me) to track changes and provide feedback. It also gives you more visibility (people will see the extension if they look in the extension list, and changes will be automatically linked to on the IRC channel).

You can request a repository here: https://www.mediawiki.org/wiki/Git/New_repositories/Requests

You can then just push all your current commits to it and retain your full version history and stuff :) If you want me to help out with this, you can add me in the "developer" column as well (username: jeroendedauw).

Jeroen De Dauw (talk)17:12, 21 June 2012

+1 on this extension. I would like to see this on Gerrit as well.

Nischayn22 (talk)11:59, 25 October 2012
 

I added you as a developer now (I think), feel free to move it if you have the time! rotsee (talk) 22:44, 27 October 2012 (UTC)

rotsee (talk)22:44, 27 October 2012

I'm afraid you partially misunderstood me. I suggested you creating a request for a new WMF git repository with you having access it it, and then me as well in case you wanted me to help move the code. Nischayn22 already went ahead and created such a request, which currently has his and my accounts listed as people who will get access. Steps for you to take now are:

  • Request Developer access (ie get an account)
  • Add yourself to the list of developers for your extension
Jeroen De Dauw (talk)14:55, 30 October 2012

Ok, sorry for being a bit stupid here, programming really isn't my trade (even if I enjoy it), so all this svn/git/gerrit stuff is still a bit scary. I have developer access now, and an account at labsconsole.wikimedia.org, and now I'm trying to figure out how to add myself to the list of developers. Could you please point me in the right direction? rotsee (talk) 22:41, 30 October 2012 (UTC)

rotsee (talk)22:41, 30 October 2012

If you can do this fast (before the git repository is created), go to http://www.mediawiki.org/wiki/Git/New_repositories/Requests and add you labs username along with mine and Jeroen's for this extension.

Nischayn22 (talk)01:53, 31 October 2012
 

You're not being stupid :) And this is not really a programming thing, but more a use-confusing-tools-correctly thing.

The repo has been created (see the commit history here)

Unfortunately you where not added to people with merge access. I have requested you to get access here. Please modify the name I put there (rotsee) in case you have a different username.

Jeroen De Dauw (talk)14:37, 31 October 2012
 

Heiya, a really cool sheat sheet is available here. This one covers all you normally need. Cheers

[[kgh]] (talk)16:16, 31 October 2012

Thanks!

rotsee (talk)19:19, 31 October 2012
 
 
 
 
 

Cannot see any output from this extension

MediaWiki = 1.19.1 PHP = 5.3.15-pl0-gentoo (apache2handler) MySQL = 5.1.62-log

Have installed the extension correctly and added the following to LocalSettings.php :

require_once("$IP/extensions/SemanticExtraSpecialProperties/SemanticExtraSpecialProperties.php"); $sespSpecialProperties[] = '_EUSER'; // Add properties for contributing users $sespSpecialProperties[] = '_CUSER'; // Add property for creating user $sespSpecialProperties[] = '_REVID'; // Add property with current revision ID

  1. Note that depending on local settings this value might not be very up to date.
  2. In case $wgDisableCounters is set to true this property will not be set.

$sespSpecialProperties[] = '_VIEWS'; // Add property with number of page views. $sespSpecialProperties[] = '_NREV'; // Add property showing an estimated number of total revisions $sespSpecialProperties[] = '_TNREV'; // Same but for the talk page, i.e. showing how much discussion is going on around this page $sespSpecialProperties[] = '_SUBP'; // Add properties pointing to subpages $sespSpecialProperties[] = '_MIMETYPE'; // Adding mimetype and mediatype in case the article object is NS_IMAGE/NS_FILE $sespSpecialProperties[] = '_MEDIATYPE'; // Adding mimetype and mediatype in case the article object is NS_IMAGE/NS_FILE $sespSpecialProperties[] = '_SHORTURL'; // Adding ShortUrl property, if ShortUrl Extension is installed $sespSpecialProperties[] = '_METADATA'; // Adding some porperties based om image metadata (exif data), when available $sespSpecialProperties[] = '_USERREG'; // Adding user registration date to user pages $wgSESPExcludeBots = true;

But no matter how many pages I edit, I still don't see any of the extra properties info on the pages. What am I missing?

2A01:348:2FF:AB:1DA8:A0E7:77CB:F18617:28, 14 October 2012

That's odd! What version of SMW are you using? rotsee (talk) 22:41, 27 October 2012 (UTC)

rotsee (talk)22:41, 27 October 2012
 

Problems with v0.2.3

Edited by another user.
Last edit: 19:43, 27 March 2012

Exception [edit]

Sometimes I have an exception in PHP code:

$firstRevision = $title->getFirstRevision();
$firstAuthor   = User::newFromId( $firstRevision->getRawUser () );

I added debug statements and found a cause: Some artificial pages does not have first revision, so $firstRevision is null, and calling getRawUser method on null gets the code into trouble.

I fond the reason: Some fake pages does not have any revisions. Fake pages appears when an extension like SemanticMaps play tricks with parser to get template expanded or something like this.

Adding additional check

if ( $firstRevision !== null ) 

helps to avoid the problem.

That should be added then, thanks for debugging! rotsee (talk) 19:43, 27 March 2012 (UTC)

One way ticket? [edit]

When I have discovered the crash, my first desire was to disable extension. However, after disabling I had another trouble: I cannot view properties any more:

There is no predefined property with "___CUSER".

Backtrace:

  1. 0 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/includes/storage/SMW_SqlStubSemanticData.php(182): SMWDIProperty->__construct('___CUSER', false)
  2. 1 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/includes/storage/SMW_SqlStubSemanticData.php(164): SMWSqlStubSemanticData->unstubProperty('___CUSER')
  3. 2 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/includes/storage/SMW_SqlStubSemanticData.php(69): SMWSqlStubSemanticData->unstubProperties()
  4. 3 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/specials/SearchTriple/SMW_SpecialBrowse.php(155): SMWSqlStubSemanticData->getProperties()
  5. 4 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/specials/SearchTriple/SMW_SpecialBrowse.php(108): SMWSpecialBrowse->displayData(Object(SMWSqlStubSemanticData), true)
  6. 5 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/specials/SearchTriple/SMW_SpecialBrowse.php(86): SMWSpecialBrowse->displayBrowse()
  7. 6 /var/www/oc.su/MediaWiki-1.18.1/includes/SpecialPageFactory.php(458): SMWSpecialBrowse->execute('???????????????...')
  8. 7 /var/www/oc.su/MediaWiki-1.18.1/includes/Wiki.php(240): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
  9. 8 /var/www/oc.su/MediaWiki-1.18.1/includes/Wiki.php(640): MediaWiki->performRequest()
  10. 9 /var/www/oc.su/MediaWiki-1.18.1/includes/Wiki.php(547): MediaWiki->main()
  11. 10 /var/www/oc.su/MediaWiki-1.18.1/index.php(57): MediaWiki->run()
  12. 11 {main}

Of course, I have database backed up before installing new extension, so I can just restore entire database. But someone may decide to stop using extra properties after long usage. How to stop using it?

Van de Bugger (talk)22:17, 26 March 2012

That's not good... I will not have time to look into this for the next month, and I know far too little about the inner workings of Semantic MediaWiki to make a guess. Someone else? rotsee (talk) 19:45, 27 March 2012 (UTC)

rotsee (talk)19:45, 27 March 2012

Did you run the scripts at Special:SMWAdmin? That is probably needed every time you install or uninstall an extension using special properties. rotsee (talk) 21:06, 27 March 2012 (UTC)

rotsee (talk)21:06, 27 March 2012
 

We had a similar case with an SMW extension where a special property was declared but after de-activating of the extension the objects still persisted in the SMW database and forced a crash due non-existing definitions that where inherent by the extension (special page property) and not by SMW itself. For reference see [1]. I discussed this with Jeroen and for now SMW core lacks the ability to handle such cases to resolve non-existing special property definitions. The only way to resolve this issue is to run Special:SMWAdmin.

MWJames (talk)07:39, 29 March 2012
 

Add code for mimetype and mediatypes and some other changes ...

I would like to propose some minor changes as it would make it easier for other people to contribute:

  • Contribution: could you put the code at least on github it would it make more simpler to patch and create release branches
  • Maintenance: could you set an own class such as SemanticExtraSpecialProperties.hooks.php so it would make adding code a bit more easier and it would be a cleaner implementation
  • Customizing: $smwgPageSpecialProperties2 seems to be an ought name (I mean the 2 at the end) so why not just called $sespSpecialProperties as it just belongs to SemanticExtraSpecialProperties

Since we needed something similar for mimetype and mediatypes on NS_FILE objects, as soon as you have it on github I'll at the code for mimetype and mediatypes.

Cheers and thanks

MWJames15:30, 2 February 2012

I just put this at Github (hope I made everything correct): https://github.com/rotsee/Semantic-Extra-Special-Properties As for the other suggestions (thanks for pointing those things out, btw), I'll take them on next week, as I will now be afk a couple of days!

rotsee 19:02, 2 February 2012 (UTC)

rotsee19:02, 2 February 2012

Thanks. Hope you don't mind but I made a fork https://github.com/mwjames/Semantic-Extra-Special-Properties and included all the proposed changes.

Feel free to make a review and if you'd like I can put them into your master later on.

Cheers

MWJames20:30, 2 February 2012

Sweet, can you put them in my master as well when you have time?

rotsee18:46, 8 February 2012

Just pushed it into your master. I left $smwgPageSpecialProperties2 for compat reason but changed to docu to use $sespSpecialProperties instead.

Cheers

MWJames05:23, 9 February 2012
 
 

According to kgh he noted that hidden to some usergroup, as the article author property will list all authors for everyone maybe this should be taken care otherwise the extension faces scrutiny by a warning.

MWJames21:19, 2 February 2012

I just reformatted an existing warning. :) Cheers

[[kgh]]21:23, 2 February 2012
 
 
 

Convert to patch for SMW?

Could this extension be converted into a patch for SMW, so it can be merged in and available to all SMW users?

Badon05:35, 19 January 2012

It would be more flexible to have it in an extra extension as it is now. Additionally I doubt that all extra properties would make it into core.

[[kgh]]09:59, 19 January 2012

Is there a reason why they wouldn't make it into the core? Is it just to make maintenance easier? It seems that making them optional is a good idea, in any case.

Badon01:07, 20 January 2012

It is just a feeling.

[[kgh]]10:19, 20 January 2012

I guess the problem is that you can imagine an infinite number of special properties, so it might make sense to be a bit conservative about which ones to include in core. These ones do not reflect the wishes from the community, but only my personal needs. rotsee 13:23, 22 January 2012 (UTC)

rotsee13:23, 22 January 2012

I suppose at some point we should find out what people want. I have been keeping a list here:

User:Badon/Extension:Semantic_MediaWiki/Manual#Needed_special_properties

But I haven't done anything about finding a broad consensus, even though many of those I have gathered from people's wish lists.

Badon04:48, 23 January 2012
 
 
 
 
 

Changes to your code

Heiya Rotsee, I just made some formatting changes to your code to make compliant with MediaWiki customs. I hope that is ok with you. Cheers

[[kgh]]22:32, 4 January 2012

Of course, thank you! I'm still learning. Thanks for your time! rotsee 07:02, 5 January 2012 (UTC)

rotsee07:02, 5 January 2012

PS. Nice with German translation, too!

rotsee07:05, 5 January 2012

Whilst I was at it, I thought I would be nice too. :) Actually I am not a coder, so I did not interfere with the extensions code as such. Thank you for your work! Cheers

[[kgh]]13:11, 5 January 2012