Filter Editor

The Filter editor is used to define how data is modified by a Filter bean or Translate filter. Translate filters are used to convert data from one form to another. The Filter bean can perform most data translation operations. The Filter editor creates a Translate template which comprises a set of field templates. Each field template defines the logical data types of the input and output data, numerical scaling and transformation operations, and tables for converting symbols to numeric values. When a Filter bean is defined, you must specify a set of Translate templates, either programmatically or by using the Translate editor.

Translation Process

The translation process consists of three steps as shown in Figure 15. Input data of a logical data type is processed by an optional pre-operator. This data is then converted to the destination logical data type, using the type conversion rules described in Figure 16. The destination data is processed by an optional post-operator before it is output.

Figure 15. Translate Filter Translation Process
 
 

Figure trans not displayed.



Data Types

The Translate filter supports the following logical data types:
Binary code
A standard binary representation for integers. In the simplest case, a binary code of length 1 is 0 or 1 and maps to integers of 0 and 1. If a binary code has length 8, it can represent 256 unique positive integer values ranging from 0 to 255.
One-of-N code
A set of zeros with a single one value. The position of the one in the string indicates its value or category. For example:
    0, 0, 0, 1 represents red
    0, 0, 1, 0 represents green
    0, 1, 0, 0 represents blue
    1, 0, 0, 0 represents yellow
Number
A numeric field with values represented by a 4-byte floating-point number.
Symbol
A character token delimited by spaces. The maximun length allowed is 25 characters. No imbedded spaces are allowed.
Thermometer code
A binary string with the number of ones equal to the value or category. For example:
    0, 0, 0, 1 represents fair
    0, 0, 1, 1 represents okay
    0, 1, 1, 1 represents good
    1, 1, 1, 1 represents best
Vector
A one-dimensional array (vector) of real values. Each vector element is processed as a Number field.

Operators

The following operators are supported in the Translate filter for use with the Number and Vector data types:
Bit AND
Performs a Bit AND operation.
Bit OR
Performs a Bit OR operation.
Bit XOR
Performs a Bit XOR (exclusive-OR) operation.
Acos
Returns the arccosine of the data.
Asin
Returns the arcsine of the data.
Atan
Returns the arctangent of the data.
Cos
Returns the cosine of the data.
Cosh
Returns the hyperbolic cosine of the data.
Sin
Returns the sine of the data.
Sinh
Returns the hyperbolic sine of the data.
Tan
Returns the tangent of the data.
Tanh
Returns the hyperbolic tangent of the data.
Abs
Returns the absolute value of the data.
Ceil
Returns the smallest integer that is greater than or equal to the data value.
Div
Returns the integer portion after a division of integers.
Exp
Returns the exponential function of the data.
Exp10
Returns the exponential function of the data (base 10).
Floor
Returns the value representing the largest integer that is less than or equal to the data value.
Log
Returns the natural logarithm of the data.
Log10
Returns the base 10 logarithm of the data.
Modulo
Returns the remainder after a division of integers.
None
No operation is performed on the data. This is the default.
Round
Round a real-valued number to the closest integer value.
Scale
Scales data in a piece-wise linear fashion around a midpoint you define.
Sqrt
Returns the square root of the data.
Square
Returns the square of the data.
Threshold
Sets numeric data in specified ranges to specific values. A threshold operator has one or more ranges, each with a lower boundary, an upper boundary, and a set-to-value. When an input value is greater than a lower boundary and less than or equal to an upper boundary, the set-to-value is the output of the threshold operator. A value that does not fall with one of the ranges is unchanged. If the boundaries overlap, the first boundary pair satisfied is selected.
Truncate
Truncates a real number to its integer value by dropping any fractional part.
The following operators are valid only on Vector data types:
NormL1
Divide each element of the vector by the sum of all of the elements.
NormL2
Performs a Euclidean normalization of the vector field.
NormMax
Divide each element of the vector by the largest element in the vector.
The following operators are valid only on Symbol data types:
LowerCase
Forces all characters in a symbol field to lowercase.
Translate
Substitutes a defined output string for the input strings defined in the translation table. If the input string is not found, the default output is returned. The input data type can be symbol or numeric, which is converted internally to symbol. The output data type is always symbol.
UpperCase
Forces all characters in a symbol field to uppercase.
The following functions are valid only for the One-of-N data type. See Figure 17 for an example illustrating how One-of-N data is converted to a single numeric field value.
Max
Examines the source size number of elements from the input buffer and returns the position of the element that has the highest value. (Ref #5.) The following examples show the result given a source size of five for the field elements shown:
    Data:           0.4  0.3  0.5  0.1  0.7
    One-of-N code:  0    0    0    0    1
    Max field value:          1
 
    Data:           0.4  0.1  0.9  0.1  0.7
    One-of-N code:  0    0    1    0    0
    Max field value:          3
Min
Examines the source size and number of elements from the input buffer and returns the position of the element that has the lowest value. The following examples show the result given a source size of five for the field elements shown:
    Data:           0.4  0.3  0.5  0.1  0.7
    One-of-N code:  0    0    0    1    0
    Min field value:          2
 
    Data:           0.4  0.1  0.9  0.1  0.7
    One-of-N code:  0    1    0    0    0
    Min field value:          4
Data Conversions

The source data is converted into the destination logical type data using the predefined conversion operations described in Figure 16.

Figure 16. Data Type Conversions
Source  Destination 
Binary Code  Number  One-of-N Code  Symbol  Thermometer Code  Vector 
Binary Code  None  Figure cd2num not displayed. Figure cd2cd not displayed. Figure cd2sym not displayed. Figure cd2cd not displayed. Figure vect not displayed.
Number  Figure num2cd not displayed. None  Figure num2cd not displayed. Figure cnvtab not displayed. Figure num2cd not displayed. Invalid 
One-of-N Code  Figure cd2cd not displayed. Figure cd2num not displayed. None  Figure cd2sym not displayed. Figure cd2cd not displayed. Figure vect not displayed.
Symbol  Figure sym2cd not displayed. Figure cnvtab not displayed. Figure sym2cd not displayed. None  Figure sym2cd not displayed. Invalid 
Thermometer Code  Figure cd2cd not displayed. Figure cd2num not displayed. Figure cd2cd not displayed. Figure cd2sym not displayed. None  Figure vect not displayed.
Vector  Figure vect not displayed. Invalid  Figure vect not displayed. Invalid  Figure vect not displayed. None 

One to One Mapping: