MAIN arrow Tutorials-5.1 arrow Beginning Intalio|BPMS 5.0/OpenLexicon Tutorial (Intermediate)

Beginning Intalio|BPMS 5.0/OpenLexicon Tutorial (Intermediate)

Print E-mail

 

In this tutorial, we explain how to use the Open Business Rules Management System with Intalio. The prerequisite files including the OpenLexicon WSDL, an export of the repository for import and a solution to the tutorial are included in this zip OpenLexicon Sample.

Prerequisite

You do not have to be completely familiar with Business Rules or OpenLexicon to complete this tutorial. To complete this tutorial you must download and install the latest version of the universal installer for OpenLexicon (http://www.openlexicon.org/).

This tutorial requires version 5.0.125 (or latter) of the Intalio designer and release 31 (or latter) of the server and the universal installer for OpenLexicon.

Scenario

In an employee on-boarding system, the company has established policies for the assignment of the proper computer to employees based on a number of conditions. For instance:

  • Engineers in Engineering are assigned an engineering work station
  • Sale personnel are always assigned a lap top
  • And so forth

This is a good candidate for a truth table approach. The truth table is presented here:

Position

Department

Field Tech

Assignment

Included

ENGINEER

ENGINEERING

 

ENGINEERING WORK STATION

x

FIELD TECH

FIELD SERVICES

LOCATOR

HAND HELD GPS

x

FIELD TECH

FIELD SERVICES

INSTALLER

HAND HELP

x

FIELD TECH

FIELD SERVICES

INSPECTOR

LAP TOP

x

ADMINISTRATIVE

*

 

WORK STATION

x

EXECUTIVE

ENGINEERING

 

ENGINEERING WORK STATION

x

SALES

*

 

LAP TOP

x

EXECUTIVE

HUMAN RESOURCES

 

WORK STATION

NOT!

The ‘Included' column defines the rules that are in the OpenLexicon project when you start this demonstration. At the end of this tutorial we will enter the logic in OpenLexicon and deploy it without changing the process or restarting any servers.

Obviously, you could put this data into an SQL table and develop queries with the JDBC connector. Yet, you can build many layers of logic into OpenLexicon.

We will develop a process that accepts an employee business object and invokes the business rules and returns the computer type.

In general OpenLexicon provides 3 basic capabilities:

  • Validation: Make certain the data provided is correct
  • Transformation: Assign the data to parameters according to the rules in the truth table
  • ‘Lexicon Process': complete a branching use case that performs a combination of these actions

In this simple scenario we are going to develop a process that can uses a transformation and assigns the type of computer according to the rules in the truth table.

The last scenario in the truth table was not implemented. We will use OpenLexicon to add this scenario and rerun the process. This will demonstrate the simplicity and agility of the Intalio/OpenLexicon solution.

Populate OpenLexicon Repository

The project entitled ‘CodeDemo' includes the metadata needed to run this tutorial on the universal installer. If you have not modified that project you only need to install the OpenLexicon software

If you need to import OpenLexicon Metadata, there is a metadata extract, IntalioTutorial.xml that includes the logic for the truth table. If you are using another database or wish to use this import method then do the following:

  1. Create a database user for project
  2. Start the OpenLexicon Server and the OpenLexicon Wizard. If you are in a windows environment you should have a program group for OpenLexicon (LexiconEnterprise) in your start menu. The program group has items for starting and stopping the server and launching the OpenLexicon wizard.
  3. Define the database
  4. Press the button ‘Populate Cache from Extract'. Complete these steps:

 

import.jpg

 

Server Environment

The LexiconService has many ways to operate. It can run business rules from a cache file, or a database. The source of the OpenLexicon metadata can be easily configured in an Intalio process or it can be located in external system variable. We are going to use the simplest: a database identified by environment variables. You will need two environment variables:

 

LEXICON_USE_FAKE: This is a variable that permits a test of the Lexicon Web Service without running any business rules. Set this to a value of N.

TORQUE_PATH: This is the directory that holds you torque properties file. A copy of the Torque.properties file is included in the project export. OpenLexicon uses the Torque Project for object-relational data mapping in Java. The project is described here. However, the only thing you need to know is that the torque properties file provides the connection to the database that is needed for this tutorial. You can place this in any directory and set the value of TORQUE_PATH to this directory (i.e. C:\Torque).

If you are in a windows environment enter these in the system setup, advanced, environment variables tab.

Put a copy of the Torque.properties into the directory defined in TORQUE_PATH. You do not need to change this unless you have a custom database environment.

Process

Create an Intalio project, name this project: LexiconTutorial. From the zip (or from the imported project) Copy the files Employee.xsd, and LexiconConnectorService.wsdl into the project. The .wsdl defines the web service for the OpenLexicon rules engine. We will explain how to use this in the data mapping section. The .xsd is a data type for the message flows. It corresponds to the schema that the rules engine will evaluate.

Go to File > New > Business Process Diagram and create a new file "Transform.bpm" in your project. In this tutorial, we will assume that the project is called LexiconTutorial.

You may rename the first pool that is created. Here we will call the pool "Input". The Task shape should be named "Interface". Set the pool as non-executable by hovering over the pool and right-clicking on the pool.

Create another pool name it Transform. Create the activities.

  1. Create a Message Start Event in the pool. You may rename it "Start".
  2. Create a new Task and rename it "Invoke".
  3. Create a new Task and rename it "Results".
  4. Create an End Message Event. You may rename it End.
  5. Create links between each task.
  6. Connect the "Input" task from the "Dummy" pool to the Start Message. And connect the End Message to the "Input" activity in the "Dummy" pool
  7. Introspect the Employee.xsd. Drag and Drop the tns:Employee onto the message from the Input to the start message. Accept the "Set schema Employee as content of the message".
  8. DND the tns:Employee to the message from the end message to the Input Activity. Accept the "Set schema Employee as content of the message".

Your diagram should look like this:

processstepone.jpg

Create another pool name it LexiconWebService. Set the pool as non executable. Add the call to the web service.

Introspect the WSDL LexiconConnectorService.wsdl. Introspect LexiconConnectorService, then LexiconConnectorServicePortSoap11port0

DND the LexOperation onto the LexiconWebService pool. Accept the first option from the menu as shown here:

porttype.jpg

Connect the Invoke Activity to the LexOperation and LexOperation to the Invoke Activity.

Your Process diagram should now look like:

processstep2.jpg

Data Mapping

We will now connect the message flows to the web service and return the results to the Input activity.

Create Process Variable

  1. Open the data editor introspect on declarations under the transform button
  2. Hover over the declarations, right click and select create variable.
  3. In the dialog call the variable EmpVar
  4. In the right column of the Data Editor, Introspect the Transform, then the Name Space openlexicon.org/Employee
  5. The Data Editor should look like:

dataeditorstep1.jpg

DND schema element tns:Employee onto the $EmpVar. This will resolve the issue. Your data editor should look like:

dataeditorstep2.jpg

Define Mappings

  1. In order to access the truth table in our OpenLexicon project you will need to assign values to the operation. LexOperation. If you introspect the LexiconWebService, you will see that there are seven arguments that setup the call the OpenLexicon rules engine. These arguments define what rule should be called and what source of metadata should be used. Here are the seven arguments to LexService (You might wish to look at the arguments in the datamapper for the activity ‘Invoke'):
    1. Action: Type of Source of Cache (not used here)
    2. ActionType = the type of operation that OpenLexicon will take with this data. The domain includes ‘VALIDATE', ‘TRANSFORM' and ‘PROCESS'.
    3. BusinessObjectType= the name of the Business Object in OpenLexicon. This is the same name as the Business Objects in the OpenLexicon Wizard.
    4. CACHE_SOURCE (not used here) is a string that contains either the path of the open lexicon cache for or the name of the database in a torque properties file.
    5. ErrorType= a string that holds errors from OpenLexicon, if any.
    6. POJOType=the business object with data for a type of action (ActionType) (The web service takes this as an any:type).
    7. RuleSetName: The name of the ruleset that is associated with the action. These are defined at the business object level in OpenLexicon.

The service has been designed to give you access to any ruleset defined in the OpenLexicon repository. We will now map the input to the web service and assign the constants necessary for the process to work properly.

  1. Mouse click the ‘Invoke' Activity in the Transform Pool and activate the data mapper.
  2. Introspect the $xsdLexOperationRequestMsg.part1 on the right side of the data mapper.
  3. Perform Data Mapping:
    1. Place 6 operations onto the Mapper canvass associated with the Invoke Activity (use the "" values for now).
    2. Connect the constants to Action, ActionType, BusinessObjectType,CACHE_SOURCE,ErrorType and RuleSetName.
    3. Doubleclick the constants and set:
      1. ActionType = "TRANSFORM"
      2. BusinessObjectType='Employee'
      3. RuleSetName = "ComputerTypeTable"
    4. Connect $thisStartRequestMsg to the POJOType
    5. Your data mapper should now look like this (rearranged for readability):

datamapperstepone.jpg

Connect the output of the web service to the Variable. In the process diagram, select the results activity to open the data mapper for that activity. In the data mapper connect the $xsd1LexOperationResponseMsg.part1 POJOType to $EmpVar as follows

datamappersteptwo.jpg

Mouse click the ‘End' message. In the output message connect the $thisStartRequestMsg.body to $thisStartReMsg.body, then connect $EmpVar ComputerType to the computer type in the response message. It should look like:

datamapperstepthree.jpg

Deploy and Test

We are now ready to deploy and test this process. Select the deployment button and select only these files from the dialog:

deploy.jpg

 

If all is well, you should be ready to enter examples from the truth table.

Testing

Note: the OpenLexicon and Intalio server must be running for this test to work. If you are in a windows environment you should have a program group for OpenLexicon (LexiconEnterprise) in your start menu.

The program group has items for starting and stopping the server and launching the OpenLexicon wizard.

From the Intalio|Server console, start an instance of Transform: Enter values from the truth table at the beginning of this tutorial,

For instance the input:

testone.jpg

Should result in the value of ENGINEERING_WORK_STATION.

If you test the process with the values Position= ‘EXECUTIVE', Department= ‘HUMAN RESOURCES' you will return no result.

You can add this rule by simply editing the rule ‘IsWorkStation'. Start the OpenLexicon wizard. The installer for OpenLexicon places a program group in your menu. Select the wizard program and it will start the wizard in your browser.

Select the project ‘CodeDemo' and click on the Tab Business Rules. Scroll down to the ‘Predicate' isWorkStartion and click the Edit Button and shown here:

ruleedit1.jpg

 

By either typing or using the expression palette, add the expression or [isExecutive() and isHumanResources()] as shown here:

 

ruleedit2.jpg

 

 

Please be certain to press the SAVE button to add the business rule to the truth table. Actually, we are manipulating a function in the truth table, so we do not need to do anything to the rule set associated with the business object.

 

Rerun an instance of the process with the values of EXECUTIVE and HUMAN RESOURCES in position and Department

 

note that there is no need to restart the Intalio Server when you do this. This change is a good demonstration of the power of externalizing rules.

Last Updated ( Jun 15 2007 )
  < Prev