What is a query?
Overview
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.
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.
Subject
? > 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.
Certainty
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.
What is a session?
Starting a session is like starting a conversation with Rainbird. One must be started before a query is made, data provided and decisions returned.
Within a session you can inject data, make a query, answer questions and get results.
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.
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.
Understanding session expiry
A session is established in order to get a decision, or decisions, on a particular subject. As part of this session, you may inject data and/or answer questions in order to get a result.
Following 24 hours of no activity, a session will expire and it cannot be resumed. This means you cannot make changes to the data or run queries in this session, however evidence from the session will continue to be available for the period of your data retention policy.
The following are regarded as activities that will prolong the length of a session:
injecting data,
making queries,
answering questions,
undoing previous interactions
Session expiry does not impact evidence.
Regardless of whether the session is active or expired, the evidence from this session will be available for the period of your data retention policy.
Any activity to view evidence from a session (i.e. accessing evidence tree data, session data or interaction logs from the Studio or API) has no impact on session expiry and therefore they will not reset the 24 hour window.
Last updated