Rules --> Advanced Expressions

Boolean Operators and / or ( true / false )

Boolean functions return one of two values, either TRUE or FALSE.

In the following example,  two boolean concepts (TRUE/FALSE) named ‘over 18’ and ‘under 16’, have been created to show in which age bracket a person would fall under.

Figure 1: Creating a boolean concept

Create the following concepts:

2 string concepts – ‘Person‘ and ‘Action

2 boolean concepts – ‘18 and over‘ and ‘16 and under

Next, link the concepts together with relationships, as shown in the image below:

Figure 2: Map to check whether a person can perform an action.

Rainbird will work out if a Person (subject) can do an Action (Object), if they are 16 or under, or 18 and above, depending on the action.

We add to our “action” concept the concept instances ‘Adult’, ‘Young Adult’ and ‘Teenager’,so Rainbird will return a string (e.g. ‘Adult’) rather than a 1 for true or 0 for false. Creating concept instances also allows us to add meta text to the strings Rainbird will return, which will provide the user with more information about the result Rainbird returns.


Figure 3: ‘Person’ Concept instances

The map has three different Rules which all sit on the ‘belongs to age group’ relationship:

Figure 4: Rules on ‘belongs to age group’ relationship

The first rule will return the result ‘Adult’ if the the result for the answered object “%ABOVE_18” returns the result 1 (TRUE):


Figure 5: ‘Adult’ object specific rule

The second rule will return the result ‘Young Adults‘: when the %AGE greater 16 AND %AGE less than 18. In the expression, for variation, we assign the variable to the object, to be used in the following comparison expression:

 


Figure 6: ‘Young Adult’ object specific rule

The final rule will return the result ‘Teenager’ if the the result for the answered object “%UNDER_16” returns the result 1 (TRUE):

 


Figure 7: ‘Teenager’ object specific rule

Example:

When the selection in the Query is ‘Yes’ for above 18 the boolean object=”true” is matched.

Figure 7: Boolean question

Rainbird will ask a second question: “Is the Subject ‘below 16′?”. When replied with ‘No’ the query result will be:

Figure 8: ‘Adult’ result with additional meta text

The RBLang below will generate the example map used in the ‘subject’ section of the article. Click on ‘Export .rbird’ to download the knowledge map, or ‘copy RBLang’ and paste the code directly into Rainbird.

Query and Results

When viewing the knowledge map generated by the RBLang below, please run the query on the relationship ‘belongs to age group’ for an example of a query that uses boolean concepts.

Article Feedback form
Did you find this article useful?

Version 1.01 – Last Update: 22/02/2021