I would follow a different path. During network building you have that information. So, make the nodes reference their rules objects, or have a String[] for the rule names at least.
   Some considerations:

* A node may be shared among multiple rules, so you will need a list of rule references for each node.

* Be careful with memory consumption. Find a cheap way to store such information.

* Make sure your schema does not increase serialization cost too much.

    At runtime, then you have the information ready to go in each node.

    What are you working on? Would you be willing to contribute back to the project?

    []s
    Edson

2008/11/10 Mark Proctor <mproctor@codehaus.org>
Waleed Zedan wrote:
Hi,

in AlphaNode.java (similarly beta nodes descendants)
public void assertObject(final InternalFactHandle handle,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) throws FactException {
if ( this.constraint.isAllowed( handle.getObject(),
                                        workingMemory,
   ...        
}
 // I need to put code here to get the rule and previous statisfied conditions
}

I need to get rule that owns the alpha or beta node as well as all the previous conditions that have been satisfied.

For example:
Rule 1 :
        Condition1 -> Node1
        Condition2 -> Node2
        Condition3 -> Node3

so if fact1 satisfies condition 1 & 2 only, but condition 3 doesn't satisfy it, I need to store the information that rule 1 with condition 1 & condition 2 have been satisfied.
       
So , how can I get the rule that owns the condition?
Can I get this information from workingMemoryEventSupport.fireObjectInserted event?
The rete network information is not exposed publicly. Do you know how to get access to the nodes themselves already? Via the Rete object on the RuleBase, you'll need to cast the workingmemory and rulebase to implementations to do this. From there do you know how traverse the network, and from there now to lookup the node memories? The node memories are in the workingmemory, you can see the method in each node how it retrieves that memory.

Mark

Thanks,
--
Waleed Zedan
SCJP 1.4 , CCNA

_______________________________________________ rules-dev mailing list rules-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-dev


_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com