uCosminexus Service Platform, Basic Development Guide

[Contents][Glossary][Index][Back][Next]

Appendix K. Auto mapping of data acquired by DB adapter

This section describes the method of automatically mapping the data acquired by DB adapter, in the format in which column name serves as element name.

Use this method for automatically implementing "Appendix J. Examples of transforming the format of data acquired by using the database adapter". However, take note of the following points, while defining.

Flow of mapping is as follows:

  1. Create the column definition file, based on the SQL operation definition file, request message and response message.
  2. Perform mapping to the data transformation definition screen, by using the created column definition file.

The respective activities are described as follows:

Organization of this section
(1) Creating the column definition file
(2) Mapping in the data transformation definition screen

(1) Creating the column definition file

The column definition file is CSV format file in which Position()[transformation source column number] of the search result of DB adapter is associated with transformation destination element name of XML schema.

(a) Format

Format of the column definition file is as follows:

Transformation source string number, transformation destination element name [linefeed]
  :

Following table describes the syntax of the column definition file:

Table K-1 TableSyntax of the column definition file

Item Syntax of the column definition file
Column definition file (Line data linefeed code)*
Line data Space* [ transformation source string number blank* ] [ ',' blank* transformation destination element name blank* ]
Linefeed code '\r\n' | '\r' | '\n'
Blank ' ' | '\t'
Transformation source string number ('0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9') +
Transformation destination element name ( MS932 character - ( ',' | ':' | blank | linefeed code ) )+
(b) Definition example

This section describes the definition example of column definition file when acquiring the following table structure data with DB adapter, by considering the contents of database of "Appendix J.1 Examples" as an example.

Table K-2 TableTable structure (first row indicates column name)

Order_number (INTEGER) Customer_code (CHAR) Product_code (CHAR) Number_of_orders (INTEGER)
1 AA001 0001 5
2 AB002 0001 1
3 AA001 0102 3
4 XA005 0103 1
5 AA001 0105 1

This table stricture data is acquired from DB adapter, as described in the following table.

Table K-3 TableData acquired from DB adapter (first row indicates acquisition order (column number))

1 2 3 4
1 AA001 0001 5
2 AB002 0001 1
3 AA001 0102 3
4 XA005 0103 1
5 AA001 0105 1

As described above, in case of data acquired from DB adapter, you cannot reference the value with column name as key. Therefore, you must transform to the format where column name is the element name.

Accordingly, use the column definition file to define which column number of the data acquired from the DB adapter is to be mapped with which element name.

Definition example of the column definition file

1,Order_number
2,Customer_code
3,Product_code
4,Number_of_orders

First row of this column definition file indicates that the DB adapter maps the data in first column to the Order_number.

Thus, When you perform auto mapping by using this column definition file, the data acquired from the DB adapter is transformed as follows and you can reference the value by considering the element name (column name) as key.

Table K-4 TableTable structure (first row indicates the column name)

Order_number Customer_code Product_code Number_of_orders
1 AA001 0001 5
2 AB002 0001 1
3 AA001 0102 3
4 XA005 0103 1
5 AA001 0105 1
(c) Notes

This section describes the points to be considered when creating the column definition file.

(2) Mapping in the data transformation definition screen

Use the data transformation definition to perform automatic mapping to the format in which column name is the element name.

In the transformation source schema tree view of the data transformation definition screen, set the data acquired with DB adapter and in the transformation destination schema tree viewer, set the XML schema having format after conversion.

Method of mapping is as follows:

  1. Select parent element (complex contents element) of the element that is transformation destination mapping target.
  2. Right click when the parent element is in selected status.
    Popup menu is displayed.

    [Figure]

  3. From popup menu, select [Special mapping]-[DB adapter].
    DB adapter mapping settings dialog is displayed.

    [Figure]

  4. Select the mapping source and specify the column definition file.

    [Figure]

  5. Click Finish button.
    Auto mapping is performed.

    [Figure]

    If the element name under the node for which you selected DB adapter in the popup menu, and the transformation destination element name of the column definition file do not match, or the matching element is not the mapping target, warning message is displayed.
  6. Perform mapping of Repeat function from transformation source element to transformation destination element.
    For details on how to define the repeat function, see "6.5.16 Mapping Looping".