Benoit,<br><br>Could you try this with Drools 5 to see if you still have problems? I just tried with that and each rule fired as expected.<br><br><div class="gmail_quote">2008/8/20 Benoit VILLAUMIE <span dir="ltr"><<a href="mailto:bvillaumie@karavel.com">bvillaumie@karavel.com</a>></span><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">
Hello,<br>
<br>
I am using Drools engine 4.0.7 and Eclipse 3.3 drools plugin.<br>
<br>
I have a very basic/dumb problem but I do not understand where my error
is :<br>
<br>
I have 2 rules <br>
---------------------------------<br>
<blockquote>package poc<br>
<br>
import poc.FlashFact;<br>
<br>
<b>rule "HP one"</b><br>
when<br>
FlashFact( homepage == "one");<br>
then<br>
System.out.println("*** HP one");<br>
end<br>
<br>
<b>rule "HP commons"</b><br>
when<br>
FlashFact();<br>
then<br>
System.out.println("*** HP commons ");<br>
end<br>
</blockquote>
----------------------------------<br>
<br>
I insert a FlashFact which homepage is set with "one" value.<br>
<br>
In my understanding, both rules "HP one" and "HP commons" should be
fired. Instead, only "HP commons" is launched. I have compared with the
Drools State example (which works fine), but I do not notice nothing.<br>
<br>
Thanks for your help.<br>
<br>
The code of the FlashFact class<br>
---------------------------------<br>
<blockquote>package poc;<br>
<br>
public class FlashFact {<br>
<br>
public FlashFact() {<br>
this(null);<br>
}<br>
<br>
public FlashFact(String homepage) {<br>
this.setHomepage(homepage);<br>
} <br>
<br>
private String homepage;<br>
<br>
/**<br>
* @return the homepage<br>
*/<br>
public final String getHomepage() {<br>
return this.homepage;<br>
}<br>
<br>
/**<br>
* @param homepage the homepage to set<br>
*/<br>
public final void setHomepage(String homepage) {<br>
this.homepage = homepage;<br>
}<br>
<br>
}<br>
</blockquote>
---------------------------------<br>
<br>
The code of the launcher<br>
---------------------------------<br>
package poc;<br>
<br>
import java.io.InputStreamReader;<br>
<br>
import org.drools.RuleBase;<br>
import org.drools.RuleBaseFactory;<br>
import org.drools.StatefulSession;<br>
import org.drools.audit.WorkingMemoryFileLogger;<br>
import org.drools.compiler.PackageBuilder;<br>
<br>
public class FlashUndeployedRulesMain {<br>
<br>
public static void main(String[] args) throws Exception {<br>
StatefulSession session = null;<br>
WorkingMemoryFileLogger logger = null;<br>
try {<br>
PackageBuilder builder = new PackageBuilder();<br>
builder.addPackageFromDrl(new InputStreamReader(<br>
FlashUndeployedRulesMain.class.getClassLoader()<br>
.getResourceAsStream(RULE)));<br>
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();<br>
ruleBase.addPackage(builder.getPackage());<br>
session = ruleBase.newStatefulSession();<br>
<br>
logger = new WorkingMemoryFileLogger(<br>
session);<br>
logger.setFileName("log/flash");<br>
<br>
// inserting facts<br>
FlashFact HPFrance = new FlashFact("one"); <br>
<br>
session.insert(HPFrance);<br>
<br>
session.fireAllRules();<br>
} finally {<br>
if(session != null) {session.dispose();}<br>
if(logger != null) {logger.writeToDisk();}<br>
}<br>
}<br>
<br>
private static final String RULE = "poc/Flash.drl";<br>
---------------------------------<br>
<br>
<br>
</div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>