opereffa ArchetypeWrapper and unit types

Hello,

As far as I understand, in opereffa, unit of an item is not retreived from the ADL file and should be set manually like :

pArchetypeWrapper.getElementAtNode(path).setUnitOfQuantity(…);

Am I missing something here, or is it the way it works?
I think since the unit and type of each item is already stored in the ADL file, while parsing the ADL file to the ArchetypeWrapper, these types of information should be set automatically in ElementWrappers in that ArchetypeWrapper.

Best Regards
Pariya

MSc; PhD Candidate
Department of Computing Science and Engineering
Chalmers University of Technology
http://www.ait.gu.se/kontaktaoss/personal/hajar-kashfi/

Hi Pariya,
An archetype may introduce a constraint so that during the recording of data, you may use a quantity and one of the allowed units.
Just think about the difference between Fahrenheit and Celsius degrees (Thomas Beale’s example).
Wrappers do have access to ADL, but in these kind of situations, ADL provides more than one option, so the wrapper can’t know which unit it is going to use. If there is only one option, the wrapper should automatically use that. I don’t think I’ve added that convenience, so that is probably what got you confused.

Kind regards
Seref

Hi Seref,
Thank you for the explanation. I actually had forgotten than it may be more than one unit for an item in an archetype. What you mentioned here does make sense to me now.
As I understood, for the moment, nothing is retrieved from the ADL.
What is the suggested run time approach? Should the unit be set in the application layer then? for instance as an attribute of the input in the view layer or so.

Best Regards
Pariya

MSc; PhD Candidate
Department of Computing Science and Engineering
Chalmers University of Technology
http://www.ait.gu.se/kontaktaoss/personal/hajar-kashfi/