[rules-users] RuleFlow group as default or MAIN?

Kris Verlaenen kris.verlaenen at cs.kuleuven.be
Thu Aug 9 10:28:11 EDT 2007


A ruleflow actually just presents a set of rules that you want to evaluate (and you use a ruleflow to specify the order).  You can define yourself when to execute those rules by invoking startProcess whenever necessary.  It is possible to have multiple (possibly unrelated) ruleflows in one rulebase, you might start the same ruleflow multiple times or even concurrent (although we still have to look for good examples for those advanced use cases ;)).

If you would like to "hide" the use of ruleflow-groups for your rule editors / programmers, there are a few things you can do:

 - If you don't like calling startProcess using code, you can just use rules that define when a ruleflow should be started.  For example, if you want your ruleflow to start after calling fireAllRules(), add the following rule:
    rule "MyRule"
        when
        then
            drools.getWorkingMemory().startProcess("com.sample.ruleflow");
    end
You can easily add more conditions in the when part if you like to only start the ruleflow under certain circumstances

 - It appears you would like to specify some kind of default ruleflow-group for a package of rules, so that all rules in that package are automatically added to that ruleflow-group (and rule editors don't have to specify it with every rule they write).  I guess we could support something like this

    package com.sample;

    ruleflow-group "my_group"

    rule "my_rule"  # this rule automatically uses ruleflow-group "my_group"
        when ...
    end


    rule "my_second_rule" ruleflow-group "my_second_group" # this rule overrides the default ruleflow-group
        when ...
    end

If this is something you would like to see in a future release, please open a JIRA (http://jira.jboss.com/jira/browse/JBRULES) and we'll see what we can do.

 - You can still combine normal rules (without ruleflow-group) with ruleflows.  Rules that have no ruleflow-group still behave like they used to do, so they will be executed when fireAllRules() is called.

Kris

----- Original Message ----- 
From: Felipe Piccolini 
To: Rules Users List 
Sent: Wednesday, August 08, 2007 6:56 PM
Subject: Re: [rules-users] RuleFlow group as default or MAIN?


Well.... I guess I got it wrong... startProcess is not about what ruleflow-group start the process, is about what ruleflow definition
start firing all rules... but this leads me to the point that this is useful if you have several ruleflows (definitions and files) in the same
ruleBase... why somebody would like to have that?... to control flow? or to try to fire a specific rule and then fire subsequent rules
in a flow?...


My problem is that I dont wanna have many ruleflows definitions for 1 ruleBase, if I would, then I'll use sub-flows...
If I have just 1 ruleflow file, then I dont wanna do startProcess() and I still wanna put rules without ruleflow-group defined so they all
belong to the MAIN/DEFAULT group.


Thanks.


On 08-08-2007, at 12:33, Felipe Piccolini wrote:


Is there anyway to set a default ruleflow-group or a MAIN one so I can put rules without
ruleflow-group in the same drl as those with ruleflow-group defined and use a .rf where I define
a flow in the way that all rules without ruleflow-group (MAIN/DEFAULT) are fired and then a
specific ruleflow-group?


In this way could be not necessary to use session.startProcess("my_ruleflowgroup") in java, just
call fireAllRules() and design the process creating a RuleFlowGroup called/id as "MAIN".


Actually I can do this programatic, but I'm forced to put ruleflow-group in every rule... if I dont wanna to
group some rules in a specific ruleflow-group I have to call them as ruleflow-group "MAIN"... and I dont
wanna the business people to worry about flows when they write rules if they dont need to...


Thanks.
                                                                        
Felipe Piccolini M.
felipe.piccolini at bluesoft.cl








_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


                                                                        
Felipe Piccolini M.
felipe.piccolini at bluesoft.cl











_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070809/0391de7f/attachment.html 


More information about the rules-users mailing list