Forcing a default unit for Properties
Closed, DeclinedPublic

Description

Author: dan.bolser

Description:
If I have a property of type 'size' that can accept mm, cm, m, km, etc. and these units correspond to 0.01, 0.1, 1, 1000, respectively. If the user then enters a number without specifying the unit, is there a way to have SMW automatically assume that value corresponds to the unit for which '1' is assigned (in this case, m)?

Answer: No!

The unit for which the conversion fact of 1 is assigned, the "Standard Unit" or "main unit", *should be* the default unit used when none is specified by the user.

Not specifying a unit causes the property to 'break':

The type "Time":

  • [[Corresponds to::1 h, hour, hours]]
  • [[Corresponds to::3600 s, second, seconds]]

The property "Has duration":

  • [[Has type::Time]]

The page "Sandbox":

  • [[Has duration::3]]
  • [[Has duration::2 hours]]
  • [[Has duration::10 seconds]]

{{#show: {{PAGENAME}} | ? Has duration # s }}

The show query does not return the value of 3 hours in seconds...

See thread: http://tinyurl.com/39nq2h8


Version: unspecified
Severity: enhancement

bzimport set Reference to bz23680.
bzimport created this task.Via LegacyMay 27 2010, 10:15 AM
Aklapper closed this task as "Declined".Via WebMar 3 2015, 5:51 PM
Aklapper added a subscriber: Aklapper.

The Semantic MediaWiki developers requested in https://phabricator.wikimedia.org/T64114 to move their task tracking to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues and to close remaining tasks in Wikimedia Phabricator. If you still face the problem reported in this task in a supported version of SMW, please feel free to transfer your report to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues . We are sorry for the inconvenience.

Add Comment