Problem while using RuleFlow Groups in drools
                                
                                
                                
                                    
                                        by Harsh Jetly
                                    
                                
                                
                                        
Hi ,
The version of Drools that I have used is 4.0.4
I have used ruleflow groups to create my rule file.
It has a split node (XOR) in which I specify a constraint on which a
ruleflow-group is to be selected .
Insert arraylists as facts in the working memory one by one.
The problem I face is that when I insert these arraylists in the same
session , it doesn't evaluate every constraint in the split node .
The work around I am using , it that I create a new session for every
arraylist , this works just fine . But creating a new session always is an
overhead .
Can you please assist me with this situation .
Thank You
Harsh Jetly 
-- 
View this message in context: http://www.nabble.com/Problem-while-using-RuleFlow-Groups-in-drools-tp188...
Sent from the drools - dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                17 years, 3 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Rule Parameters/Aliases
                                
                                
                                
                                    
                                        by Yoni Mazar
                                    
                                
                                
                                        
Hi all, 
We are at the begining of a new clinical decision-support project. 
We plan using drools (using Eclipse) in order to manage and execute our
business logic. 
As part of our research, we also evaluated JRules which has a feature that
is very important to us and we could not find in Drools. 
Unless we missed it out, we will probably try and add this functionality
ourselves.
In JRules, one can define a ruleset (corresponds to a package) with
parameters. Each parameter has a datatype (a class), a direction
(in/out/inout), and an alias. 
Then, within the rules, the user can refer to the parameter alias. For
example, a user can define a ruleset with the following parameters: 
*class=LabResult, direction=in, alias=hemoglobin 
*class=LabResult, direction=in, alias=creatinin 
Then, within a rule, one can write: 
when hemoglobin.value<10 and creatinin.value>34 
then... 
Now, the application retrieves the patient data accordingly (hemoglobin and 
creatinine data separetly - even though they are of the same type) and sets
the ruleset parameters: 
ruleset.parameters.add("hemoglobin",hemoglobinFact) 
ruleset.parameters.add("creatinin",creatininFact) 
It is important that the definition of the aliases will be done outside of
the rule (and not by defining in-rule variables)
This approach simplifies the rules since some of the filtering is being
applied externally (not in the rule itself)
Does someone has an idea how to bridge this gap using Drools? 
Are there any workarounds that can be used in order to avoid changes in
code?
And here we can use your help:
We are new to Drools (and still have to dive into the big ocean of code that
exists). 
The following features
1) defining parameters (in the package level...something like import)
2) adding in/out modifiers (can be used in LHS, RHS, or both)
3) allowing assignment of aliases to parameters 
4) adding such functionality to the rule editor (auto-complete ,type safety)
Where should we start?
Do you have any ideas that can help start this process (e.g. relevant
classes, modules)?
We would appreciate any help regarding any of the items in the list above.
Any hints, suggestions, directions, referals and so on.
Thanks a lot.
Yoni
-- 
View this message in context: http://www.nabble.com/Rule-Parameters-Aliases-tp18359434p18359434.html
Sent from the drools - dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                17 years, 3 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        [Fwd: Re: [rules-users] determinism with rulebase partitioning]
                                
                                
                                
                                    
                                        by Mark Proctor
                                    
                                
                                
                                        Forwarding the email to the dev mailing list, I meant the conversation 
to be on this list anyway - sorry.
mark
-------- Original Message --------
    I think that even with rulebase partitions, we should continue to 
support current execution mode. So, we should keep a rulebase 
configuration that basically allow the user to defines: either 
single-thread (as it is today) or multi-thread (as we are trying to 
achieve) execution.
    Having that in mind, in the multi-thread mode:
(A) What does "parallel evaluation of a rulebase" mean? Is it designed
to optimise, for example, two threads processing a stateless and
stateful session?
   Means that rules that do not share nodes, being independent of each 
other (from an evaluation perspective), will be evaluated in parallel. 
This is very common scenario and a desidered feature in CEP engines.
(B) Are there only two partitions, both of which are invisible to the
user? Is there any value in allowing user-defined partitions?
    There will be as many partitions as the compiler can create for the 
given set of rules. Rules that share more nodes, are more difficult to 
partition, while rules that are independent from an LHS point of view, 
are easier to parallelize. In my opinion, the only thing that may be 
helpful to expose and allow the user to control is the maximum size of 
the thread pool that is used to propagate facts. Even that I'm not sure 
is so helpful, because it is complex to fine tune such things, since the 
partitioning is completely dependent on the rules added to the rulebase.
(C) Does the partition used depend upon what type of session is used
(i.e. stateless always uses the partition without an agenda whereas
stateful always uses the partition with an agenda)?
    The partitioning of the rulebase is dependent upon the rules in the 
rulebase and nothing more. But that is different from the agenda. The 
agenda issue is much more complex, because even with partitions we can 
keep a single deterministic agenda (as long as it is not in active mode 
- runUntilHalt). Now, if the agenda is in active mode, or if we have 
multiple agendas (1 per partition, for instance), then the engine 
behavior becomes indeterministic. This is a common scenario in CEP 
systems that have multiple different "queries" running over the same set 
of streams, trying to detect and act upon them as soon as they are 
detected, and event streams are indeterministic by their own nature. In 
common rules engines scenarios, I'm not sure we can run in this 
indeterministic mode.
(D) Can a rule sometimes be deterministic and sometimes not (i.e.
depends upon the type of session)?
    It will always depend on the set of rules (the rulebase), not the 
type of session. One rule is always deterministic when considered in 
isolation, but two or more rules may or may not be deterministic in 
relation to each other. Just remember Eisten's Relativity Theory... ;)
   []s
   Edson
2008/8/1 Anstis, Michael (M.) <manstis1(a)ford.com <mailto:manstis1@ford.com>>
    Hi Mark,
    A few questions:-
    (A) What does "parallel evaluation of a rulebase" mean? Is it designed
    to optimise, for example, two threads processing a stateless and
    stateful session?
    (B) Are there only two partitions, both of which are invisible to the
    user? Is there any value in allowing user-defined partitions?
    (C) Does the partition used depend upon what type of session is used
    (i.e. stateless always uses the partition without an agenda whereas
    stateful always uses the partition with an agenda)?
    (D) Can a rule sometimes be deterministic and sometimes not (i.e.
    depends upon the type of session)?
    Cheers,
    Mike
    -----Original Message-----
    From: rules-users-bounces(a)lists.jboss.org
    <mailto:rules-users-bounces@lists.jboss.org>
    [mailto:rules-users-bounces@lists.jboss.org
    <mailto:rules-users-bounces@lists.jboss.org>] On Behalf Of Mark Proctor
    Sent: 01 August 2008 07:05
    To: Rules Users List
    Subject: [rules-users] determinism with rulebase partitioning
    We have rulebase partitioning almost working, this allows parallel
    evaluation of a rulebase. For stateless lessions with no agenda this
    will allow for much faster executions, where you don't care about
    deterministic execution. However for deterministic execution its more
    complicated. The current plan is to have an agenda per parition, which
    means that we no longer have rulebase wide deterministic execution
    order, only with the partition itself. The user is unlikely to be aware
    of the created partitions, so won't be aware of the unditermistic
    behavour of their rulebase. Anyone have any input on mechanisms users
    can do to help the rulebase know what needs to be executed
    deterministically and what doesn't?
    Mark
    _______________________________________________
    rules-users mailing list
    rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
    https://lists.jboss.org/mailman/listinfo/rules-users
    _______________________________________________
    rules-users mailing list
    rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
    https://lists.jboss.org/mailman/listinfo/rules-users
-- 
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com <http://www.jboss.com>
                                
                         
                        
                                
                                17 years, 3 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Re: [rules-users] determinism with rulebase partitioning
                                
                                
                                
                                    
                                        by Mark Proctor
                                    
                                
                                
                                        Sorry I meant to ask this on th dev list :(
Anstis, Michael (M.) wrote:
> Hi Mark,
>
> A few questions:-
>
> (A) What does "parallel evaluation of a rulebase" mean? Is it designed
> to optimise, for example, two threads processing a stateless and
> stateful session?
>   
It works out the parts of the network that can be isolated, so we can 
use multiple threads in parallel for evalation of a rulebase.
> (B) Are there only two partitions, both of which are invisible to the
> user? Is there any value in allowing user-defined partitions?
>   
There could be any number of partitions depending on the analysis of the 
rulebase. It's an internal optimisation of a rulebase, so it's not 
something they are aware of. A user cannot define a partition, as 
partitions are determined by the rules written and their level of isolation.
> (C) Does the partition used depend upon what type of session is used
> (i.e. stateless always uses the partition without an agenda whereas
> stateful always uses the partition with an agenda)?
>   
it analysesthe rulebase, nothing to do with the session type. However 
stateless sessions without inference typically don't need determinstic 
execution, so we can just evaluate and fire there.
> (D) Can a rule sometimes be deterministic and sometimes not (i.e.
> depends upon the type of session)?
>   
Not on the type of session, no. And having a rule sometimes determinstic 
would probably be bad.
> Cheers,
>
> Mike
>
> -----Original Message-----
> From: rules-users-bounces(a)lists.jboss.org
> [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
> Sent: 01 August 2008 07:05
> To: Rules Users List
> Subject: [rules-users] determinism with rulebase partitioning
>
> We have rulebase partitioning almost working, this allows parallel 
> evaluation of a rulebase. For stateless lessions with no agenda this 
> will allow for much faster executions, where you don't care about 
> deterministic execution. However for deterministic execution its more 
> complicated. The current plan is to have an agenda per parition, which 
> means that we no longer have rulebase wide deterministic execution 
> order, only with the partition itself. The user is unlikely to be aware 
> of the created partitions, so won't be aware of the unditermistic 
> behavour of their rulebase. Anyone have any input on mechanisms users 
> can do to help the rulebase know what needs to be executed 
> deterministically and what doesn't?
>
> Mark
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>   
                                
                         
                        
                                
                                17 years, 3 months