[rules-dev] Declaration issues solved

Edson Tirelli tirelli at post.com
Tue Jan 16 17:09:06 EST 2007


 
    Mark,

    I solved the unbalanced trees problems we were talking about. I will 
summarize the solutions bellow.

Unbalanced logical branches show up when we have a rule like this:

A and (B or (C and D) ) and E

In the above case, after transformation we will end up with 2 unbalanced 
logical branches:

A and B and C
A and C and D and E

So, in the first branch will work with a tuple [A, B, E] and the second 
will work with a tuple [A, C, D, E].

We end up with 2 problems:

a) first problem is that E column may have different attributes in each 
logical branch (and in fact it has), so during the logic transformation 
I'm now cloning columns when they are required in more than one branch.

b) second problem is that if someone binds the E element and uses it in 
the consequence, we need to know that it has different positions in each 
logical branch. The solution for this was to make each terminal node to 
hold a reference to the subrule (logical branch) it belongs to. This 
way, when activating the consequence, the knowledge helper will resolve 
the variable using the subrule attached to the terminal node that caused 
the activation.

    I added test cases and it is all working fine.

    []s
    Edson

-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-dev mailing list