Last modified: 2010-05-28 13:18:27 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 T25679, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 23679 - The values of properties with units need a 'no formatting' option.
The values of properties with units need a 'no formatting' option.
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Markus Krötzsch
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-27 10:03 UTC by Dan Bolser
Modified: 2010-05-28 13:18 UTC (History)
0 users

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


Attachments

Description Dan Bolser 2010-05-27 10:03:46 UTC
When querying the value of a property that has custom units, there is no way to get an 'unformatted' value returned by the query.

Specifically, numbers are always full of commas (e.g. 10,004,039) and the value is always attached to a unit (separated by an " ").

I think the 'natural' way to do this would be to specify "Plain (unformatted) printouts" for the property in question

http://semantic-mediawiki.org/wiki/Help:Displaying_information#Plain_.28unformatted.29_printouts


However, SMW insists on putting commas in large numbers [1] and outputting a unit and putting a " " between the printed value and the unit.

All nice ideas in principle, but the whole point of SMW is to provide *data* not *formatting*. Currently you can't get at the underlying data, to include it in a calculation, for example, so this is a bug.


[1] http://tinyurl.com/34vuf4y

This bug is different from but related to bug 15541.
Comment 1 Dan Bolser 2010-05-27 10:17:29 UTC
See thread: http://tinyurl.com/349b92z
Comment 2 Markus Krötzsch 2010-05-27 13:37:19 UTC
Ok, fixed in SVN (and thus to be released with SMW 1.5.1 next week).

The unit is still shown in plain format since it is part of the data, but it is separated with a simple space (no  ), and no number formatting is applied.
Comment 3 Dan Bolser 2010-05-27 14:12:43 UTC
Cheers Markus!

Just to clarify, the above formatting takes effect only when "plain (unformatted)
printouts" are used for the property? i.e. 

{{#show: Some page | ? My property # - }}


?



Given that plain (unformatted) printout is just a special case of the way units are selected, don't you think it's reasonable to suppress the output of units when using plain (unformatted) printouts?

i.e. If I say:

* {{#show: Some page | ? My property # seconds }}
* {{#show: Some page | ? My property # hours }}


It's clear that I want the result in seconds or hours, respectively.  However, if I say:

* {{#show: Some page | ? My property # - }}


Isn't it clear that I don't want units?

I'm being fussy about this because I want to take the values and pass them to calculations using the #expr: parser function. This won't work if their is a unit in the result.

I read somewhere that bug reports are not the place for discussions, so I'll paste this text into the thread where this issue is raised so that we can open it up for broader discussion.

Cheers,
Dan.
Comment 4 Markus Krötzsch 2010-05-28 13:18:27 UTC
I now also added support for the formatting strings "-n" and "-u" to be used with Type:Number and with types with custom units. The format "-n" produces a plain number without showing the unit, the format "-u" produces the plain unit string without showing the number.

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


Navigation
Links