Alt Text – Debugging expressions and Traversing relationships

Debugging expressions and Traversing relationships

After completing a query, Rainbird will create an evidence tree and display fact cards about the decisions made for all relationships, rules and expressions Rainbird has used to complete the query. By default, Rainbird will populate the fact cards using the relationship and subject names as they are stored in the knowledge map. The information presented in the evidence tree can be changed, to improve the readability and accessibility of the evidence tree, by debugging expressions’ and usingtraversing’ alt text.

Before we can use alt text, we need a knowledge map. The knowledge map below is a map that determines whether a person can successfully access and log in to an account. To be able to access the account, a person enters their National Insurance Number and Rainbird will check if there is an existing account registered with the same National Insurance Number. The rule to return a successful/unsuccessful result sits under the ‘access account’ relationship.

Figure 1: Example ‘account login’ knowledge map

After running the query, the evidence tree displays the different Subjects, Objects, relationship names and expressions used by Rainbird to determine the result:

Figure 2: Evidence tree without alt text

The wording used in the evidence tree matches the wording in the conditions:

Figure 3: rule condition

As a rule could run through several complex relationships and expressions to return a result, the information in the evidence tree might not always be easy to understand by an end-user. To improve the user experience by making the information in the evidence tree easier to understand, the alt text featurecan be used to define the information for any rule, relationship or expression displayed by Rainbird in the evidence tree. 

For example, to return ‘Dan user access successful’ rather than the result displayed previously, the alt command, ‘{{%S}} User access {{%O}}’ needs to be inserted into the alt text option of the appropriate rule (see Figure 4). Square {{ }} brackets with %S or %O between them are used to insert the subject i.e ‘Dan’ and the object i.e. ‘successful’ into the alt text generated by Rainbird

Figure 4: Alt text option of a rule

On top of the altering the rule outcome text, each of the condition and condition expressions text can also be changed, individually:

Figure 4: Alt text option of conditions

On re-running the query, the evidence tree would now display “Dan User access Successful” instead of “Account Dan Access Account Login Successful”:

Figure 6: Evidence tree using alt text

The traversing relationship feature enables us to add additional information to a subject or object connected via a relationship and a Concept Instance when reviewing the evidence tree. 

Continuing with the “account login” example above, the map has been expanded to add the concept ‘Gender’ and two concept instances for Gender, male and female. A fact has been created between ‘Dan’ and ‘Gender”: DAN has gender MALE’

Figure 7: ‘Dan’ has gender ‘Male’

In the rule alt text option,  the Subject is linked via the Relationship by of relationship – in our example, %S.has gender:

Figure 8: “Traversing” alt text added

The result will display ‘male’ in the evidence tree:

Figure 9 Evidence tree using “traversing” alt text

  • If a variable subject or object has multiple instances, all would be displayed in the evidence tree.
  • “Traversing” alt text can also be linked to facts generated at runtime.

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

Query and Results

For an example of a query that uses alt text and “traversing” alt text, run the query on the ‘access account’ relationship.

Article Feedback form
Did you find this article useful?

Version 1.01 – Last Update: 21/04/2022