Mapping operations
In the Graphical
Data Mapping editor, you can use transforms,
cast functions, and XPath 2.0 functions to perform different actions
on input data and move the result to the output element. You choose
the appropriate mapping operation depending on the result that you
want to achieve.
Mapping operations to transform graphically your data
You
can use any of the following transforms to map graphically your data
in the
Graphical
Data Mapping editor:
- Core mapping transforms: You can use built-in
structural and functional mapping operations, which enable you to
graphically construct the required message transformations to build
the output message. For more information, see Transform types in the Graphical Data Mapping editor.
- Custom transforms: You can use custom transformations
to build your own XPath 2.0, Java™,
or ESQL functions, which can be invoked to perform specialized transformations
within the message map. For more
information, see Transform types in the Graphical Data Mapping editor.
- XPath functions (fn:functionName):
You can use XPath 1.0 and XPath 2.0 functions to transform data in
a message map. For more information
about XPath, see the online document W3C
XML Path Language (XPath) 2.0.
- Database transforms:
- You can use the Select transform to query
one or more database tables, and retrieve data that you can use in
the message map to set output element
values, define conditions, or use as input to build other transforms
conditions. Database tables can be set as additional outputs of a message map. For more information, see Selecting data from a table.
- You can use a Database routine transform to call a stored procedure or user-defined
function
from a database, and retrieve data that you can use in the message map to set output element values, define conditions, or
use as input to build other transforms conditions.
Transforms that support conditional control can use XPath
2.0 expressions, or invoke Java or
ESQL functions.
Note: XPath 1.0 functions are valid XPath 2.0
expressions. You can use the XPath Expression Builder to generate
simple XPath 1.0 expressions.
Mapping operations to modify data in a database
Database
tables can be set as additional outputs of a message map.
You can use any
of the following transforms to modify data in a database:
- Insert transform: You use the Insert transform
to add one new row of data, or multiple rows of data, into a database
table. For more information, see Inserting data into a table.
- Update transform: You use the Update transform
to modify a row of data, or multiple rows of data, in a database table.
For more information, see Updating data in a table.
- Delete transform: You use the Delete transform
to delete a row of data, or multiple rows of data, in a database table.
For more information, see Deleting data from a table.
- Database routine transform: You use a database
routine transform to call a stored procedure or user-defined
function from a database to insert,
delete, or update data in one database table. For more information,
see Calling a stored procedure from a map.
Note: Only IBM DB2 stored procedures are supported
in IBM Integration Bus .
At
design time, you must have a database definition file (.dbm file)
in an available Data Design project for each database that you want
to access. A data definition file contains one connection per database
system.
At run time, you must have a JDBC connection of Type 4 defined for each database that your message map uses. You must configure a JDBCProvider configurable
service per database. The JDBCProvider service name for a runtime database must be the same name
as the development database name that you use in your message map.
For more information,
see Modifying data in a database by using mapping.
Cast function to define a schema type
In the Graphical
Data Mapping editor,
you can use the Cast function to cast schema
types.
You must cast a schema in any of the following instances:
- Cast the value that you assign to an output element so it matches
the output element schema definition type.
- Cast the value of an element that you use as a parameter to a
function where the parameter is of a different type.
- Cast the value of an element that you use as a condition on a
transform where the type is different.
- Cast the value of an element when you work with a database, and
the types differ.
You use the xs:castOperation functions
where castOperation is the name of the cast function
to perform.
Mapping behavior driven by the type of operation
When
the transformations in the
message map are
constructed, the values for output message elements can be derived
from:
- Input message elements, through mapping operations that include:
- Move, Convert, and
other built-in transforms in the Graphical
Data Mapping editor.
- XPath 2.0 functions (prefix fn:). All XPath 2.0
functions are supported by the Mapping node. For more
information about XPath, see W3C
XML Path Language (XPath) 2.0.
- Database input by using a database Select transform.
- Schema type casts; for more information, see Mapping xs:any on an input or output message.
- Additional functions, which allow multiple input values to produce
the output value, such as concat and join.
- The result of database Select, Insert, Update, Delete,
and database routine transforms.
- Constant values, through an assign operation
that uses a supplied value.
- Custom functions, user-defined XPath, Java, or ESQL.
The logic to derive values can be simple or complex. In
addition to the transformation operations that set an output value,
structural transforms are provided to enable conditional statements,
loops, and nesting of transform logic into local maps.
For information
about the supported transform types, see Transform types in the Graphical Data Mapping editor.