Mapping Members of a Household

The table below depicts how relationships are typically expressed in an application form. The requirement is to map the CDS entities to a pre-filled application form similar to the one shown below. The difficult part in this case is to fill in field titled "How is this Person Related to You?" This field goes by the shorthand "RelType" in this example.

Table 1. Members of the Household
Name How Is Person Related to You? Date of Birth Social Security Number
Grace Spouse 1/2/1981 209-57-9943
Ella Child 1/3/2002 987-23-1190

In this example, the required mapping is written as follows:

1  <condition expression="Person.isPrimaryParticipant == true">    
2   <map-entity source="Person">            
3     <map-entity source="Relationship">
4       <follow-association source="personID">                
5         <target-entity name="Householder" id="Householder">                  
6           <map-attribute from="firstName" to="Name"/>
7           <map-attribute from="relationshipType" to="RelType" 
            entity="Relationship"/>
8         </target-entity>
9       </follow-association>
10    </map-entity>
11  </map-entity>
12 </condition>

This can be paraphrased as "For each Relationship contained within the primary participant, follow the association to the Person referred to by that Relationship. Map the firstName attribute of this Person entity to the Name field. Map the relationshipType attribute of the Relationship Entity to the RelType field." The key to understanding the example is on line 7, where the RelType field is mapped from an attribute in the Relationship entity.