Last modified: 2012-11-07 16:16:48 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33336, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31336 - datatype number / "Ordered" properties does not work as described (1.8 beta2)
datatype number / "Ordered" properties does not work as described (1.8 beta2)
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-03 21:03 UTC by Van de Bugger
Modified: 2012-11-07 16:16 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Van de Bugger 2011-10-03 21:03:51 UTC
Semantic MediaWiki manual describes a way to declare "ordered" properties:

http://semantic-mediawiki.org/wiki/Property:Allows_value#Ordered_properties

But this does not work. The property definition page seems good: 

Property has type [[Has type::Number]]. Allowed values:

* [[Allows value::1 - Small]]
* [[Allows value::2 - Medium]]
* [[Allows value::2 - Big]]

But setting property value:

[[Ordered::1 - Small]]

Gives result:

1 - Small(!)

Where (!) is an yellow icon with exclamation sign, clicking on the icon opens a bubble with warning ""-Small" is not declared as a valid unit of measurement for this property."

See live example at:

http://scratchpad.referata.com/wiki/Property:Ordered
http://scratchpad.referata.com/wiki/TestOrdered

Scratchpad runs Semantic MediaWiki (Version 1.6.3 alpha) (r98796).
Comment 1 Van de Bugger 2011-10-03 21:06:22 UTC
There is a typo in the example: The third allowed value should be "3 - Big", but it does not matter, the problem is reproducible with both 2 and 3.
Comment 2 Van de Bugger 2011-10-03 21:09:13 UTC
It seems it is a recent regression, because it worked in SMW 1.6 alpha (sorry do not know SVN revision number).
Comment 3 Van de Bugger 2011-11-23 20:12:54 UTC
Hi guys, please respond whether it is a bug in code or in documentation.

If it is a bug in code, by fixing return statement in `SMW_DV_Number.php':

> protected function convertToMainUnit( $number, $unit ) {
>     $this->m_dataitem = new SMWDINumber( $number );
>     $this->m_unitin = '';
>     return ( $unit === '' );
> }

to

>     return ( preg_match( '/^(-$)/', $unit ) );

you will let `Number' ignore pseudo-units starting with dash, as described in the help:

> SMW's number datatype ignores the "- description" after the number. This gives
> the set of properties a numerical order and lets you make two values
> equivalent.

If it is a bug in documentation, page  http://semantic-mediawiki.org/wiki/Property:Allows_value should be updated.
Comment 4 Jeroen De Dauw 2011-11-24 13:54:30 UTC
Yaron, are you familiar w/ this feature?
Comment 5 Van de Bugger 2011-12-09 21:58:32 UTC
Ping.
Comment 6 Yaron Koren 2011-12-09 22:45:24 UTC
Oh, hi - sorry, I have no idea.
Comment 7 filburt 2011-12-11 10:22:22 UTC
Hm, same here with SMW 1.7alpha. Unfortunately the bugfix in comment 3 does not help for SMW 1.7, because the mentioned function is different.

Support would be great - thanks a lot.
Comment 8 Van de Bugger 2012-02-07 19:51:45 UTC
> Oh, hi - sorry, I have no idea.

Guys please decide. I want either 

1. Get a bug in SMW fixed and use the feature at my site, or
2. Get a bug in documentation fixed and think how to avoid using it.
Comment 9 [[kgh]] 2012-11-07 15:36:47 UTC
There has definitely been a change in behaviour of the software. Before I start adjusting documentation to fit the behaviour identified with a bug report I would like to know if this change reflects the intended behaviour.

I personally have the feeling that this is a valid bug that should be fixed.
Comment 10 Markus Krötzsch 2012-11-07 16:02:29 UTC
The documentation should be updated to remove this tip. This was never meant to work like this. What happened in earlier versions is that SMW would treat values like "1 - Small" to be the number "1" with an unknown unit of measurement "- Small". This no longer works since SMW does not support undeclared units of measurement any more, and since Number is not supporting units anyway. However, even in past versions it should not have worked: comparing 1 "- Small" with "2 - Medium" is like comparing 3 apples with 2 oranges. This was just not checked properly (there used to be a todo about this in the code).

Long story short: there was never any support for this, and it should not be documented. We need to rethink the Allows Value support a sometime. I am sure that some better things could be done there, but the current system really just supports fixed values without any ordering other than the one that it would have naturally based on the property type.
Comment 11 [[kgh]] 2012-11-07 16:11:04 UTC
Thank you for your insight on this. This might have worked up to SMW 1.5.6 though it would have indeed been a bit hackish. I will rectify the documentation accordingly. Thus closing this as RESOLVED "WONTFIX".
Comment 12 Markus Krötzsch 2012-11-07 16:16:48 UTC
Looking at the old documentation, the advice given for Strings is still correct. It just won't work for numbers. So part of this tip works. But there is no way to have two different Allows value for String be "aliases" for the same value. If you want aliases etc., you need to use a template for entering data.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links