When creating a mapping the first steps usually are analyzing the source and target schema types, identifying correspondences between those types and creating corresponding relations. After this each type relation is given attention to in turn, for identifying the relations between the properties.
First you should identify which types are relevant for the mapping. The schemas may contain more types than are initially listed in the Schema Explorer, especially if you are working with XML Schemas.
For the source the relevant types usually are those types you expect
data to be present for and that contain information relevant for the
target schema.
The relevant target types are those you wish
to populate and that have related representations in the source
schema.
To specify the relevant types, use Edit→Edit mapping relevant source types and Edit→Edit mapping relevant target types. Take a look at How to customize the mapping relevant types for more information.
With a type correspondence we refer to correspondences between source
and target types. It needs to be identified, which types in the
target schema are alike or somehow related to the types from the
source schema.
A common way to identify correspondences is
As an example, take the River source and Watercourse target type below. There is a clear correspondence there, as the concept of a Watercourse includes Rivers.
There may be multiple correspondences for a type, and a single correspondence may involve multiple source types if the information of all of them has to be combined to provide the information needed to populated the target.
Often correspondences are bound to certain conditions. As an example
let's assume we have an InlandWater type defined in the source
schema, with an attribute type. Values that can occur for the
attribute are
river
,
canal
and
lake
. Only InlandWaters that are rivers or canals correspond to the
target type Watercourse - so in this case the relation should
only apply to a subset of InlandWaters. This can be realised by
defining a condition context on the InlandWater type and use
the context in the relation.
Take a look at Defining
contexts on schema elements on how to create condition contexts. For
the above example the context could be defined with this CQL
condition:
type = 'river' OR type = 'canal'
A defined context for a type appears next to it in the Schema Explorer and can be used just like a normal type for the mapping.
For the type correspondences as the next step you need to identify how they can be expressed as relations in hale»studio.
The most simple kind of relation is a 1:1 relation - a correspondence
between a single source and a single target type, where all
information needed to populate a target instance is present in a
single source instance - like in our River/Watercourse example.
This kind of relation is represented in hale»studio by the Retype
function.
If multiple instances of a single source type need to be combined to form a target instance, the Merge function is the right choice. If multiple source types are involved, use the Join function to express the relation and configure how these source types are related to each other. A good practice in such cases is also to start with a Retype with the most relevant source type of the correspondence, and replace it with a Join later on.
Once you have identified a relation, create it by selecting the affected source and target types in the Schema Explorer, then select the Select a mapping function button between source and target schema and choose the appropriate function. See Mapping schema elements for more information on the creation of relations.
For each type relation then the next step should be analyzing the properties of the involved source and target types and identifying correspondences and relations between those properties.