StringType

StringType

new StringType(parameters)

Description:
  • Specifies a string type.

    Extends: Type. This class extends Type, with all public methods available.

    Type parameters

    General parameter

    • name: ... The type name, if specific. By default the type name is string.

    Parameters for the syntactic projection

    • checkPattern: The regex pattern defining if the string is valid. By default any string is valid.
      • Using (value_1|value_2|...) allows to define an enumeration, i.e., constraints the string to equal only one of these values.
      • Using a unique value allows to define a constant value, i.e., constraint the string to equal only this value.
    • minLength: ... The minimal length of the string. By default 0.
    • maxLength: ... The maximal length of the string. By default unbounded (-1).

    Parameters for the cost calculation

    • deleteCost: ... The non-negative deleting cost value. Default is 1.
    • insertCost: ... The non-negative inserting cost value. By default equals to the deleteCost.
    • editCost: ... The non-negative editing cost value. Default is 1.

    Parameters for the geodesic calculation

    • atomic: ...
      • If true returns only an atomic path with the two left-hand and right-hand elements. Default is true.
      • If false returns a path with all intermediate edition.

    Parameters for the bounds calculation

    • bounds: ...` A list of bounds for the string, manually defined.

    StringType specification

    Syntactic projection - If the value is not a string but a structured value, a message is issued and the string representation of the structured value is taken.
    - If the string syntax is incorrect with respect to the optional checkPattern regex, a message is issued, but the string is unchanged.
    - If the string length is not in the (optional) [minLength, maxLength] bounds, a message is issued, but the string is unchanged.
    Semantic projection - Any value as wJSON value has a string representation.
    Distance value - The distance is computed as a usual edit distance.
         - It is delegated to the ListType applied on the char list of the string.
    Geodesic path - If atomic the geodesic is of length 1 if the string are equal, and 2 otherwise. - If not atomic, the geodesic is computed from the edit distance.
    Comparison - Returns 0 If each char pair compares equal and both strings have the same length.
    - Returns <0 If either the value of the first char that does not match is lower in the left hand side string, or all compared chars match but the left hand side string is shorter.
    - Returns >0 If either the value of the first char that does not match is greater in the left hand side string, or all compared chars match but the left hand side string is longer.
    Bounds - The bounds are manually entered as parameters, otherwise the empty value is the unique bound.
Parameters:
Name Type Description
parameters JSON | String

The type parameters.

Members