Wednesday, July 18, 2007

Rule Vendors - Product Derby

Once a year, during the business rules symposium, vendors of rule engines can show how they implement a general use case that contains many business rules. This use case is known as the UServ Product Derby. You can read the specifications here.

A few years ago I was actively involved with the implementation using Aion (from CA). Last year I put together the web front-end for Corticon. And recently I've been examining the implementation from Microsoft with WF rules.

Microsoft's example (download here) illustrates the technical feasibility of using WF rules. Although this example shows that it's technical possible, it does not highlight the business rules management, rule audit trail and rule traceability.

For me it was a nice opportunity to see if the Rule Manager from Acumen Business could visualize the rules and perform rule verification on the policy to discover if the actual implementation was logically correct.

We start this blog series with a closer look at the 'Driver's Eligibility' policy as defined in the use case. After a few adjustments on the Rule Manager, I produced this report (PDF, XPS) from Microsoft's example implementation.

The part that got my attention right away was the discovered contradiction. On first look, the rule DA_7 is rather complicated. It is a typical programmer's construction to use a not (expr and expr)
Such a statement has probably a few nanoseconds advantage on your processor. However do we really want the business user to decipher this statement by applying De Morgan's law?

Just keep it simple stupid. Where possible, avoid negated nested expressions and split or-statements in multiple rules.

You might wonder if we found an error with the rules example? The example should work fine, however the example uses rule priorities to ensure that rule DA_7 (priority -1) , is executed after DA_8 (priority 0). The problem that I have with rule priorities is that you throw away the declarative features of a rule engine. Suddenly the rule writer has to be aware of priority values in order to achieve the desired result.

Also note that DA_7 does not halt the rules engine. In a case where we have a male driver of 71 years old, the rules engine first assign 'Senior' to the Driver class, and consecutively overwrites this value with 'Typical Driver'. Now we also have to make sure that rule 'DA_3' must be executed after DA_7 and DA_8. If DA_3 would fire before, we make the incorrect conclusion that a 71 year old senior is eligible without checking his training certificate.

A second problem related to the priority and overwriting conclusions is that a rule audit report would show incorrect results. So please use rule priorities careful. We will show below that the Driver Eligibility policy actually don't require priorities.

Finally, the generated rule graph shows two disjoint rule networks. We have to wonder what happened with the rules that determine the 'Training Certification'. Also how is the DUI related to the Training Certificate? It seems that the example is not a complete implementation of the specification. Visualizing a rule policy in a complete rule graph does make the business rules code review an easy task.

Again, Microsoft example was only illustrating the technical aspects of WF rules. And the example shows how you can achieve First Order Logic with WF rules. (For All Drivers do...)
I changed the Driver Eligibilty policy to remove the contradiction and remove the priorities to keep the rules 100% declarative. We let the rules engine decide which rule should be executed next. Here is a produced report of my rewrite (PDF, XPS).

There are no disjoint rule graphs, no self contradictions within the rules, and no rule anomalies among rules. We do discover some incompleteness. E.g. is a Female of 24 years old eligible?
This incompleteness can be a misinterpretation of the use case specification, or an actual incompleteness in the specification. But with this rule report it's very easy to get these issues clarified.

Wednesday, July 04, 2007

WebCast on Advanced Scenarios of WFRules

Kavita (Microsoft) will give a presentation this Friday (7/6/2007) about some advanced scenarios using rules with Windows Workflow Foundation.

During this presentation you will see screenshots of Acumen Business Rule Manager as an example of an advanced Business Rules solution!

The Rule Manager provides the additional functionality of Rule Authoring, Rule Repository Rule Verification & Validation. Only by empowering the business users with a complete business rules tool set, you will achieve a truly agile business policy that becomes transparent within your organization.

Here are the details of the Live Webcast:

Event Name: Webcast: Introduction to Windows Workflow Foundation Rules - Part II

Start Date: 7/6/07
Start Time: 1:30 PM (GMT-05:00) Eastern Time (US & Canada)
End Time: 3:00 PM (GMT-05:00) Eastern Time (US & Canada)
Audio conferencing: +1 (866) 500-6738
Participant code: 7545634
Presenter code: 9070863

Click on this link for more information regarding this Webcast

Thursday, June 28, 2007

A Test suite for business rules

I mentioned in a previous posts that the rule validation in the interactive rule map (cause-effect graph between terms and rules) is part one of the rule validation.

In the image on the right (click to zoom) you see the second part that is currently being developed. Test cases that are created in the interactive rule map can be saved to a test suite. A test suite (a collection of test cases for business rules) can be executed in a batch process.

For every test record we compare the user defined expected value with the rules engine computed value. Any discrepancies are flagged with a red info, and the test record would be marked red to indicate a failure. Green test records have all computed values equal to the business users defined expected values.

In the output terms you have to indicate which term you want to set as a goal for the rules engine. One test suite can process multiple goals. But every test record can only have one goal defined.

Similar to the meta information on a business rule, a test record contains the meta information of who the author is, when it was created, a description field etc.

You can imagine that among business users a difference of opinion might exists what the expected outcome value must be for a particular situation. We can not say what is right or wrong withing a rule policy, but we can show there is a difference.

Finally, the test suite can be used perfectly for regression testing your rule policy and can give a good impact analysis what happens when you modify your rule policy.
Posted by Picasa

Monday, June 11, 2007

Microsoft XPS format

During a web demonstration of the Rule Manager I had to go for a full OS reboot. Not very pretty for a product demonstration. What happened? Not really sure, but it seems that the latest version of Adobe Acrobat (8.1.0) started to lock the generated Rule PDF report.

Few days later I started to get the forced updates from Adobe. Considering I have many VM installations to test all different platforms and configurations, you can imagine I'm not too happy with these forced downloads.

Finally the free PDF viewer started to contain advertisement to FedEx. These 'convenient' link buttons are always a big annoyance to me.

It was time to provide an alternative to the PDF format. The latest release of the Rule Manager (1.5.0.17) supports now the Microsoft XPS as an alternative.

The good part of this is that an XPS viewer comes pre-installed on Microsoft Vista. I'm not really sure if it is part of .NET 3.0 framework, but on my XP SP2 box I could use the XPS viewer as well.

Currently the Adobe PDF format is still the default report format, but you can easily change that (and we will store your preferences in your user settings)

The main shortcoming I currently see with the XPS viewer is that you can not rotate a page.

Here are the results:
XPS: http://www.acumenbusiness.com/portals/Loan%20Mortgage%20Approval.xps
PDF: http://www.acumenbusiness.com/portals/Loan%20Mortgage%20Approval.pdf

Monday, June 04, 2007

Rule Manager 1.5.0.x is released

The new Rule Manager (1.5.0.x) is released! There are many new features and enhancements. Here are some of the highlights:
  • Rule Validation; in the interactive rule map you can let the rules engine resolve any term.
    This starts an animated goal seeking process. The default waiting time is 0.5 sec. You can change this in the debug options.
  • Panning and zooming of the interactive rule map.
  • Creation of business rules and business terms are completely accessible during the trial period.
  • Export your rule policy to Windows Workflow Foundation, and you see the rules executing on top of Microsoft's Forward chaining rules engine. By default the rule tracing is on. You can see the rule execution in the output console of Visual Studio.
Existing users can follow the internal update wizard (except that you need the .NET Framework 3.0)

New users can start the installation wizard that is available here.

Saturday, May 26, 2007

Suppress “A first chance exception of type…” Messages in VS 2005

When writing an API framework, it's good practice to throw appropriate framework exceptions. I have several extended application exceptions in my rule engine framework. When executing all unit tests, or just stepping through the development code, I would see hundred of messages in Visual Studio of 'A first chance exception of type' ...
This is just perfect behavior from my development point of view. I'm throwing these exceptions myself from the framework. I've made several attempts to find how to disable these messages. And finally I found the answer on Peter Macej blog:

How To Disable “A first chance exception of type…” Messages in VS 2005
So how do we suppress the messages? You most likely see these messages in
Immediate Window because you have set Redirect all Output Window text to the
Immediate Window in Tools - Options… - Debugging - General. That’s why when you
right-click in Immediate Window, you cannot see any option to disable messages.
It’s Output Window text and thus you need to set it in the Output Window. So
open Output Window, right-click and uncheck Exception Messages from context
menu. Simple but it took me one hour to find it.


It was just a simple context menu option on the Output window: Uncheck the 'Exception Messages'.

I was always trying to do this somewhere in the Debug \ Exceptions form. Well I'm glad I found it. It makes the Output windows trace less convoluted with irrelevant messages.

Thursday, May 17, 2007

WebCast about Windows Workflow Foundation Rules

Tomorrow, there is a free webcast by Kavita Kamani (Microsoft) about using the rules engine that is part of Windows Workflow Foundation. You can register for this event here.

Microsoft's rules engine is a bare bones forward-chaining rules engine. The rule engine can also be invoked without using the workflow engine. When you export a business rule policy from the Rule Manager, it will generate a C# solution that illustrates how rules are invoked without the workflow engine.

Start Date: 5/18/07
Start Time: 2:00 PM (GMT-05:00) Eastern Time (US & Canada)
End Time: 3:30 PM (GMT-05:00) Eastern Time (US & Canada)

Friday, March 30, 2007

Rule Validation Video

The Rule Manager will soon be enhanced with a new feature that allows the Interactive Rule Map as a Rule Debugger. See a video here: Rule Validation Video. It almost became an action movie :).

This is part one of providing Rule Validation (that is: testing your rules) with the Rule Manager.


Color legend for Rule:
  • Green: Rule fired
  • Red: Rule failed
  • Orange: Rule is pending

Color legend for Term:

  • Green: Term is assigned
  • Orange: Term is unknown

How it works? We use the backward chaining algorithm to resolve a goal. The user can select any business term as a goal.

  • When the user clicks resolve, the inference engine will try to resolve this goal by executing the rules.
  • When a term is encountered that can not be derived from other rules, an ask dialog will be shown to the user. The user value will be stored into an internal table, so consecutive runs will first use this table before asking the user. Internally the rule manager supports defining restrictions on business terms. This allows the inference engine to show input options when asking a value for a term.

About the user data value table:

  • The table can be cleared by clicking on 'Reset All Values' from the context menu.
  • You can change the value of one particular term by selecting the 'Reset Term' on the Term context menu.
  • Note: also business terms that are inferred by the inference engine can be overwritten by the user. Be careful with this because this would skip the backward-chaining of this rule branch.

Saturday, March 24, 2007

13 years ago

Found my old research paper from 1994 "An object-oriented approach to knowledge representation in a biomedical domain". Looked like they scanned the contents of the original paper.

It's pretty outdated. Note that this was before the existence of Java or C#, but there was good old Smalltalk.

One thing is still relevant. The construction of a hybrid knowledge based system. Translated to 2007; the semantic web 3.0. Defining a clear terminological component (vocabulary) in order to make assertions from basic facts.

Wednesday, March 14, 2007

Importing Biztalk rules and export to Windows Workflow Foundation

The new Rule Manager (version 1.4.0.50) is released!



With just a few mouse clicks, the Rule Manager from Acumen Business imports a BizTalk rule policy and export the rules to the Windows Workflow Foundation format.



The export generates a complete Visual studio solutions. This includes the .rules file, the Business Object model and the code that calls Windows Worklow Engine.




And voila, here is the results of a CarDiagnosis example with the recommendation that I have to get 'Fuel'

It's just a console output, but you hopefully get the idea. It's an executable solution that can be incorporated into the IT infrastructure.

I don't think we can make it any easier.

What you need:

  • Microsoft BizTalk 2006
  • .NET 3.0 (this includes Windows Workflow Foundation)
  • Acumen's Rule Manager with the BizTalk and Windows Workflow Foundation adapters

What you get:

  • Your BizTalk rule policy converted to Windows Workflow Foundation. The best part is that the Windows Workflow Foundation is free and is included in the .NET 3.0 framework.

Tuesday, March 13, 2007

Business Rules for the Windows Workflow Foundation

If you like to see the latest version of the RuleManager with support for Microsoft Windows Workflow Foundation, you can request to see the product in action at the Business Rules Forum. Fill in the form here.



The image shows the imported DiscountRuleSet from the Microsoft Windows Worklow Foundation advanced policy example.

xdg-open; vscode acts as default application for html

Opening html files stopped launching the browser, but launched the vscode application. > xdg-mime query default text/html code-url-h...