You are viewing the documentation for Blueriq 14. Documentation for other versions is available in our documentation directory.

What is it for?

Data rules are used to model decisions based on data from a CSV file

For the design guide on how to model logic see Decision Management guide.

What is it?

A data rule is an inference rule that uses a data source (CSV resource) to derive one or more attribute values.

What does it do?

A data rule derives the value of one or more attributes of one and the same entity based on a data set and some given criteria. The data source can be external, i.e. placed on the server, or it can be stored directly in your Blueriq Studio model.

How to – create a data rule

  • Select the Home tab
  • From the Logic group select the Data rule icon
  • Fill in the required fields and open the wizard
  • Finish the wizard (see CSV wizard)

Properties


PropertyDescription
NameIdentifies the data rule. Maximum 50 characters (only letters, numbers and underscores (_)) are allowed.
Functional nameOptional, can be used in documentation
DescriptionOptional
Justification assetThe Justification asset contains an explanation behind the logic that is used in the data rule. Select the asset from the drop down list.
CSV wizardOpens the CSV wizard to create a data rule and a data resource if needed.
Data ruleShows the data rule created with the CSV wizard.

CSV wizard

The CSV wizard helps you to use a text file as a(n external) data source.

There are two commonly used text file formats:

  • Delimited text files (.txt), in which the TAB character typically separates each field of text.
  • Comma separated values text files (.csv), in which the comma character (,) typically separates each field of text

CSV wizard, step by step

Open the CSV wizard

On the Connectivity tab, in the Connections group, click the CSV wizard icon.

Step 1: Select the desired output

The first step lets you choose what to create.

  • Resource – This object holds either a reference to an external CSV file or the data of an imported CSV file itself. Imported data is read-only.
  • Service call – The CsvConnectivityService refers to a resource and exists of a combination of criteria and goal attributes. When called in a flow, the service assigns attributes a value based on the given criteria and the resource’s data. To create this service call you need to have the service type CsvConnectivityService at your disposal.
  • Data rule – The data rule refers to a resource and exists of a combination of criteria and goal attributes. When the value of one of the goal attributes is required, they are all given a value based on the given criteria and the resource’s data.

When creating a service call or a data rule, the wizard lets you choose to use an existing resource or to create a new one.

Choose to create a service call or a data rule and click Next.

Step 2: Select resource

You can choose to use an existing resource or create a new one.

  • CSV file – Use the to import a CSV text file.
  • Is external – The resource can be an external text file located on the server or internal data from the imported text file.

If internal, the data from the imported text file will be stored in your model.

If external, the imported text file will only be used as an example for configuration of the resource and service call or data rule. The actual data will be supplied by the runtime. The location of the text file on the server is configured in the runtime. Note that Blueriq is only authorized to look for files inside the 

spring.config.additional-location
 folder.

To configure a new external data source in the runtime dashboard, open Settings > Connections > Resource, type in the name of the resource in your model (the connection must have the same name as the resource) and press 'Add new connection'.

Then specify the path that starts in the 

spring.config.additional-location
 folder, e.g. //Data/Customers.csv, and press Save. Your application.properties file now contains a new line, e.g. blueriq.connection.Customers.resource.path=//Data/Customers.csv. If the data in the CSV is changed, you will have to reload the session to see the changes in the runtime.

Click Next.

Step 3: Format settings

Field separation – If the items in the text file are separated by tabs, colons, semicolons, spaces, or other characters, select Delimited. If in every column all items are of the same length, select Fixed width. Delimiter – Select the character that separates values in your text file. If the character is not listed, select Other and enter the character. (These options are not available if field separation is Fixed width.) Columns – Enter the number of columns and for each column the number of characters defining the width. (This option is not available if field separation is Delimited.) Text qualifier – Select the character that encloses values in your text file. When Blueriq Studio encounters the text qualifier character, all of the text that follows that character and precedes the next occurrence of that character is imported as one value, even if the text contains a delimiter character.

For example, if the delimiter is a comma (,) and the text qualifier is a quotation mark (”), “Broccoli, beans or tomatoes” is imported into one cell as “Broccoli, beans or tomatoes”. If no character or the apostrophe (') is specified as the text qualifier, “Broccoli, beans or tomatoes” is imported into two adjacent cells as “Broccoli” and “beans or tomatoes”.

Select File has column names on first row, if the first row in the text file contains headers.

Type – Select the base type for each column. Format – If the data in your text file is not formatted according to the Blueriq Studio date, or number formats, you should specify how Blueriq Studio should convert the data. You can do so by specifying conversion formats per column. If the data in your file is formatted correctly, you can leave the format fields empty.

Click Next.

Step 4: Select criteria and goals

All collected data must be stored in attributes of the same entity.




If there are other entities that have a relation with the selected entity, you have to specify which path you want to use to create the instances. (This option is not available when you are creating a data rule.)

You also have to specify what should happen to existing instances of the entity. (This option is not available when you are creating a data rule.)

  • Merge the data in the existing instances,
  • Clear and overwrite the data in the existing instances or
  • Do not clear the data in existing instances but create new instances.

Specify the criteria for selecting records. A criterium consists of a comparator and an expression (compared value). It’s possible to specify more than one criterium per column.

The goals are the goal entity’s attributes that will be mapped from the column’s values.

Give the service call or data rule a name and description.

When you are creating a data rule you can add a justification. (This option is not available when you are creating a service call.)

The combination of criteria and goals is shown as a select query.

Click Finish to save both the resource and the service call or data rule.

Only records that match all criteria will be selected in the data rule.


See also

How to use a data rule to derive attribute values