Mapping Functions


A mapping function is a collection of rules or algorithms that defines how a particular mapping works. A mapping is the application or execution of a mapping function in order to transform one model to another.

Mapping functions are defined against metamodels, but they operate on models. One of the rules stated above was, "Turn every class with at least one persistent attribute into an entity bean." That statement relies not on the specifics of a model, but on related types of model elements, where a type denotes a group of model elements with common properties which is exactly what the metamodel does for us. This explains why we felt compelled to discuss it in the previous chapter. (That, and we really get into this "meta" stuff.) So, the very existence of source and target metamodels is a prerequisite for specifying a mapping function.

A mapping function is not specific to a single model; rather, it applies to all models that conform to the same metamodel, which makes the mapping function reusable.

Mapping functions can be arbitrarily complex. For example, one would treat all elements of an analysis model that call for lifetimes longer than a single execution of the system as belonging to some type associated with "persistence." Going forward, each of these elements would be involved in one or more mapping rules that defines how persistence is going to be realized in a concrete way.



MDA Distilled. Principles of Model-Driven Architecture
MDA Distilled. Principles of Model-Driven Architecture
ISBN: B00866PUN2
EAN: N/A
Year: 2003
Pages: 134

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net