From: mahdi.asgari at gmail.com [mailto:mahdi.asg...@gmail.com]
Sent: Sunday, May 08, 2011 10:10 AM
To: openehr-technical at openehr.org
Subject: RE: openEHR-technical Digest, Vol 49, Issue 12 (RE:ArchetypeNodeId
of an archetypeslot)
Dear Thomas
If I assume your response?
> just to clarify a bit:
> * occurrences etc are defined in the archetype, on slot nodes, as
> for any other object node in an archetype
> * when a slot is being filled (in a template), the id used for the
> archetype_node_id at the root node of the filler archetype in the
> resulting structure is the archetype_id of that archetype.
> * this means you never see at0000 in the resulting structure (called
> an operational template), and therefore, never in data, because
> all data is generated from operational templates
>the constraints you have in the example below look correct to me - they
will be preserved in the operational template.
1- What is meaning of archetype_details/archetype_id of locatable object?
According to previous statements it can be null because archetype_id
inserted on archetype_node_id!?
2- How to apply occurrence of slot please see the following code:
void validateArchetypeSLot(ArchetypeSlot cobj, Object object,
String path) {
logger.debug("validateArchetypeSLot..");
Interval<Integer> occurrences =
cobj.getOccurrences();
String code = cobj.getNodeID();
List<Object> objects = null;
objects =
findMatchingNodes((Collection)object, code);
if (occurrences != null) {
if (occurrences.getLower() !=
null && occurrences.getLower() > objects.size()) {
throw new
OccurencesTooFew("at: " + path + " [" + cobj.path() + "]: must be " +
occurrences.getLower() + " but is " + objects.size(), null);
} else if
(occurrences.getUpper() != null && occurrences.getUpper() < objects.size())
{
throw new
OccurencesTooMany("at: " + path + " [" + cobj.path() + "]: must be " +
occurrences.getUpper() + " but is " + objects.size(), null);
}
}
}
List<Object> findMatchingNodes(Collection<Object> values,
String code) {
List<Object> objects = new
ArrayList<Object>();
Locatable lo = null;
for (Object value : values) {
lo = (Locatable) value;
if
(code.equals(lo.getArchetypeNodeId())) {
objects.add(lo);
}
}
return objects;
}
The findMatchingNodes function, find matching objects depend on
archetype_node_id of slot. If I use archetype_id for object related to slot
instead of slot archetype_node_id,then I must change findMatchingNodes to
findMatchingArchetypeIds! So what happened if I define more than one slot,
under attribute, with conflicts in naming pattern? To prevent previous
condition we must define a conceptual constraint like this:
- if we define more than one slot under an attribute, then included patterns
must be unique, this means we must prevent to define patterns with conflicts
So I can change findMatchingNodes to findMatchingArchetypeIds?
If we use archetype_node_id of slot, then we need no additional constraint!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.openehr.org/mailman/private/openehr-technical_lists.openehr.org/attachments/20110511/4416cf3f/attachment.html>