daniel added a comment. My current thinking is that we should abstract the specification of unit conversions on two levels:
- the UnitConverter service interface can have different implementation using information from different sources. - the default implementation would be based on a static list (CDB or a PHP file returning an array), with a decorator for caching. An implementation that relies directly on statements on properties would probably not scale well. It also suffers from the issue that when such a statement is changed, all statements using the respective unit would need to be re-indexed. (Also, https://phabricator.wikimedia.org/P2442 and https://phabricator.wikimedia.org/P2370 define conversion factors, so they only support linear conversion without offset. We will at least need to support offsets, and possibly exponents and even logarithms. This could perhaps be solved using qualifiers on the statements the define the conversion). My suggestion is to always go with the file based UnitConverter implementation. We still have freedom to decide how that file is created: - it could be maintained manually - it could be generated periodically, by a maintenance script based on https://phabricator.wikimedia.org/P2442 and https://phabricator.wikimedia.org/P2370 - it could be generated using GnuUnits, based on a config file that lists all supported units and their base unit (as Q-id and the unit symbol used by GnuUnits). - This list of supported units could in turn be generated based on https://phabricator.wikimedia.org/P2442 and https://phabricator.wikimedia.org/P2370; this might however be confusing, since the statements would only be used to determine the base unit, the conversion factor given in the statement would be ignored. TASK DETAIL https://phabricator.wikimedia.org/T117032 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: daniel Cc: Smalyshev, Aklapper, daniel, aude, jkroll, Wikidata-bugs, Jdouglas, Deskana, Manybubbles, Mbch331 _______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
