Talk:Units
Contents |
[edit] 2005 design
Basically, for each attribute (currently hard-coded) you should be able to set a 'Type'. Types then have built-in parsing rules, which also deal with conversion (km vs. miles) and modifiers (nano, kilo, ...). We have not planned to allow the derivation of arbitrary units with mathematical functions. This would require a full-blown math-implementation or at least cause quite a lot of programming effort. Also the user interface for this might be complicated. Definitely we have to ground units somehow in PHP code, the exact frontier is unclear. Maybe you have some good ideas on this, MovGP0? --MaxVölkel 10:48, 14 November 2005 (CET)
- This was implemented in SMW 0.3 or so, but not the modifiers part. In SMW 0.5 we added user-defined types where you specify the conversion factor between different units. -- Skierpage 02:50, 19 August 2006 (CEST)
[edit] complex approach
- If you want a basic implementation you will at least to have implement the Units for Lenght (meter; m), Mass (kilogram; kg/g), Time (second; s), electrical Current (ampere; A), Temperature (Kelvin; K), molar Mass (mol), and Lightstrenght (candela; cd).
- It doesn't makes sense to hardcode any other unit because there are infinite possibilities, ie. somebody can define a Energy as:
[[energy:=3 J]] [[energy:=3 N m]] [[energy:=3 W s]] [[energy:=3 (kg m^2)/(s^2)]]
- or also define Energy as
[[times::(Mass, square::(speed of light))]]
- see also: Energy Formulas in the german Wikipedia
- I personally would implement the most used Units and let the others define themselve using a semantic relation witch stands synonymously to the matematical functions.
[[times::(15, Unit:kg, square::(frac::(Unit:m, Unit:s))]]
- Even the need of a real mathematical implementation seems to unavoidable for me, this technique could postpone the problem at the cost of a scary syntax. But later we would need a transformatin Syntax for being able to do ie. the following statement:
x^(-1 y) <-> x/y x+y <-> y+x (var:x)^2 <-> square(var:x) <-> sup(var:x, 2)
- Antother idea would be to have a syntax witch let define the Unit of an Article:
[[has Unit:=frac::(Unit:m, Unit:s))
- witch simplifies above Syntax to:
[[times::(15, Unit:kg, square::(unitOf:=(speed of light))]]
- The Problem is just, that math goes far further than RDF and OWL can do - there are just a classification System like UML. Mathematical search is a unsolved research problem.
- see also: Wikidata#Units of measurement
- MovGP0 11:56, 14 November 2005 (CET)
[edit] simple approach
It would also possible to do no unit conversion at all - except for some special ones.
Instead we can make a statement when defining a new Attribute[[hasUnit:="string"]]. This means that the unit is fixed and can't get changed. This Approach will force the People to calculate for themselve, but the implementation will be just a basic interpretation of numbers - not units. It will be easier for people to learn to use this, than it will be for Programs to learn how to interpret units correctly.
For the most common ones (Area, lenght, etc.) we can make a build-in unit transformation (SI to imperial) and extend this from time to time - dependend on the needs.
[[unit:="km²"]]within the article Attribute:area and define
[[area:=35.6 10^3]]elsewhere, this would interpreted as "35,600 km^2" and also calculated into square-miles by a hardcoded conversation module.
Real interpretation could then be scope of another project for handling math and mathematical seach in Wikis.
MovGP0 13:02, 14 November 2005 (CET)
Antother thing witch might be more interesting is the possibility to define the Datatype to an Attribute:
[[datatype::Type:Integer]]
This Type can do some Typechecking by Regex-Patterns an therefore garatee the correct syntax of the input, so we can later handle it without to rewrite most of the places where the Attribute got used.
MovGP0 14:39, 14 November 2005 (CET)
[edit] W3C Example
<Measurement>
<observedSubject rdf:resource="#JaneDoe"/>
<observedPhenomenon rdf:resource="#Weight"/>
<observedValue>
<Quantity>
<quantityValue rdf:datatype="&xsd;float">59.5</quantityValue>
<quantityUnit rdf:resource="#Kilogram"/>
</Quantity>
</observedValue>
<timeStamp rdf:datatype="&xsd;dateTime">2003-01-24T09:00:08+01:00</timeStamp>
</Measurement>
witch could - after basic declatations of Datatypes - expressed as:
… [[Value:=(59.5, Unit:Kilogramm)]] …
or even as
… [[Value:=59.5]] …
MovGP0 14:41, 14 November 2005 (CET)