<div dir="ltr">Thanks Mark And Edson for your guidlines.<br><br>I need to gather statistics about how many rules have been fired, and also partial rule firing, for example if a rule 1 has 3 conditions, 1 of them is never fired, but the other conditions get fired, then we have to remove this condition. (the rule firing data will be persisted somewhere).<br>
<br>Thanks.<br><br><br><div class="gmail_quote">On Mon, Nov 10, 2008 at 10:45 PM, Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com">tirelli@post.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>&nbsp;&nbsp; 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. <br>&nbsp;&nbsp; Some considerations:<br><br>

* A node may be shared among multiple rules, so you will need a list of rule references for each node.<br><br>* Be careful with memory consumption. Find a cheap way to store such information.<br><br>* Make sure your schema does not increase serialization cost too much.<br>

<br>&nbsp;&nbsp;&nbsp; At runtime, then you have the information ready to go in each node. <br><br>&nbsp;&nbsp;&nbsp; What are you working on? Would you be willing to contribute back to the project?<br><br>&nbsp;&nbsp;&nbsp; []s<br>&nbsp;&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">

2008/11/10 Mark Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt;</span><div><div></div><div class="Wj3C7c"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




  

<div bgcolor="#ffffff" text="#000000"><div><div></div><div>
Waleed Zedan wrote:
<blockquote type="cite">
  <div dir="ltr">Hi,<br>
  <br>
in AlphaNode.java (similarly beta nodes descendants)<br>
public void assertObject(final InternalFactHandle handle,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final PropagationContext context,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final InternalWorkingMemory workingMemory)
throws FactException {<br>
if ( this.constraint.isAllowed( handle.getObject(),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; workingMemory,<br>
&nbsp;&nbsp; ... &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
}<br>
&nbsp;// I need to put code here to get the rule and previous statisfied
conditions<br>
}<br>
  <br>
I need to get rule that owns the alpha or beta node as well as all the
previous conditions that have been satisfied.<br>
  <br>
For example:<br>
Rule 1 :<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Condition1 -&gt; Node1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Condition2 -&gt; Node2<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Condition3 -&gt; Node3<br>
  <br>
so if fact1 satisfies condition 1 &amp; 2 only, but condition 3 doesn&#39;t
satisfy it, I need to store the information that rule 1 with condition
1 &amp; condition 2 have been satisfied.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br clear="all">
So , how can I get the rule that owns the condition?<br>
Can I get this information from
workingMemoryEventSupport.fireObjectInserted event?<br>
  </div>
</blockquote></div></div>
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&#39;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.<br>
<br>
Mark<br>
<blockquote type="cite"><div>
  <div dir="ltr"><br>
Thanks,<br>
-- <br>
Waleed Zedan<br>
SCJP 1.4 , CCNA<br>
  </div>
  </div><pre><hr size="4" width="90%">
_______________________________________________
rules-dev mailing list
<a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
  </pre>
</blockquote>
<br>
</div>

<br>_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div></div></div><font color="#888888"><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>

</font><br>_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Waleed Zedan<br>SCJP 1.4 , CCNA<br>
</div>