AreEqualityComparable🔗

Type: Transpilable verification function
Check that left and right can be compared for (in)equality.

Following the normative JSON schema of the query language, the two operands need to be of the same type: a string, a number, a hexadecimal, a boolean, a date-time or a time. A field is implicitly cast to the type of the other operand, and can hence be compared with an operand of any type. A global attribute giving a date and time (LOCALNOW, UTCNOW or CLIENTNOW) can be used both as a string and as a date-time.

See: https://industrialdigitaltwin.io/aas-specifications/IDTA-01002/v3.2/query-language.html#_json_schema

left🔗
First operand of the comparison
right🔗
Second operand of the comparison
Return🔗
True if the operands can be compared for (in)equality

Code

return (
    (_can_be_of_type(left, "string") and _can_be_of_type(right, "string"))
    or (_can_be_of_type(left, "number") and _can_be_of_type(right, "number"))
    or (_can_be_of_type(left, "hex") and _can_be_of_type(right, "hex"))
    or (_can_be_of_type(left, "boolean") and _can_be_of_type(right, "boolean"))
    or (_can_be_of_type(left, "date_time") and _can_be_of_type(right, "date_time"))
    or (_can_be_of_type(left, "time") and _can_be_of_type(right, "time"))
)