new RecordType(parameters)
- Description:
Specifies a record type.
Extends: Type. This class extends Type, with all public methods available.
Type parameters
General parameters
name: ...
The type name. Required value.types: { name: type, ...}
The type of each record item. By default, the name itself is considered as the type name.-
strict
: If true throws an error on undefined types, default isfalse
.
Syntactic projection parameters
required: [ name ...]
required record field, such field must be defined for the record to be valid.forbidden: [ name ...]
forbidden record field, such field must not be defined for the record to be valid.
Parameters for the distance calculation
weight: { name: weight_value ...}
The distance weights when adding all record value.- Default weight value is
1
.
- Default weight value is
Parameters for string parsing
If the input value is a string, there is a possibility to parse this value in order to construct a record, using
getValue()
.parseInput
The regex defining the syntax input.parseOutput
The wjson pattern defining the syntax output.
RecordType specification
Syntactic projection - If a required field is missing its definition is forced using an empty value.
- If a forbidden field is present its definition is erased.
- Each record item is syntactically projected.
Furthermore:
- The value can be parsed using a specific syntax managed by regex replacement.Semantic projection - Each record item is semantically projected. Distance value - The distance is computed as the weighted sum of each record item.
- The distance is computed against the empty value if one record item is missing.Geodesic path - The path is constructed in the record item order scanning simultaneously both record item list. Comparison - The comparison is performed in the record item order scanning simultaneously both record item list.
- Returns 0 If each element pair compares equal and both lists have the same length.
- Returns <0 If either the value of the first item that does not match is lower in the left hand side list, or all compared items match but the left hand side list is shorter.
- Returns >0 If either the value of the first item that does not match is greater in the left hand side list, or all compared items match but the left hand side list is longer.Bounds - Considers all required items bounds to calculate the recod bounds.
Parameters:
Name | Type | Description |
---|---|---|
parameters |
JSON | String | The type parameters. |