Matching Patterns and Following Associations in the CDS

In the following scenario the customers have requested that the mapping engine be used to fill out a PDF form that looks something like this:

Table 1. Sample PDF Form
Name Employer Name Start Date Annual Pay Before Taxes
Pat The Gingerman Bakery 1/2/2004 30000
Grace Jarmin Pharmaceutical 1/3/2002 50000

Each field on this PDF form has a unique identity. For example, the field containing the name, Pat, is identified as Job0.Name. The field containing 30000 is identified as Job0.Salary.

Consider how the information from the intake might be stored in the CDS:

Figure 1. Job Income in CDS

In order to fill out the Name field on the on the above PDF form, the mapping specification must contain a rule which states that for each Income belonging to a Person, output the Person's firstName to the Name field. In the mapping language, this can be expressed as follows:

1 <map-entity source="Person">        
2  <map-entity source="Income">
3    <target-entity name="Job" id="JobTarget">
4      <map-attribute from="firstName" to="Name" entity="Person"/>
5      <map-attribute from="employerName" to="Employer"/>
6      …
7    </target-entity>
8  </map-entity>
9 </map-entity>

This mapping rule can be paraphrased as "For each Income Entity contained within a Person Entity, create a Target Entity of type Job. The Name attribute of the Job entity is mapped from the firstName attribute of the Person Entity that contains the Income Entity being mapped."

Note the use of the syntax entity="Person" on line 4 to denote that the firstName attribute comes from the Person entity, not the Income entity. A more complex example of this type of mapping specification involves following associations or links from one entity to another.