All Comparative Expressions

All Comparative Expressions

Comparative expressions are functions that compare 2 variables or constants, and can be used to compare string or number type concepts. Comparative expression functions are built inside “expressions” when creating a rule, normally with the following formula: 


%VARIABLE_1 comparative_expression %VARIABLE_2

There are 6 types of comparative expressions:

  • is equal to / is equal / equal / equals
  • is not equal to / does not equal
  • greater than / is greater than / gt
  • less than / is less / lt
  • greater than or equal to / gte
  • less than or equal to / lte

Any of the forms above can be used when creating the expression (‘greater than‘ , ‘is greater than‘ and ‘gt‘ will all perform the same function).

Comparative expressions are really useful when creating conditions for rules, and can be used to create rules that can trigger outcomes or not, depending on whether the conditions of a rule have been satisfied.

To illustrate how comparative expressions can be used, we will build a simple map which uses the different functions to check whether a child (LaMarcus Thompson) can ride a big and potentially dangerous roller coaster. 

Before LaMarcus can ride the coaster, a few things need to be checked (size, weight, etc…). We start by creating 5 concepts (“Size” as number, “Money” as number, “Date of birth” as date, “Medical condition” as string, “Weight” as number), which we link to a “person concept” by 5 relationships. We enable the questions on each of these relationships, and we create 3 concept instances for the “Medical condition” concept (“Fragile heart”, “Weak stomach”, “None of the above”).

Figure 1: Basic model

We’ll then create rules to check whether LaMarcus can ride using all of the comparative expressions:

Click on the ‘Export.rbird’ button to download the ‘Comparative Expressions’ map used in this example. The knowledge map can then be imported into your Rainbird Studio.

Query and Results

When using the below RBLang, please run the query on the rule ‘has final advice’ for an example of a query which uses multiple comparatice expressions.

Article Feedback form
Did you find this article useful?

Version 1.02 – Last Update: 22/02/2021