| Getting Started |
|
|
|
|
OpenOpenLexicon is a Business Rules Management Application and Business Rules Engine released as a single download. OpenLexicon allows you to define metadata attributes, then combine them into Business Objects. It also allows you to define Business Rules that either validate or transform your data. OpenLexicon also provides a form of process control that can closely interact with the database natively – OpenLexicon is one of the few Open Source rules engines to be immediately compatible with your Oracle or MySQL database without requiring any authorship of customized code. OpenLexicon is composed of two main components: OpenLexicon Wizard, which provides a Graphical User Interface where users create, edit, and maintain their metadata, and the OpenLexicon Rules Engine, which processes metadata against business data. Another important part of OpenLexicon in the LexiconService WSDL connector. The quickest way to learn how to use this is to download and take the Intalio Tutorial. This Quick Start Tutorial will show you some of the basic features of OpenLexicon to help you evaluate the tool against your needs and get you started using OpenLexicon as quickly as possible. More advanced features are demonstrated in the full-length tutorial, which is available as a download and comes complete with reference data scripts, input file XML descriptors, and input data files. Quick Start OverviewThis Quick Start will guide you through the process of creating several data attributes, combining them into a business object, developing some simple business rules, and combining those rules into a single rules list to execute against test data. The goal of the Quick Start is to assign default values to several data attributes, perform a simple calculation, and then perform a conditional assignment to indicate whether one data attribute is greater than the other. If you install the universal installer, you can use the empty project to try this simple usecase. The installer is fast and easy to install and only needs a Java RTE to work. If you wish to continue on to the detailed tutorial, this metadata will not prevent you from compeleting it. Before StartingThe first thing to do is make sure you have your OpenLexicon environment setup properly. The OpenLexicon installer will quickly install the entire application, including a project database to enter this metadata. However you may want to create your own environment. You will need to have created your metadata schema, and setup a web server with a deployed OpenOpenLexicon WAR file. You will also need to create property files for a OpenLexicon project and database. Please note that OpennLexicon has been extensively tested on the Tomcat server; however, not every server is supported. Directions for doing this can be found in the primary OpenLexicon tutorial if you encounter difficulty. At this point it will be assumed that you have a working and empty project area and have successfully tested your database connection from the Wizard. If you need further assistance and the primary OpenLexicon tutorial does not address your needs, please email us at This email address is being protected from spam bots, you need Javascript enabled to view it and we will help you as quickly as possible. Defining Data AttributesWe will need to define four data attributes for this tutorial. Parameters are created by clicking on the “Parameters” tab on the Navigation bar towards the top of the screen, then on the “Create Parameter” tab on the Action bar on the left hand side of the screen. Each parameter needs at minimum a name, prompt, description, and data type attribute, which is all we need for this tutorial. Save each parameter once you’ve entered the specified data. Parameter 1 Name: numericValue1 Prompt/Description: A numeric value, which will be used in a simple mathematical calculation. Data Type: Integer Parameter 2 Name: numericValue2 Prompt/Description: A numeric value, which will be used in a simple mathematical calculation. Data Type: Integer Parameter 3 Name: numericValue3 Prompt/Description: A numeric value, which will be assigned the result of the simple mathematical calculation numericValue1 * numericValue2 Data Type: Integer Parameter 4 Name: comparisonResult Prompt/Description: A String value which will be assigned the results of a comparison between numericValue1 and numericValue2 Data Type: String You should now have four parameters. Creating a Business ObjectNow that our parameters have been created, it is time to combine them into a single business object. To create a new business object, click on the “Business Objects” tab in the Navigation bar, then “Create Business Object” in the Action bar. Name: QuickStart_Object Prompt: A simple business object used for the Quick Start tutorial Description: This business object contains all four parameters created for the OpenLexicon Quick Start tutorial. Parameters: In the Parameters section, click on the “All < <” button to add all available parameters to the business object. Save your business object – now it’s time to move on to Business Rules! Business RulesBefore we start defining business rules, it is helpful to have a good idea of what we want to do. Business Rules need to accomplish specific goals, and if you just go into the Wizard and start creating business rules on the fly, you’ll do ok, but you’ll do much better if you organize things ahead of time. For this tutorial we want to do the following: 1. Assign a default value of 100 to numericValue1 2. Assign a default value of 5 to numericValue2 3. Multiply numericValue1 and numericValue2 together and assign the product to numericValue3 4. If numericValue1 is greater than numericValue2, assign “Number 1 is greater than Number2” to the comparisonResult parameter 5. If numericValue1 is less than or equal to numericValue2, assign “Number 1 is less than or equal to Number 2” to the comparisonResult parameter One thing that needs to be mentioned here is that OpenLexicon has separated validation business rules from transformation, or assignment, business rules. There are a lot of reasons for this, and they are mentioned in the primary tutorial, but what that means to us right now is that we need to keep in mind what we need each rule for. Start the creation of each business rule by clicking on the “businessRules” tab in the Navigation bar, which is towards the top of the screen, then clicking on the “Create Business Rules” tab in the Action bar, which is on the left-hand side of the screen. The create business rules screen is divided into two columns – the left is for validation rules, and the right is for transformation rules. For each rule being created, the rule type and validation or transformation purpose is specified. Business rules need a the minimum to have a name, prompt, description, and data type defined. The prompt is a brief description of the rule, whereas the description field permits a much longer explanation about the rule’s purpose. The QuickStart will suggest a name – you can enter some minimal text for the prompt and description. Assigning a default value to numericValue1 This will be a transformation rule that assigns the value 100 to the numericValue1 parameter. OpenLexicon has a rule type that assigns a constant value to a parameter, which is exactly what we need. Rule Type: Constant Values (Transformation) Rule Name: AssignDefaultValue1 Prompt: Assigns 100 to the numericValue1 parameter Description: Assigns the value 100 to the numericValue1 parameter Error message: Error assigning 100 to numericValue1 Parameters: In the “Available” column, locate and click on “numericValue1”, then click on the “< <” button to make it the target of the assignment for this business rule. Value: 100 Assigning a default value to numericValue2 This is another transformation rule that assigns a constant value to a parameter. It’s very similar to the rule we just implemented, but the constant value being assigned and the parameter it is being assigned to are different. Rule Type: Constant Values (Transformation) Rule Name: AssignDefaultValue2 Prompt: Assigns 5 to the numericValue2 parameter Description: Assigns the value 5 to the numericValue2 parameter Error message: Error assigning 5 to numericValue2 Parameters: In the “Available” column, locate and click on “numericValue2”, then click on the “< <” button to make it the target of the assignment or this business rule. Value: 5 Computing the product of numericValue1 and numericValue2 Performing simple mathematical operations is something that is simple in concept, but can be cumbersome to implement as a rule type – do you need to create a Multiplication rule, a Math-based rule, or what? We’ve implemented a rule type in OpenLexicon that allows you to write a custom line of Java code and use that as your business rule, which is very handy if you want to perform a mathematical calculation, manipulate some String data, or get the current date and time from the system. These are called OpenLexicon Expressions, and we’re going to use one to multiply numericValue1 and numericValue2 together. Rule Type: OpenLexicon Expression (transformation) Rule Name: ComputeValue3 Prompt: Computes the product of numericValue1 and numericValue2 Description: Computes the product of numericValue1 and numericValue2 and assigns the result to numericValue3 Error message: Error computing the product of numericValue1 and numericValue2 OpenLexicon Expression: “$numericValue1$ * $numericValue2$” (without the quotes) Conditional Assignment if numericValue1 > numericValue2 There’s more than one step needed to implement this logic. We need the following business rules: * A validation rule that returns true if numericValue1 is greater than numericValue2 * A Boolean Expression rule that evaluates that validation rule and conditionally calls: * A transformation rule to assign “Number 1 is greater than Number2” to the comparisonResult parameter Rule Type: OpenLexicon Expression (Validation) Rule Name: isValue1GreaterThanValue2 Prompt: Determines if numericValue1 is greater than numericValue2 Description: Determines if numericValue1 is greater than numericValue2 Error message: Unable to determine if numericValue1 greater than numericValue2 OpenLexicon Expression: $numericValue1$ >$numericValue2$ Note: If you are testing the business rules as you go along, and use a value for numericValue1 that is less than or equal to numericValue2, the test will indicate the rule did not pass validation. Try again with a value for numericValue1 that is greater than numericValue2 – the rule should pass validation this time. Rule Type: Validate Boolean Expression Rule Name: Value1_GT_Value2_Exp Prompt: Conditional statement to determine if numericValue1 is greater than numericValue2 Description: Conditional statement to determine if numericValue1 is greater than numericValue2 Error message: Error evaluating Boolean expression Boolean Expression: In the Function Palette, locate and click on isValue1GreaterThanValue2, then click on the “Add selected functions” button. The complete Boolean Expression is “isValue1GreaterThanValue2()” (without quotes). Rule Type: Constant Values (Transformation) Rule Name: assignVal1_Greater Prompt: Assigns a String indicating numericValue1 is greater than numericValue2 to comparisonResult Description: Assigns a String indicating numericValue1 is greater than numericValue2 to comparisonResult Error message: Unable to assign value to comparisonResult Parameters: In the “Available” column, locate and click on “comparisonResult”, then click on the “< <” button to make it the target of the assignment for this business rule. Value: Number 1 is greater than Number2 Rule Type: Transform Boolean Expression Rule Name: Value1_GT_Value2_Exp Note: This rule is different from the others that have been created so far. We’re going to start with the Validate Boolean Expression rule Value1_GT_Value2_Exp, and then associate the assignVal1_Greater Transformation rule with the Boolean Expression to make it a conditional transformation.. That means when Value1_GT_Value2_Exp returns True, assignVal1_Greater will be executed. If Value1_GT_Value2_Exp returns False, nothing will happen at all. First, in the Boolean Expressions palette, locate and click on the Value1_GT_Value2_Exp Boolean Expression, then click on the “Use selected expression” button. Next, in the Transformations palette, locate and click on the assignVal1_Greater rule, and click on the “Add selected transformations” button. The Boolean Expression field towards the top of the screen should contain “Value1_GT_Value2_Exp”, and the Transformations are directly underneath should contain “assignVal1_Greater”. If so, save your rule and we’ll move on to the next conditional assignment. Conditional Assignment if numericValue1 <= numericValue2 This rule is the opposite of the first conditional assignment. We can use the same validation rule to compare numericValue1 and numericValue2, but will need the following additional business rules: * A Boolean Expression to evaluate the inverse of the mentioned validation rule, which conditionally calls: * A transformation rule to assign “Number 1 is less than or equal to Number 2” to the comparisonResult parameter Rule Type: Validate Boolean Expression Rule Name: Value1_LTE_Value2_Exp Prompt: Conditional statement to determine if numericValue1 is less than or equal to numericValue2 Description: Conditional statement to determine if numericValue1 is less than or equal to numericValue2 Error message: Error evaluating Boolean expression Boolean Expression: In the Syntax palette, click on the “not” button. Then in the Function Palette, locate and click on isValue1GreaterThanValue2, then click on the “Add selected functions” button. The complete Boolean Expression is “not isValue1GreaterThanValue2()” (without quotes). Rule Type: Constant Values (Transformation) Rule Name: assignVal2_Greater Prompt: Assigns a String indicating numericValue2 is greater than or equal to numericValue1 to comparisonResult Description: Assigns a String indicating numericValue2 is greater than or equal to numericValue1 to comparisonResult Error message: Unable to assign value to comparisonResult Parameters: In the “Available” column, locate and click on “comparisonResult”, then click on the “< <” button to make it the target of the assignment for this business rule. Value: Number 2 is greater than or equal to Number1 Rule Type: Transform Boolean Expression Rule Name: Value1_LTE_Value2_Exp Boolean Expression: Value1_LTE_Value2_Exp Transformations: assignVal2_Greater Great! Our business rules are complete. You should have seven transformation rules and three validation rules. Each business rule can be tested separately – this is a very good idea, because it can identify issues with your business rules before you try to run them from the rules engine. Rules Lists Now that we’ve created the business rules we need to manipulate our data, we need to link the individual rules together in an ordered list so that they execute properly. Values need to be assigned to some parameters before other business rules can use those values to perform their computations and assignments. This is done by using a rules list. Rules lists, like parameters, are separated by purpose – validation or transformation. Other facts about rules lists: * They are associated with a business object * They can be named * Many rules lists can be built and associated with each business object * They can be as long or as short as necessary One way to think of a rules list is that each list accomplishes a goal. The goal might involve multiple steps, and may accomplish more than one task. For example, you might want a transformation list for “process data” that retrieves reference data from the database, calls several different processing business rules, and assigns a status to the data based on whether it is valid or invalid. The level of organization is entirely up to you. This Quick Start Tutorial requires a single transformation list. Recall earlier the steps we had determined we wanted which drove our business rule development: 1. Assign a default value of 100 to numericValue1 2. Assign a default value of 5 to numericValue2 3. Multiply numericValue1 and numericValue2 together and assign the product to numericValue3 4. If numericValue1 is greater than numericValue2, assign “Number 1 is greater than Number2” to the comparisonResult parameter 5. If numericValue1 is less than or equal to numericValue2, assign “Number 1 is less than or equal to Number 2” to the comparisonResult parameter Now it is time to create a rules list to do exactly that. Follow these steps to create your rules list: First, go to the Business Rules tab. Next, click on the “Rules” button for the QuickStart_Object business object. At the top of the screen is a text box labeled “Create new alias” – in that text box type “Perform Quick Start”, and click on the “Create” button directly to the right of the text box. This creates a new rules list alias. You can create many rules lists for each business object – it is wise to name them so that you know their purpose. Also remember that rules lists only contain one type of rule – transformation or validation. Scroll down towards the bottom of the screen, and you should see a box labeled “Available Transformation Rules”. This is where we will be working to define our rules list. Click on the “AssignDefaultValue1” rule, then click on the “Add selected transformations” button. The rule will be added to the list. Repeat for “AssignDefaultValue2”, then “ComputeValue3”, “Value1_GT_Value2_Exp”, and finally “Value1_LTE_Value2_Exp”. Rules lists are ordered, so it is important that the rules to assign default values to numericValue1 and numericValue2 execute first, before the computation of numericValue3 or the Boolean Expressions execute. Save your work and you’re done defining metadata! Now you can test your business rule ny navigating to the Business Objects and pressing the 'Test' key. When the test page comes up select the "Perform Quick Start" from the pull down list and enter values to test some use cases. If your have problems with the rule set. Go back to the predicates and functions and test them to verify proper execution. |
OpenLexicon.org | Home