IRD/Tutorials/Common cars

From FlexRule Wiki
Jump to: navigation, search

Introduction

In this tutorial, we want to find the common cars in two groups of Model and Make of cars.

Cars.png

We expect to see the list below:

  • Ford Pickup
  • Ford T
  • Ford Taurus
  • Hyundai Santa Fe

Input and Output

In an IRD we can define as many as inputs and outputs as required, then we connect different data sources to inputs and the network/graph of operators will navigate these to the output results.

In this example, we are going to have one input (list of cars) and two outputs (command and all unique cars).

Ird-1.png

Operator Nodes

There are many different data operators pre-built into IRD (i.e., Group, Filter, Select, Minus, Union, Intersect, etc.). These can be used as many times as required. All operators must be connected to a source of information.

In the first step of this task we need to separate the cars into two groups by “Group” value. So let’s select Group operator from toolbox and add it to our model:

Ird-2.png

Associations

There are two types of associations between any node in an IRD:

  1. Information
  2. Knowledge

These pass data/information to the next nodes either 'as is' or process them further before passing. As mentioned previously, all operator nodes, must have a source. If the source of a node comes from another node, it is an Information association. Otherwise it is a Knowledge association. Knowledge allows the result of a node (operator) to be passed to other nodes as known information. This will be shown in the next section.

Ird-3.png

Select

In an IRD you can have as many as operators that you need to navigate to the output nodes. In this example, the result of the group has two lists based on “Group” value. Let’s select ‘Make’ and ‘Model’ from each:

Ird-4.png

Select node requires a list of properties in order to select them. That is in the "Parameters" part of the properties window. Once you have added the select nodes, in the properties window you will see parameters:

Select-param-Collections.png

Then add the two following parameter values:

  1. Make
  2. Model

You will then have the result shown below:

Select-Parameters.png

Once you press the "OK" button, the properties window will be refreshed:

Select-param-Collections-added.png

You need to repeat this for both Select nodes.

Intersect

For common cars, we just need to find the commonalities in each selection, so we use the Intersect operator and connect each select node to that. This then becomes the answer to 'common cars'.

Ird-5.png

In Action

This is part of a more complete sample called "Collections" when you install FlexRule Designer. Once you open the Collections project, then open a document called Cars-IRD.xml. You can then use the prepared logic run template to feed sample data to the model and see it in action.

Once execution is finished, you will see the results below using data viewer:

Ird-results-cars.png

Next sections

In the next couple of articles we will cover different aspects of modelling and executing the IRD.

  1. Information Requirement Diagram
  2. Common cars tutorial