IRD/Tutorials/Common cars

From FlexRule Wiki
Jump to: navigation, search

Introduction

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

Cars.png

We expect to receive the bellow list:

  • 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 navigate them 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… They can be used as many as required. All operators must be connected to a source of information.

For the first step of this task we need to group the cars into two 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.

Which they pass data/information to the next nodes either as it is or further process them before passing. As mentioned, 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) is passed to other nodes as an known information which you will see in the next section.

Ird-3.png

Select

In 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 list based on “Group” value. Let’s select ‘Make’ and ‘Model’ from each:

Ird-4.png

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

Select-param-Collections.png

Then add two following parameters value:

  1. Make
  2. Model

And you will have the below:

Select-Parameters.png

Once you press "OK" button. The properties window will be refreshed:

Select-param-Collections-added.png

You need to repeat this for both Select nodes.

Intersect

Now for common cars, we just need to find the commonalities each each select, so we use Intersect operator and connect each select node to that, which them 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 model and see it in action.

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

Ird-results-cars.png

Next sections

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

  1. Information Requirement Diagram
  2. Common cars tutorial