uCosminexus Service Platform, Basic Development Guide
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:
The respective activities are described as follows:
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.
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 ) )+ |
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 |
This section describes the points to be considered when creating the column definition file.
1,Name_Kanji 2,Name_Kana 3,Address 4,Tel1 |
Figure K-1 FigureExample of mapping in case of same element name having different namespace
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:
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.