What is a query?


The knowledge map is a model of knowledge. And a query is the question you ask of this model in order to get a decision.

When a query is run, Rainbird will navigate the knowledge in the map in order to try and find the best answer to the query.

It is the query result that provides the automated decision or judgement that can free up stretched resources or expand services. It is therefore the query result that we monitor for billing purposes, but only when the knowledge map(s) have been deployed into production.

Queries are also vital for building, testing and refining your knowledge maps. Therefore there's a variety of tools available to support with testing that does not consume any query allowance.

Making a query

You query relationships within a knowledge map.

When making a query to a relationship, you must provide the subject or object instance (or both). This is explained below, using our simple Hello World example, where we determine the language a person might speak based on a number of factors.

Query typeExampleDescription

Object (most common)

Mike > speaks > ?

This is the equivalent of asking the question "What language does Mike speak?". To do this you provide a partial fact to Rainbird, providing the subject (Mike), the relationship (speaks), and leaving the object blank (represented with a ?).

Rainbird will try to respond with the object and a percentage certainty for this result.


? > speaks > German

This is equivalent of asking the question "Who speaks German?". In this example, you know the object (German) and therefore you provide this and leave the subject blank. Rainbird will try to fill in this blank, responding with a list of people.


Mike > speaks > German ?

This is the equivalent of asking a closed question of "Does Mike speak German?". In this example, you provide both the subject and the object instance. Rainbird will evaluate the data it has available and respond with how certain it believes this to be.

Any relationship can be queried, although it is common to only query those that include rules, with which it can infer an answer.

There are some scenarios where querying a relationship may not provide any answer. Usually this is because the relationship has no rules or data that it can use to respond with an answer.

If the relationship is configured to only ask for information, the engine will abandon the query, rather than asking you for the same information. (The equivalent of asking "Where does Mike live?" and receiving a response of "I don't, where does Mike live?")

What is a session?

Before you can make a query to a knowledge map, you must first start a session. This is like starting a conversation with Rainbird, within which all of the context and data is stored.

Within a session (of which there will be a unique ID) you can inject data, make a query, answer questions, get results and view evidence.

For some solutions you may want to make additional queries within the same session, which can provide additional decisions, whilst taking into consideration any facts that have already been established earlier.

E.g. For an insurance claims map, a result could be provided that Geoff can claim for his broken TV. A further query could be made, in the same session, asking whether this will affect his insurance premium. Because it occurs in the same session, Rainbird will not have to ask for as much, or any, additional information before providing a result.

Starting a session is generally a background step when interacting with the testing tools in the Studio, but it is an important concept to understand when planning your Rainbird-powered solution, as well as for accessing evidence data and reporting.

Last updated