Transforms (Mapping operations)
In the Graphical
Data Mapping editor, you can define
mapping operations such as transforms, cast functions, or XPath 2.0
functions. Mapping operations define the transformation actions
on input data, and set the result to the output element.
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 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 define specialized
transformations to build custom ESQL
functions, XPath 2.0, or Java™.
For more information, see Transform types in the Graphical Data Mapping editor.
- XPath functions: You can use XPath 1.0
and XPath 2.0 functions to transform data in a message map.
All
XPath 2.0 functions are supported in the form fn:functionName.
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. You can use the data
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 extra 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 from
a database, and retrieve data. You can use the data in the message map to
set output element values, define conditions, or use as input to build
other transforms conditions.
Mapping operations to modify data in
a database
Database tables can be set as more 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.
To cast a schema, you can use the xs:castOperation
functions, where castOperation is the name of
the cast function.
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 any of the following
components:
- Input message elements, through any of the following mapping operations:
- 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 xsd:any on an input or output message.
- Extra 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.