Auto-mapping children

When you create a structural link the mappings are generated for the selected elements and their children according to the following matching criteria:

  • Name (case-sensitive or not)
  • Type
  • Cardinality
  • In-depth search of source

When auto-mapping is enabled, you can draw a link from a source to a target element. When you drop the connection on the target, the source and target you select are connected. If the source and target have children elements, they are connected according to the matching criteria set in the Auto-mapping screen, for example:

 

Visual Mapper example of auto-linking children

Mapping Algorithm

The mapping algorithm works as follows:

  • A link is created from the source to the target. If the source and target are both terminals or non-terminals, regardless of their names, types (if applicable), or cardinalities.
  • If there is another link to the target, the link is replaced with the one from the selected source, regardless of the Replace existing links option.
  • If the source is already used in another mappings, a new link is generated from the selected source to the target, without removing the existing ones.
  • The algorithm attemps to find the best match for the children of source and target according to the matching criteria. For example, they must have the same name if Match names or if Case sensitive is selected, and also a compatible type, if Match type is selected, and the minimum cardinality of the source child is greater then or equal to the minimum cardinality of the target if Match cardinality is selected.
  • A virtual node, such as an object and items in a JSON schema, has the name of its parent element; therefore, it is linked with the corresponding parent in source.
  • If the target is a terminal having terminal children, such as a JSON object with value properties, and you connect it with a terminal that has children, such as an XML leaf with attributes, and there is only one child of the target that has the same type as the source leaf, then the remaining child of the target is connected to the source leaf.
  • After you generate the mappings for the selected source and target and also for their children, the algorithm connects the parents of the linked elements.

Troubleshooting

The following provides some troubleshooting tips for children:

  • Different names: If children with different names are not linked, uncheck Match names from the Auto-mapping screen.
  • Same names: If children with the same names, but have different cases, are not linked, check Match names and uncheck Case sensitive from the Auto-mapping screen.
  • Different types: If children with different types are not linked (such as string source to integer target), uncheck Match type from the Auto-mapping screen.
  • Different cardinalities: If children with different cardinalities are not linked, uncheck Match cardinality from the Auto-mapping screen.
  • Old links: If old links are not replaced when trying to map children, check Replace existing links from the Auto-mapping screen.
  • Value properties: If the source is an XML leaf with attributes that you want to connect with a JSON object that has value properties, but the source leaf is not linked with any of the target properties, make sure you have only one value property in the target object that has the same type as your source leaf.
  • Non-terminal elements: If children of a non-terminal element contained by another non-terminal element are not linked with similar children of the non-terminal target element, increase the Match search depth from the Auto-mapping screen. You can also try to link similar a structure together, instead of drawing the link from its parent element.

Related Links