Saturday, May 19, 2007

Making decisions with Rule Flow and more wonderful screenshots :)

Kris has worked his magic again and it's now possible to make decisions on 'split' and 'join' nodes in Rule Flow. 'split' nodes now support 'and', 'or' and 'xor' type decisions while 'join' supports 'and' and 'or'. The beautiful part of this is its fully tooled and the decisions are specialised rules, so you can leverage the facts in the working memory and our powerful rule language.

The first screenshot (click to enlarge) shows the Constraint Editor on a 'split' node with an entry for each branch. At the bottom you will see the standard properties editor with the properties for the 'split' node, the node type is 'xor' and if you click the dotted builder icon on the constraints property it opens the Constraint Editor.

This screenshot (click to enlarge) shows the form used while editing the constraints for a particular branch. Note how you can use standard left hand side (LHS) language statements. We still have to get context assist and code highlighting into the editor, but that will be coming soon, I just have to persuade Kris to give up sleep this weekend :)

3 comments:

  1. Nice work. I see I'm not the only one who develops looping rule flows. I tried out the new spit functionality in the latest snapshot (20 May). I could only add a single line to the textual editor box in a split constraint editor. Is this a design decision? It would be nice if the final release allows multiple lines (i.e. columns) in a split constraint. I couldn't actually run any flows with an XOR or OR Split, even if I set the constraints to true for all outputs (always get: java.lang.IllegalArgumentException: XOR split could not find at least one valid outgoing connection for split Split). I assume this is just because it is not fully functional yet.

    ReplyDelete
  2. When a ruleflow-group is reached, if none of the conditions evaluate to true, then it throws that exception. Although I'm now wondering if we should, optionally, allow it to just wait until one of those constraints situations occur, or even allow a duration to be specified, heh or even an wait experation style LHS constraint. We'll double check next week that what you are reporting isn't a bug. You might want to wait for the milestone release, as at the moments it's very much a work in progress.

    ReplyDelete
  3. Mark, I figured out how to get the Spilt working. It was my fault, not a bug. However, it’s worth explaining as others might find the same subtle issue. As you said, the spilt adds some specialised rules to the package builder to evaluate the split constraints. This gets done quietly when you call addProcessFromFile to add your ruleflow .rfm file to the process builder. However, if you’ve already added your rule package to the rulebase before calling addProcessFromFile, then when you call rulebase.addProcess(..) to add the ruleflow process the specialised constraint rules never get added to the rulebase. Hence the split always gives the exception I mentioned in my last comment. The solution is to add the rule package to the rulebase after adding all processes (i.e. call ruleBase.addPackage after calling addProcessFromFile).

    ReplyDelete