Altova MapForce 2025 Professional Edition

Basic Rules and Strategies

Home Prev Top Next

In general, MapForce maps data in an intuitive way, but you may come across situations where the output contains too many or too few items. This chapter describes the main mapping rules and helps you avoid situations in which the mapping produces undesired output due to incorrect connections or context.

 

In order to be valid, a mapping must include at least one source connected to at least one target component. A source component reads data, typically from a file or database. A target component writes data, typically to a file or database.

 

All mapping connections that you draw make together a mapping algorithm. At mapping runtime, MapForce evaluates the algorithm and processes data based on it. The integrity and efficiency of the mapping algorithm depends primarily on the connections. You can also tweak some settings at mapping level, at component level, or even at connection level, but it is the connections that determine how your data is processed.

 

Mapping rules

This subsection describes the main rules of data processing. To illustrate the rules, we will use the mapping shown below.

mfdBooksToLibrary-BAS

Rule 1

For each source item, one item is created in the target. This is the main mapping rule in MapForce. In the mapping above, if the source XML contains three book elements, then three publication elements will be created on the target side. Note that there are also a few special cases (see Sequences).

 

Rule 2

MapForce always starts processing from the target root item (node). This is where the execution of a mapping actually begins. After processing the target node, MapForce progresses down the hierarchy.

 

Rule 3

Each connection creates the current mapping context. The context determines what data is available for the current target node and its descendants. The context, therefore, determines which source items are actually copied from the source to the target component. By drawing or omitting a connection, you may inadvertently change the current context and thus affect the output of the mapping. For example, your mapping might unnecessarily call a database or a Web service multiple times in the same mapping execution. This concept is further described in the chapter Context and Processing Order.

 

Rule 4

When you draw a connection from a source item to a target item, the mapping reads data from that source item, passes the data to the target item, and generates instance data in the target format.

 

The source item may have zero, one, or multiple occurrences in the source instance file. Irrespective of the number of occurrences, MapForce always displays only schema hierarchies in structural components (e.g., XML). That is the reason why, for example, the source component in the mapping above has only one book element.

 

© 2018-2024 Altova GmbH