>>
>> Question 1
>> ==========
>>
>> I use The following code fragment to create an object from an archetype
>>
>> rmobj = archetype.buildRMObject(valueMap, errorMap, sysmap());
>>
>> One of my constraints for this archetype is optional, as shown below
>>
>> ELEMENT[at0004] occurrences matches {0..1} matches  {
>> value matches {
>>     DVTEXT matches {
>>         value matches {/.+/}
>>     }
>> }
>>
>> In the valueMap I don't supply a value for this element and therefore 
>> it is not created. The 'rmobj' instance is created as expected.
>>
>> At some later stage, I want to record a value against ELEMENT[at0004]. 
>> Do I need to manipulate the 'rmobj directly as shown below
>>
>> Account account = (Account)rmobj;
>> Element element = new Element("isDebitAccount",
>>     new DvText("isDebitAccount"), isDebitAccount);
>> account.getDetails().items().add(element);
> 
> 
> You can manipulate the in-memory object as you normally do in 
> non-archetype based software. But by doing that you take the risk to 
> leave logic specific to certain archetypes in your code, which would 
> break the constraints with the archetype if e.g the details is changed 
> in new definition of the archetype. The result is that your software 
> can't be as much adaptive as it could be with dependency to certain 
> archetype.
> 
>>
>> or can I create it using a path expression?
> 
> 
> Such feature doesn't exist now.
> 
> Instead of modify the object directly, you should perhaps create a new 
> one instead by using archetype.buildRMObject(). The reasons are:
> 1, you don't want to have any specific knowledge of details of certain 
> archetypes.
> 2, since the high level objects, Composition, Party, EHR etc, are always 
> versioned, you can always create new ones instead of overwriting the old 
> ones.
> 

Rong,

Just want to discuss this a bit further. From programming perspective 
would you work with valueMap objects (where the key is a path) and only 
create an instance of an information model object, from an archetype, 
when you have collected all the required information?

Alternatively, if you are performance sensitive do you work with the 
information model and use archetype for validation (i.e. validate the 
model against the constraints).

[Apologies, if I haven't quite grasped the core concepts to building 
applications using archetypes]

cheers
</jima>

-
If you have any questions about using this list,
please send a message to d.lloyd at openehr.org

Reply via email to