5.2.3. Base Logical Term

[Tip]Description

A base logical term is the most elementary ASM term that evaluates to a boolean value.

[Important]Syntax
EqualityTermAST ::= RelationalTermAST
                  | EqualityTermAST == RelationalTermAST
                  | EqualityTermAST != RelationalTermAST
    
RelationalTermAST ::= ArithmeticTermAST  
                    | RelationalTermAST RelationalOpAST ArithmeticTermAST
                     	                 
RelationalOpAST ::= < | > | <= | >=   

A base logical term can be the following:

A relational expressionis a relation between two arithmetic terms; the relational operator can be equality operators (like equal, $==$ and not equal, !=) or inequality operators such as >, <, >=, <= (where the latter has higher precedence).

[Note]Semantics

A graph pattern call results true if a matching is found and false otherwise.

Relational operators are interpreted between data types according to Table 2.4, “Equal (==) and Not Equal (!=) operators ” and Table 2.5, “Other relational inequality operators (<, >, <=, >=) and Not Equal (!=) operators ”. The cells in the tables define the type of the result when evaluating a relational expression with arguments of a specific datatype.

Equality (and !=) can be tested for any kinds of operands, but the other relations are limited. Semantically the less than and greater than relations are the usual (Java) ones for the Integer and Double values. Regarding Multiplicity values,

  • one-to-one is less than many-to-many, many-to-one, and one-to-many,

  • one-to-many and many-to-one is less than many-to-many;

  • but one-to-many and many-to-one are uncomparable to each other.

Table 2.4. Equal (==) and Not Equal (!=) operators

 UndefBooleanStringIntegerDoubleModelElementMultiplicity
UndefUndefUndefUndefUndefUndefUndefUndef
BooleanUndefBool     
StringUndef Bool    
IntegerUndef  BoolBool  
DoubleUndef  BoolBool  
ModelElementUndef    Bool 
MultiplicityUndef     Bool


Table 2.5. Other relational inequality operators (<, >, <=, >=) and Not Equal (!=) operators

 UndefBooleanStringIntegerDoubleModelElementMultiplicity
UndefUndefUndefUndefUndefUndefUndefUndef
BooleanUndef      
StringUndef      
IntegerUndef  BoolBool  
DoubleUndef  BoolBool  
ModelElementUndef      
MultiplicityUndef     Bool


[Warning]Warning

Note that the evaluation rules of relational operators changed in the new release to be compliant with its use in Java.

Remark.  There is no implicit type casting on the input of the operands except between Integers and Doubles; conversion operators have to be used if casting is required.

Defined In:  conjuntive logical term