DataType of EML for KEPLER
The Datatype really should be determined in EML from the measurementScale and
domain (numericDomain and nonNumericDomain). Using the storage type was
a hack that we kept in from our earlier Monarch code -- its very
unreliable, and is optional, which is why we at times have trouble. I
think I wrote about this in a bug for Kepler, but I can't find it.
The default Ptolemy types are fairly coarse grained, so we should get
fairly far by something simple:
MeasurementScale numberType Type
nominal N/A string
ordinal N/A string
interval/ratio natural int or long (depending on bounds)
interval/ratio whole int or long (depending on bounds)
interval/ratio integer int or long (depending on bounds)
interval/ratio real double
In the above, you can use bounds and precision to help fine tune which
of the numeric types to use.
In implementing this, its probably best to separate out the type
inference code from the rest as much as possible -- a separate method at
a minimum, a separate class possibly. Keep in mind that this code is
probably going to be somewhat related to semantic type checking that
Shawn is working on.
#1 Updated by Jing Tao over 14 years ago
Add new classes - NumericDomain, TextDomain, DatTimeDomain and EnumericDomain
which extends from Domain Interface. In this domain object, numberType and
bounds is assigned. Base on assigned numberType, bounds and dataType info in
configure file, a DataTypeResovler will return a dataType(through a map like
above table) in domain object. So after passing metadata, a domain object will
be gotten and the domain object will have the data type information.