9.11.2 Mapping definition

You specify a mapping definition (MappingDefinition tag) as a child element of a CB definition for editing (DataEditCBDefinition tag) described in 9.9.3 CB definition for editing.

For details about mapping processing, see 10.2.2(4) Mapping or 10.6.2(3) Mapping.

Organization of this subsection
(1) Format
(2) Details of definition
(3) Example

(1) Format

<MappingDefinition ioType="{INPUT|OUTPUT}">
 <source>
   <streams>
     <stream name="stream-name"
      querygroup="query-group-name">
       <column name="column-name"
        type="{INT|SHORT|BYTE|LONG|BIG_DECIMAL|FLOAT|DOUBLE|STRING |DATE|TIME|TIMESTAMP}"/>
     </stream>
   </streams>
 </source>
 <target>
   <streams>
     <stream name="stream-name"
      querygroup="query-group-name">
       <column name="column-name"
        type="{INT|SHORT|BYTE|LONG|BIG_DECIMAL|FLOAT|DOUBLE|STRING |DATE|TIME|TIMESTAMP}"/>
     </stream>
   </streams>
   <records>
     <record name="record-name">
       <field name="field-name" type="{INT|SHORT|BYTE|LONG|BIG_DECIMAL|FLOAT|DOUBLE|STRING |DATE|TIME|TIMESTAMP}"/>
   </records>
 </target>
 <intermediate>
   <mappings source="source-name"
    querygroup="query-group-name"
    target="target-name">
     <map source="source-path-expression"
      function="built-in-function-name" argument1="argument-1"
      argument2="argument-2" target="target-path-expression"/>
   </mappings>
 </intermediate>
</MappingDefinition>

(2) Details of definition

MappingDefinition tag (all definition information)
Defines all mapping conversion definition information. You specify this definition only once.
ioType="{INPUT|OUTPUT}"
Specifies the type of standard adaptors being specified in this definition. This attribute cannot be omitted.
The permitted values are as follows:
  • INPUT
    Specifies that mapping is being defined for input adaptors.
  • OUTPUT
    Specifies that mapping is being defined for output adaptors.
source tag (mapping source definition)
Defines information about the streams at the mapping source.
As shown in the table below, the information to be specified in this tag depends on the value of the ioType attribute in the MappingDefinition tag and what is being mapped.
Value of ioType attributeWhat is being mappedInformation to be specified in the source tag
INPUTMapping between record and streamSpecify an empty-element tag
Mapping between records
OUTPUTMapping between record and streamSpecify the streams tag
Mapping between recordsSpecify an empty-element tag
target tag (mapping target definition)
Defines information about the streams or records at the mapping target.
As shown in the table below, the information to be specified in this tag depends on the value of the ioType attribute in the MappingDefinition tag and what is being mapped.
Value of ioType attributeWhat is being mappedInformation to be specified in the target tag
INPUTMapping between record and streamSpecify the streams tag
Mapping between recordsSpecify the records tag
OUTPUTMapping between record and streamSpecify an empty-element tag
Mapping between recordsSpecify the records tag
streams tag (stream group definition)
Defines under the source or target tag information about the group of streams at the mapping source or target, respectively, when mapping is being performed between record and stream.
If you specify this definition, you specify it only once.
stream tag (stream definition)
Defines information about a stream at the mapping source or target.
You can specify a maximum of 1,024 stream definitions. This definition is mandatory.
name="stream-name"
Specifies the name of a stream, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This name must begin with a single-byte alphabetic character. The specified pair of a stream name and a query group name must be unique within the streams tag. This attribute cannot be omitted.
querygroup="query-group-name"
Specifies the name of the query group, as 1 to 64 single-byte alphanumeric characters and the underscore (_). This name must begin with a single-byte alphabetic character. The specified pair of a stream name and a query group name must be unique within the streams tag. This attribute cannot be omitted.
column tag (column definition)
Defines information about the columns in the stream at the mapping source or target.
You can specify a maximum of 3,000 column definitions. This definition is mandatory.
name="column-name"
Specifies the name of a column, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This name must begin with a single-byte alphabetic character. The specified column name must be unique within the column definition in the streams tag. This attribute cannot be omitted.
type="{INT|SHORT|BYTE|LONG|BIG_DECIMAL|FLOAT|DOUBLE|STRING|DATE|TIME|TIMESTAMP}"
Specifies the column's data type, which must correspond to a CQL data type.
For details about the values for this attribute and the corresponding CQL data types, see 9.11.1(6) Values of the type attribute and the corresponding Java and CQL data types.
records tag (record group definition)
Defines under the target tag information about a group of records at the mapping target when mapping is performed between records.
If you specify this definition, you specify it only once.
record tag (record definition)
Defines information about a record at the mapping target. You can specify a maximum of 1,024 record definitions. This definition is mandatory.
name="record-name"
Specifies the name of a record, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This record name must begin with a single-byte alphabetic character.
You can specify this attribute only once for a record. This attribute cannot be omitted. This record name must be unique within the corresponding standard adaptor.
field tag (field definition)
Defines information about the fields in the record at the mapping target. You can specify a maximum of 3,000 field definitions. This definition is mandatory.
name="field-name"
Specifies the name of a field, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This field name must begin with a single-byte alphabetic character. You can specify this attribute only once for a field. This attribute cannot be omitted. This field name must be unique within the corresponding record.
type="{INT|SHORT|BYTE|LONG|BIG_DECIMAL|FLOAT|DOUBLE|STRING|DATE|TIME|TIMESTAMP}"
Specifies the field's data type, which must corresponds to a Java data type. This attribute cannot be omitted.
For details about the values for this attribute and the corresponding CQL data types, see 9.11.1(6) Values of the type attribute and the corresponding Java and CQL data types.
intermediate tag (intermediate mapping definition)
Defines information about mapping from the source to the target.
You specify this definition only once.
mappings tag (mapping group definition)
Defines mapping information.
You can specify a maximum of 1,024 mapping definitions. This definition is mandatory.
source="source-name"
Specifies a source stream name or record name, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This attribute cannot be omitted.
As shown in the table below, the information to be specified in this attribute depends on the value of the ioType attribute in the MappingDefinition tag and what is being mapped.
Value of ioType attributeWhat is being mappedInformation to be specified in the source attribute
INPUTMapping between record and streamSpecify the record name at the mapping source
Mapping between records
OUTPUTMapping between record and streamSpecify the stream name that was specified in the name attribute in the stream tag
Mapping between recordsSpecify the record name at the mapping source
querygroup="query-group-name"
Specifies, as 1 to 64 single-byte alphanumeric characters and the underscore (_), the name of the query group to which the source stream or target stream belongs when mapping is performed between record and stream. This name must begin with a single-byte alphabetic character. The specified pair of a query group name and a source name or the specified pair of a query group name and a target name must be unique within the mappings tag.
As shown in the table below, the information to be specified in this attribute depends on the value of the ioType attribute in the MappingDefinition tag and what is being mapped.
Value of ioType attributeWhat is being mappedInformation to be specified in the querygroup attribute
INPUTMapping between record and streamSpecify the query group name in the streams tag under the target tag
Mapping between recordsDo not specify
OUTPUTMapping between record and streamSpecify the query group name in the streams tag under the source tag
Mapping between recordsDo not specify
target="target-name"
Specifies the stream name or record name at the mapping target, as 1 to 100 characters. The specified target name must be unique within the mappings tag. This attribute cannot be omitted.
As shown in the table below, the information to be specified in this attribute depends on the value of the ioType attribute in the MappingDefinition tag and what is being mapped.
Value of ioType attributeWhat is being mappedInformation to be specified in the target attribute
INPUTMapping between record and streamSpecify the stream name that was specified in the name attribute in the stream tag
Mapping between recordsSpecify the record name that was specified in the name attribute in the record tag
OUTPUTMapping between record and streamSpecify the record name at the mapping target
Mapping between recordsSpecify the record name that was specified in the name attribute in the record tag
map tag (mapping information definition)
Defines mapping information. The order of the instances of this tag must match the order of the stream or record components for the mapping target. You can specify a maximum of 3,000 mapping information definitions. This definition is mandatory.
source="source-path-expression"
Specifies as a source path expression the name of a source field, as 1 to 1,024 characters. This attribute cannot be omitted.
As shown in the table below, the information to be specified in this attribute depends on the value of the ioType attribute in the MappingDefinition tag and what is being mapped.
Value of ioType attributeWhat is being mappedInformation to be specified in the source attribute
INPUTMapping between record and streamSpecify the name of a field that belongs to the record whose name was specified in the source attribute in the mappings tag
Mapping between records
OUTPUTMapping between record and streamSpecify the name of a field that belongs to the stream whose name was specified in the source attribute in the mappings tag
Mapping between recordsSpecify the name of a field that belongs to the record whose name was specified in the source attribute in the mappings tag
function="built-in-function-name"
When you perform mapping between records, you can use built-in functions in the function attribute in the map tag to acquire character strings or a time from a common record at the source and apply them to a common record at the target.
You specify in this attribute the name of the built-in function to be used to acquire a character string or time. Note that this attribute cannot be specified for mapping between record and stream (mapping to a common record in the case of input streams, or mapping from a common record in the case of output streams).
The values permitted for this attribute are as follows:
  • regexsubstring
    Specify this value to acquire a partial character string in regular expression from the input character string. The return value is a character string of the String type.
    When you specify regexsubstring, specify arguments in the argument1 and argument2 attributes.
  • getTupleTime
    This value is permitted only for output adaptors. Specify it to acquire the time in a tuple that is output from the output stream by the output adaptor. The return value is a time of the TIMESTAMP data type (in milliseconds).
    When you specify getTupleTime, there is no need to specify the argument1 or argument2 attribute.
    Note that getTupleTime cannot be specified when the value of the ioType attribute in the MappingDefinition tag is INPUT.
  • subTime
    Specify this value to obtain the time difference between the time values in two fields. The smaller time value is subtracted from the larger time value to obtain the difference. The return value is a time of the LONG type (in milliseconds).
    When you specify subTime, specify arguments in the argument1 and argument2 attributes.
argument1="argument-1"
Specifies the first argument of the built-in function specified in the function attribute.
  • When regexsubstring is specified in the function attribute
    Specifies the name of the String-type field that stores the input character string, expressed as 1 to 100 single-byte alphanumeric characters and the underscore (_).
  • When subTime is specified in the function attribute
    Specifies the name of the TIMESTAMP-type field that stores the time, expressed as 1 to 100 single-byte alphanumeric characters and the underscore (_).
argument2="argument-2"
Specifies the second argument of the built-in function specified in the function attribute.
  • When regexsubstring is specified in the function attribute
    Specify in the format shown below the condition for extracting a partial character string, as 2 to 1,024 characters:

    [regular-expression] "("[regular-expression]")"[regular-expression]

    Because the java.util.regex.Pattern class is used to analyze the regular expression, you must specify a regular expression within the range supported by the java.util.regex.Pattern class.
    If the input character string in the field specified in argument-1 matches the character string in the regular expression specified in argument-2, the character string that corresponds to the part enclosed in ( and ) is returned (String type). If they do not match, the null character is returned.
  • When subTime is specified in the function attribute
    Specify the name of the TIMESTAMP-type field that stores the time, expressed as 1 to 100 single-byte alphanumeric characters and the underscore (_).
target="target-path-expression"
Specifies as a target path expression the name of a target field, expressed as 1 to 100 single-byte alphanumeric characters and the underscore (_). This specified field name must be unique within the mappings tag. This attribute cannot be omitted.
The value of this attribute depends on the value of the ioType attribute in the MappingDefinition tag, as described below.
  • When INPUT is specified in the ioType attribute
    Specify the name of a field that belongs to the named target stream or record.
  • When OUTPUT is specified in the ioType attribute
    Specify the name of a field that belongs to the named target record.

(3) Example