Skip to Navigation | Skip to Content

Ref_impl_Java mailing list archives

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Building RMObject objects from Archetype objects


Rong Chen wrote:
Hi Fabrice,

Once there was a similar function in the old version of the Java kernel (http://www.openehr.org/svn/ref_impl_java/BRANCHES/Release-0.95/libraries/src/java/org/openehr/am/archetype/Archetype.java). There was some limitations of the implementation and it also become obvious such RM object construction should probably be done by a component close to the UI where the data entry occurs. Currently this logic for building RM objects is separated from the RM/AOM implementation and part of it becomes the current rm-builder.

Actually I think it's quite straight-forward to create sample RM objects based on what's defined in the archetype. Basically it's a task of stepping through the AOM object tree and create the corespondent RM objects along the way. To make sure that valid RM object can be created, some default values need to defined and constraints from the archetype can also provide hints for sample values. With some rules to take different sample values from archetype constraints, this tool can be used to generate test-fixtures useful for archetype-testing.

The name of this function in the ADL 1.5 spec has changed to prototype_value from default_value (the latter is used in the new templates). We have implemented this in the past in older kernels in Eiffel and VB, and the only data type that is difficult to invent a prototype value for is C_STRING based on a regular _expression_ constraint - i.e. the tehcnical problem is how to generate a safe value from a regex pattern that actually satisfies that pattern. All the other data types are easy. No default values are needed (in the sense of template 'default'values); the prototype values can be completely generated from the constraint values. Note that it is only useful to do this once archetypes have been put into templates, and nodes of the type ARCHETYPE_SLOT and ARCHETYPE_INTERNAL_REF have disappeared (replaced by their reference targets). The only type that is special is CONSTRAINT_REF, for which you just generate some default fixed term (since you can't know what the value set is until runtime, unless pre-populated)

- thomas beale

_______________________________________________
Ref_impl_java mailing list
Ref_impl_java@openehr.org
http://lists.chime.ucl.ac.uk/mailman/listinfo/ref_impl_java