Concepts, relationships, and instances
Define valid data types, relationships, facts, and instances in RBlang.
Concepts
Concepts define the entities and values in your knowledge map.
<concept name="Person" type="string"/>
<concept name="Age" type="number"/>
<concept name="Birth Date" type="date"/>
<concept name="Is Active" type="truth"/>RBlang supports exactly four data types:
stringnumberdatetruth
Only string concepts can be used as relationship subjects.
Use concept names for classes of data. Do not use specific values as concept names.
Good:
Product CountBad:
Two
Datasources on concepts
Datasources are optional child elements of a concept.
Use them when Rainbird needs to call an external API for that concept.
In practice, the concept acts as the request subject.
This is advanced functionality. Use the concept definition as the anchor point, then configure the request and mappings in Datasources.
Key points:
A datasource is nested inside the concept definition.
The concept should be a
stringconcept that can act as a relationship subject.{{%S}}inserts the current datasource subject into the request.<input>fetches extra values needed to build the request.<action>maps API response values onto relationships that share the same subject.
Relationships
Relationships connect two concepts.
Relationship attributes:
nameβ required and unique across the whole knowledge mapsubjectβ required and must reference astringconceptobjectβ required and can reference any concept typepluralβ optional, defaults tofalseaskableβ optional, used when Rainbird can ask a user for the valueallowCFβ optional, defaults totrue, lets a user provide a certainty factor when answeringallowUnknownβ optional, defaults tofalse, lets a user skip the questioncanAddβ optional, controls whether a user can add instances not already in the knowledge map. Supported values aresubject,object,all, andnonegroupβ optional, groups questions from relationships that share the same subject. Use commas to assign more than one group. Ensure a group contains two or more relationships.
Never create two relationships with the same name.
Use plural="true" when a subject can have more than one object.
Askable relationships
The askable attribute controls whether Rainbird can ask for facts on the relationship, and what form that question can take.
Supported values:
noneβ do not ask questions for this relationshipsecondFormObjectβ ask for the object value onlysecondFormSubjectβ ask for the subject value onlyallβ allow both subject and object questions, including first-form confirmation questions
Askable values explained
none
Use none when the relationship should never prompt a user.
This is useful when the fact must come from stored data, rules, imports, or an external datasource.
secondFormObject
Use secondFormObject when you know the subject and want Rainbird to ask for the object.
This is the most common pattern.
This asks about the missing object for a known subject.
secondFormSubject
Use secondFormSubject when you know the object and want Rainbird to ask for the subject.
This asks for the missing subject for a known object.
all
Use all when Rainbird can ask in any supported form.
This includes:
second-form object questions
second-form subject questions
first-form confirmation questions that check whether a fact is true
Use none when user questioning is not allowed. Use secondFormObject or secondFormSubject when only one direction makes sense. Use all only when both directions and direct fact confirmation are valid for the same relationship.
Question text
When setting question text use %S as the subject placeholder or %O as the object placeholder in relevant question text.
Concept instances
Concept instances create named instances for string concepts.
Concept instances can also include metadata about the instance.
Do not create concept instances for number, date, or truth concepts.
These are invalid:
Relationship instances
Use relationship instances for facts.
Use primitive values directly for number, date, and truth objects.
Validity checks
Before you save, confirm that:
Every concept exists before a relationship uses it.
Every relationship exists before a fact or rule uses it.
Every subject concept is
string.Every instance type is a
stringconcept.Every datasource action maps only to relationships that share the datasource subject.
Last updated

