9.11.4 Record extraction definition

You specify a record extraction definition (RecordExtractionDefinition 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 record extraction processing, see 10.5 Record extraction.

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

(1) Format

<RecordExtractionDefinition>
 <targetrecords>
   <targetrecord name="name-of-record-to-be-extracted">
     <record source="record-name"
      timeposition="time-field-name" condition="{AND|OR}">
       <field source="field-name"
        condition="{eq|ge|gt|le|lt|ne}" value="condition-value"/>
     </record>
   </targetrecord>
 </targetrecords>
 <extractions size="maximum-number-of-records-to-be-retained" timeout="{ON|OFF}"
  samerecord="{overwrite|delete}"
   <extraction name="extraction-condition-name" timelimit="timeout-value">
     <targets>
       <target sourceL ="name-of-record-to-be-extracted"
        sourceR="name-of-record-to-be-extracted" condition="AND">
         <fieldcondition sourceL="field-name"
          condition="eq" sourceR="field-name"/>
       </target>
     </targets>
     <extractrecord name="name-of-retrieved-record">
       <select source="name-of-record-to-be-extracted"/>
     </extractrecord>
     <timeoutrecord name="timeout-record-name" />
   </extraction>
 </extractions>
</RecordExtractionDefinition>

(2) Details of definition

RecordExtractionDefinition tag (all definition information)
Defines all record extraction definition information. You specify this definition only once.
targetrecords tag (definition of extraction target condition group)
Defines information about a group of extraction target conditions. An extraction target condition is a single condition for selecting a record to be extracted; it consists of a record condition and field conditions. You specify for the record condition (record tag) the name of a record to be extracted, and you specify for the field conditions (field tag) field values in the record to be extracted.
targetrecord tag (definition of extraction target condition)
Defines an extraction target condition. You can specify a maximum of 10 of these definitions. This definition is mandatory.
name="name-of-record-to-be-extracted"
Specifies a name for an extracted 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 definition only once for an extracted record.
The record name specified in this attribute is also specified in the source attribute in the select tag and the sourceL and sourceR attributes in the target tag.
record tag (definition of record condition)
Defines a record condition. You can specify this definition only once.
source="record-name"
Specifies, as 1 to 100 single-byte alphanumeric characters and the underscore (_), the name of a record to be extracted, which must be in the record format passed from the callback that was processed before the record extraction. This attribute cannot be omitted.
timeposition="time-field-name"
Specifies a field of the TIMESTAMP data type that contains time information, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This attribute cannot be omitted.
condition="{AND|OR}"
Specifies the logical operation for the record condition. If this attribute is omitted, AND is assumed.
The permitted values are as follows:
  • AND
    Outputs in the results the record if it contains a field that satisfies all the field conditions.
  • OR
    Outputs in the results the record if it contains a field that satisfies any of the field conditions.
field tag (definition of field condition)
Specifies a field condition. You can specify a maximum of 10 field condition definitions. This definition is mandatory.
Each field condition applies to a single field of the record to be extracted.
source="field-name"
Specifies the name of a field, which must have the record format specified for source in the record tag, expressed as 1 to 100 single-byte alphanumeric characters and the underscore (_). This attribute cannot be omitted.
condition="{eq|ge|gt|le|lt|ne}"
Specifies the value that represents the desired comparison operator for the field condition.
The specifiable values depend on whether character data or numeric data is specified in the value attribute in the field tag, as explained below. If this attribute is omitted, eq is assumed.
  • When character data is specified
    You can specify eq or ne.
  • When numeric data is specified
    You can specify eq, ge, gt, le, lt, or ne.
For the meanings of the permitted values, see the description of the condition attribute in the field tag in 9.11.3 Filter definition.
value="condition-value"
Specifies the condition value for the field condition, expressed as character data or numeric data. The permitted characters for character and numeric data are shown below. This attribute cannot be omitted.
  • For character data
    You can specify 1 to 128 characters.
    You can use a regular expression for the character string. Because the java.util.regex.Pattern class is used to analyze the regular expression, you must specify a regular expression that is within the range supported by the java.util.regex.Pattern class.
    To use a character that has a special meaning in a regular expression, you must use the backslash (\) as an escape character.
    The following are the characters that have a special meaning in regular expressions:
    (, ), [, ], ., *, ?, +, ^, $
  • For numeric data
    You can specify an integer in the range from -9223372036854775808 to 9223372036854775807.
extractions tag (definition of extraction condition group)
Defines information about a group of extraction conditions. An extraction condition is one of the conditions for selecting a record to be extracted. This definition is mandatory.
size="maximum-number-of-records-to-be-retained"
Specifies the maximum number of records to be retained in the record buffer, as an integer from 1 to 1000000. If this attribute is omitted, 10000 is assumed.
timeout="{ON|OFF}"
Specifies whether timed-out records in the record buffer are to be output from the record buffer when the time specified in the timelimit attribute in the extraction tag has elapsed (such records are called timeout records).
If this attribute is omitted, OFF is assumed.
The permitted values are as follows:
  • ON
    Outputs the timeout records in the event of a timeout.
  • OFF
    Does not output the timeout records in the event of a timeout.
You must use the timeoutrecord tag to define a record name for the timeout records.
samerecord="{overwrite|delete}"
Specifies how to handle the record when the same record to be extracted is input more than once. If this attribute is omitted, overwrite is assumed.
The permitted values are as follows:
  • overwrite
    Processing depends on the location of the record existing in the record buffer that is determined to be the same as the record being input.
    If it is the last record in the buffer, it is overwritten by the record being input. If it is not the last record in the buffer, all records in the record buffer are discarded and then the input record is retained.
  • delete
    Discards the record that was input.
extraction tag (definition of extraction condition)
Defines an extraction condition. You can specify a maximum of 10 of these definitions. This definition is mandatory.
name="extraction-condition-name"
Specifies a name for this extraction condition, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This condition name must begin with a single-byte alphabetic character.
You can specify this definition only once.
timelimit="timeout-value"
Specifies a lifespan (in milliseconds) for records in the record buffer, as an integer from 1 to 3600000 (1 millisecond to 1 hour). When a record in the record buffer reaches the end of the specified lifespan, it becomes a timed-out record.
If this attribute is omitted, 10000 is assumed.
targets tag (definition of a group of conditions between records)
Defines a group of conditions between records.
A condition between records is one of the extraction conditions to be checked. It consists of a record input order (specified in the target tag) and a field name for comparing field values in records (specified in the fieldcondition tag).
target tag (definition of condition between records)
Specifies a record input order as a condition between records. You can specify a maximum of 9 of these definitions. This definition is mandatory.
You define in this definition a records input order by specifying record names in the sourceL and sourceR attributes. For example, the coding below specifies the records input order as R1[Figure] R2[Figure] R3. Records entered in this order will satisfy this records condition.

      :
<rex:target sourceL="R1" sourceR="R2">
      :
<rex:target sourceL="R2" sourceR="R3">
      :

sourceL="name-of-record-to-be-extracted"
Specifies the record name for the left-hand operand of the condition between records, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This record name must begin with a single-byte alphabetic character.
sourceR="name-of-record-to-be-extracted"
Specifies the record name for the right-hand operand of the condition between records, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This record name must begin with a single-byte alphabetic character.
condition="AND"
Specifies the logical operation for the condition between records. If this attribute is omitted, AND is assumed.
The only permitted value is as follows:
  • AND
    Outputs the records that satisfy all the conditions between records.
fieldcondition tag (field definition)
Specifies field names as part of the condition between records. You can specify a maximum of 10 field definitions. This definition is mandatory.
You specify in this definition the names of fields in the records specified in the sourceL and sourceR attributes in the target tag. For example, the coding below compares the value of field F11 in record R1 with the value of field F21 in record R2. If the value of field F11 in record R1 matches the value of field F21 in record R2, the condition between records is determined to be satisfied.

      :
<rex:target sourceL="R1" sourceR="R2">
<rex:fieldcondition sourceL="F11" condition="eq" sourceR="F21"/>
      :

sourceL="field-name"
Specifies the name of a field in the record that is specified in the sourceL attribute in the target tag, expressed as 1 to 100 single-byte alphanumeric characters and the underscore (_). This field name must begin with a single-byte alphabetic character.
condition="eq"
Specifies the value that indicates the desired comparison operator for the record condition. For both character data and numeric data, the only permissible value is eq, which indicates the comparison operator =. If this attribute is omitted, eq is assumed.
sourceR="field-name"
Specifies the name of a field in the record that is specified in the sourceR attribute in the target tag, expressed as 1 to 100 single-byte alphanumeric characters and the underscore (_). This field name must begin with a single-byte alphabetic character.
extractrecord tag (retrieved record definition)
Defines a retrieved record.
A retrieved record is a new record created by joining the records that satisfy the extraction conditions.
name="name-for-retrieved-record"
Specifies a name for the retrieved record, as 1 to 100 single-byte alphanumeric characters and underscore (_). This record name must begin with a single-byte alphabetic character, and must be unique within the standard adaptor.
select tag (definition of record to be extracted)
Defines a record to be joined in order to create the retrieved record. You can specify a maximum of 10 of these definitions. This definition is mandatory.
source="name-of-record-to-be-extracted"
Specifies a record name that was specified in a name attribute in the targetrecord tag, as 1 to 100 single-byte alphanumeric characters and underscore (_). This attribute cannot be omitted.
timeoutrecord tag (timeout record definition)
Defines the record to be output in the event of a timeout. This definition is mandatory when ON is specified in the timeout attribute in the extractions tag. This definition is ignored when OFF is specified in the timeout attribute.
name="timeout-record-name"
Specifies a name for the record that is to be output, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This attribute cannot be omitted. The specified timeout record name must be unique within the standard adaptor.

(3) Example

<?xml version="1.0" encoding="UTF-8"?>
<root:AdaptorCompositionDefinition
xmlns:rex ="http://www.hitachi.co.jp/soft/xml/sdp/adaptor/definition/callback/RecordExtractionDefinition">
<!-- Omitted -->

<!-- CB definition for editing -->
<cb:DataEditCBDefinition class="jp.co.Hitachi.soft.sdp.adaptor.callback.dataedit.recordextract.RecordExtractionCBImpl" name="extractor1">
 <!-- Record extraction definition -->
 <rex:RecordExtractionDefinition>
   <!-- Definition of extraction target condition group -->
   <rex:targetrecords>
     <rex:targetrecord name="element1">
       <rex:record source="R1" timeposition="F11" condition="AND">
         <rex:field source="F12" condition="eq" value="MIKE"/>
         <rex:field source="F13" condition="gt" value="100"/>
       </rex:record>
     </rex:targetrecord>
     <rex:targetrecord name="element2">
       <rex:record source="R2" timeposition="F21" condition="OR">
         <rex:field source="F22" condition="eq" value="JAKE"/>
         <rex:field source="F23" condition="le" value="50"/>
       </rex:record>
     </rex:targetrecord>
   </rex:targetrecords>
   <!-- Definition of extraction condition group -->
   <rex:extractions size="100000" timeout="ON" samerecord="overwrite">
     <rex:extraction name="T1" timelimit="10000">
       <rex:targets>
         <rex:target sourceL="element1" sourceR="element2" condition="AND">
           <rex:fieldcondition sourceL="F13" condition="eq" sourceR="F23"/>
           <rex:fieldcondition sourceL="F14" condition="eq" sourceR="F24"/>
         </rex:target>
       </rex:targets>
       <!-- Retrieved record definition -->
       <rex:extractrecord name="ER1">
         <rex:select source="element1"/>
         <rex:select source="element2"/>
       </rex:extractrecord>
       <!-- Timeout record definition -->
       <rex:timeoutrecord name="TIMEOUT"/>
     </rex:extraction>
   </rex:extractions>
 </rex:RecordExtractionDefinition>
</cb:DataEditCBDefinition>

This coding example defines the following information.