Data Dictionaries

Data Dictionaries

The Data section of the toolbox allows you to deal with data that is sent to the Blawx.com server at run-time by other pieces of software that connect over the Blawx Reasoner API.

When writing and testing your code, you will want to set out test data that works in the same way as data submitted over the API.

The data dictionary blocks allow you to do this. There are three.

This is the main data dictionary block. It creates an object with the name that you give it, which is “data” by default. “Data” is also the name given by the Blawx Reasoner to data it receives over the API.

The “data” object created by this block will be visible in the Known Objects section of the toolbox.

The data dictionary needs to be placed inside a Fact block to work properly.

Inside the data dictionary, you can place data values, or sub-dictionaries. A data value consists of a name and a value assigned to that name, and looks like this:

Any name can be used, and it will accept any type of value, but not variables.

A sub-dictionary looks like this, and works in the same way as a data dictionary except that it does not have a name.

Sub-dictionaries also accept both data values and sub-dictionaries.

If you are expecting to receive data from another application in JSON format that looks like this:

{
 foo: {
  'this': 'that',
  'one': 1
 }
}

You could simulate that inside Blawx by using this data dictionary:

Note that if your rules rely on Categories, data dictionaries do not include Categories. In order to make your rules work with external data, or data specified in a data dictionary, you must create rules which will assign Categories to those objects.

No Comments

Add your comment