[rules-users] fireAllRules fire an exception !

2007-07-30 Thread hypnosat7

Hi,
I try to execute this code :
session.startProcess(ruleFlowId);
session.insert(fact);
session.fireAllRules();

But I have a NullPointerEception :

java.lang.NullPointerException
at 
mipih.Rule_Correction_acte_0.consequence(Rule_Correction_acte_0.java:15)
at
mipih.Rule_Correction_acte_0ConsequenceInvoker.evaluate(Rule_Correction_acte_0ConsequenceInvoker.java:23)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:545)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:509)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:430)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:392)

Any help pls
-- 
View this message in context: 
http://www.nabble.com/fireAllRules-fire-an-exception-%21-tf4169266.html#a11861345
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Bug: Shadow facts

2007-07-30 Thread Arjun Dhar
Hi,
 I have an Object 'Configuration'

public class BooleanConfiguration {
  String paramName;
  Boolean value;
  Client client;
}

I asserted this object and the rule was not executing as I expected.

I put a break point in the object, and found that it set it correctly but 
whenenver the rule engine called the get method the vaue of the object was null.

I traced this the place where it creates shadows in Rete.java.
I had observed a similar behaviour in version 3.1 or 3.6 (if there was a 3.6). 
it was more prolific then. I have over 50 objects, only this one is giving a 
problem.

I made the class 'final' (This prevents a shadow from being created), and voila 
my rule worked as expected.
Note: None of the otehr objects needed a final, but had comeplex associations.
But this particular object does not run, unless declared final.

The fact that i have to use 'final' for it to work, seals it for me as a bug.

thanks,
Arjun

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Does the Rete Graph recognize associations independently?

2007-07-30 Thread Mark Proctor
The engine has no way to know that one object is a field of another 
object. For this reason you should setup things relationally, using an 
object to relate the parent and child. Look at the Conways game of life 
example and the Neighbor class. You also then have the advantage that 
you can now exploit the cross product to drive the application.


Read this blog:
http://blog.athico.com/2007/06/declarative-relational-programming.html

Mark
Arjun Dhar wrote:

Hi,
 one doubt I've had while writing DRL scripts and also with others is:

A {
 B b
 C c
 D d
};

If The rules are to be Written over A, B, C
Then should one assert B, C  D also? --- Answer yes!

Ok, now that we've asserted them, in the Rule if one uses:
A.b; does the Rete graph recognize it as a node of A or B?
I suspect it is 'A'

Hence...
I take a safe approach and write rules on B,C independently but then ensure 
those objects are reverse associated with A. This increases the risk of objects 
not being released for GC (depends on JVM) if not nullified (and breaking the 
circular associations).


So whats the best approach in designing objects for the Engine?

Thanks,
Arjun

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] fireAllRules fire an exception !

2007-07-30 Thread Mark Proctor
Just means your consequence threw a NullPointerException, the expception 
should contain an nested exception with some more information.


Mark
hypnosat7 wrote:

Hi,
I try to execute this code :
session.startProcess(ruleFlowId);
session.insert(fact);
session.fireAllRules();

But I have a NullPointerEception :

java.lang.NullPointerException
at 
mipih.Rule_Correction_acte_0.consequence(Rule_Correction_acte_0.java:15)
at
mipih.Rule_Correction_acte_0ConsequenceInvoker.evaluate(Rule_Correction_acte_0ConsequenceInvoker.java:23)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:545)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:509)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:430)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:392)

Any help pls
  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Bug: Shadow facts

2007-07-30 Thread Edson Tirelli
   Arjun,

   Can you please open a JIRA and add a self contained test case showing the
problem?

   Thank you,
  Edson

2007/7/30, Arjun Dhar [EMAIL PROTECTED]:

 Hi,
 I have an Object 'Configuration'

 public class BooleanConfiguration {
   String paramName;
   Boolean value;
   Client client;
 }

 I asserted this object and the rule was not executing as I expected.

 I put a break point in the object, and found that it set it correctly but
 whenenver the rule engine called the get method the vaue of the object was
 null.

 I traced this the place where it creates shadows in Rete.java.
 I had observed a similar behaviour in version 3.1 or 3.6 (if there was a
 3.6).
 it was more prolific then. I have over 50 objects, only this one is giving
 a
 problem.

 I made the class 'final' (This prevents a shadow from being created), and
 voila
 my rule worked as expected.
 Note: None of the otehr objects needed a final, but had comeplex
 associations.
 But this particular object does not run, unless declared final.

 The fact that i have to use 'final' for it to work, seals it for me as a
 bug.

 thanks,
 Arjun

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] class Cast Exception when using OR (||) - Bug?

2007-07-30 Thread Arjun Dhar
When I define a rule:

When
 cntct:Contact (initialized==true)
 exr:Relation( contact==cntct, 
   active:active==$1, 
   relationName==Old)
Then
 contact.getStatus().setStatus(true);
 contact.getStatus().addToReasonTrace(drools.getRule().getName());
end

..The bove works.

BUT, when I do the following:

When
 cntct:Contact (initialized==true)
 exr:Relation( contact==cntct, 
   active:active==$1, 
   relationName==Old)
 || Relation( contact==cntct, 
   active:active==$1, 
   relationName==null)
Then
 contact.getStatus().setStatus(true);
 contact.getStatus().addToReasonTrace(drools.getRule().getName());
end
... The script compiles anda stateless Session is created successfully, but at 
runtime/execution it fails with the exception:
java.lang.ClassCastException: com.arjun.brms.businessObjects.Contact
org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:75)
org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:141)
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:20)
org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120)
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:20)
org.drools.reteoo.JoinNode.assertObject(JoinNode.java:162)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:317)
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:308)
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:308)
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168)
org.drools.reteoo.Rete.assertObject(Rete.java:168)
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:848)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:822)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:623)

Class diagram:

Contact-- bi-directional association --ListRelation

Please advise! is this a bug?

thanks,
Arjun

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: class Cast Exception when using OR (||) - Bug?

2007-07-30 Thread Arjun Dhar
FYI
 Let $1 = true
 and the object Contact is declared 'final'

thanks,
Arjun



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Production rules vs. ECA Rules

2007-07-30 Thread qmars765
Dear List,

In JBoss Rules documentation it is written that they can be used for production 
rules. But I frequently read also in other sources about ECA rules. 

Is there any significant difference between “ECA” and “Production” Rules?
If yes, what?

Thanks in advance for your feedback and best Regards,

Kioumars

-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] class Cast Exception when using OR (||) - Bug?

2007-07-30 Thread Edson Tirelli
Arjun

It is a bug since a more friendly message should be raised at compile
time stating that your contact declaration is not available in one of your
logical branches.
Having said that, what you want to do is make your OR take priority over
the implicit AND and as such, you need to add () around the OR:

When
contact:Contact (initialized==true)
exr: ( Relation( contact==cntct,
   active:active==$1,
   relationName==Old)
or Relation( contact==cntct,
   active:active==$1,
   relationName==null) )
Then
contact.getStatus().setStatus(true);
contact.getStatus().addToReasonTrace(drools.getRule().getName());
end

   Having said that, better yet for you would not to use the OR CE, but to
use restriction connectives. This would be the most efficient (and clean)
way of writing your rule:

When
contact:Contact (initialized==true)
exr: Relation( contact==cntct,
   active:active==$1,
   relationName ==Old || == null )
Then
contact.getStatus().setStatus(true);
contact.getStatus().addToReasonTrace(drools.getRule().getName());
end

   As a syntax sugar, you could also write:

exr: Relation( contact==cntct,
   active:active==$1,
   relationName in ( Old, null ) )

   Can you please open a JIRA with your test case for the bug?
   Thank you,
Edson

2007/7/30, Arjun Dhar [EMAIL PROTECTED]:

 When I define a rule:

 When
 cntct:Contact (initialized==true)
 exr:Relation( contact==cntct,
active:active==$1,
relationName==Old)
 Then
 contact.getStatus().setStatus(true);
 contact.getStatus().addToReasonTrace(drools.getRule().getName());
 end

 ..The bove works.

 BUT, when I do the following:

 When
 cntct:Contact (initialized==true)
 exr:Relation( contact==cntct,
active:active==$1,
relationName==Old)
 || Relation( contact==cntct,
active:active==$1,
relationName==null)
 Then
 contact.getStatus().setStatus(true);
 contact.getStatus().addToReasonTrace(drools.getRule().getName());
 end
 ... The script compiles anda stateless Session is created successfully,
 but at
 runtime/execution it fails with the exception:
 java.lang.ClassCastException: com.arjun.brms.businessObjects.Contact
 org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:75)
 org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java
 :141)
 org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
 (SingleTupleSinkAdapter.java:20)
 org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120)
 org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
 (SingleTupleSinkAdapter.java:20)
 org.drools.reteoo.JoinNode.assertObject(JoinNode.java:162)
 org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
 (CompositeObjectSinkAdapter.java:317)
 org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
 org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
 (CompositeObjectSinkAdapter.java:308)
 org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
 org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
 (CompositeObjectSinkAdapter.java:308)
 org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168)
 org.drools.reteoo.Rete.assertObject(Rete.java:168)
 org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
 org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java
 :70)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java
 :848)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java
 :822)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java
 :623)

 Class diagram:
 
 Contact-- bi-directional association --ListRelation

 Please advise! is this a bug?

 thanks,
 Arjun

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools-example-brms

2007-07-30 Thread Fernando Meyer

Hi Shahad,

	You are right, the binary in resources directory is deprecated, But  
as you can see I'm using the RuleAgent url to access deployed stuff  
(http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-examples/ 
drools-examples-brms/src/main/brmsdeployedrules.properties ), I think  
for compatibility issues will be better remove the compiled package  
in resources dir.


Thanks for your feedback

Fernando Meyer http://fmeyer.org
[EMAIL PROTECTED]
PGP: 0xD804DDFB



On Jul 30, 2007, at 1:26 PM, Shahad Ahmed wrote:


I had the same problem but managed to fix it.

I think the problem is that the repository in the BRMS insurance  
example was built with an old version of the MVEL library  
(mvel14-1.2pre5.jar) which means that some the MVEL objects defined  
in the example repository (in file repository_export.xml) have an  
incorrect serialVersionUID values when they are accessed by the  
BRMS web-app, which uses a (newer?) version of MVEL mvel14-1.2rc1.jar.


Here's how I got the example working:

1. I assume you've  already loaded the example repository from  
repository_export.xml as described in Fernando's instructions for  
the BRMS example in the drools 4.0GA manual (section 9, which  
incidentally doesn't have a table of contents entry, so you have to  
scroll down to near the end of the manual).  Click the Packages  
option on the left-hand side of the BRMS page.  Select the  
org.acme.insurance package in the Explore tab. Click on build,  
validate and deploy for this package. Then click the Build  
Package button. This will build a new version of the example, but  
using the new MVEL library. If the build worked, another button  
will appear below the Build Package button called create  
Snapshot for Deployment. Created a new snapshot and call it what  
you like.


2. Click the Deployment option on the left-hand-side of the BRMS  
window.  Click on the Snapshot tab and then select the  
org.acme.insurance package. The new snapshot you created should be  
listed. Click the Open button beside it and copy the displayed  
Package URI into the brmsdeployedrules.properties file to replace  
the existing key called url – this is identical to the instructions  
in the manual. Save the file.


3. In the example eclipse project, remove the mvel14-1.2pre5.jar  
from the project's java build path libraries. Add in the following  
jars from the drools 4.0 GA binary distribution:


mvel14-1.2rc1.jar
drools-core-4.0.0.jar
drools-compiler-4.0.0.jar

Now run MainClass in the examples eclipse project. Hopefully, you  
will see the expected output.


Note that the exported binary version of the insurance example  
found in resources/org.acme.insurance.pkg suffers from the same  
issue. To get that working as well you will need to create a new  
version of the file by selecting download binary package in step  
1, after clicking Build Package.


Also note that you get the same problem if you use the BRMS Drools  
4.0.0 BRMS Standalone version that comes with Tomcat 5.5 on the  
download page. To fix that, find the folder drools-jbrms-1.0- 
standalone\shared\lib and then replace mvel14-1.0-SNAPSHOT.jar with  
the version of MVEL in the 4.0 GA binary dist - mvel14-1.2rc1.jar.


Hope this helps.
Shahad



On 7/20/07, davidnm [EMAIL PROTECTED] wrote:

I did it and i got the same, i forgot to say i´m running it on  
Tomcat 5.5

could it be the problem?

Thanks.



Fernando Meyer Camargo wrote:

 use double \ in your config. file

 ex. D:\\workspace2\\drools-example-brms\\cache



 Fernando Meyer http://fmeyer.org
 [EMAIL PROTECTED]
 PGP: 0xD804DDFB



 On Jul 19, 2007, at 9:31 AM, David Nogueras wrote:

 Hi, I´m trying to run the brms sample and i get the next output:

 RuleAgent(insuranceconfig) INFO (Thu Jul 19 14:27:44 CEST 2007):
 Configuring with newInstance=true, secondsToRefresh=30
 RuleAgent(insuranceconfig) INFO (Thu Jul 19 14:27:44 CEST 2007):
 Configuring package provider : URLScanner monitoring URLs:  http://
 localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/
 org.acme.insurance/David2 with local cache dir of D:\workspace2
 \drools-example-brms\cache
 RuleAgent(insuranceconfig) WARNING (Thu Jul 19 14:27:44 CEST 2007):
 Falling back to local cache.
 java.lang.NullPointerException
 at org.drools.agent.FileScanner.readPackage(FileScanner.java: 
101)
 at org.drools.agent.FileScanner.getChangeSet  
(FileScanner.java:79)

 at org.drools.agent.FileScanner.loadPackageChanges
 ( FileScanner.java:57)
 at org.drools.agent.URLScanner.loadPackageChanges
 (URLScanner.java:93)
 at org.drools.agent.RuleAgent.checkForChanges  
(RuleAgent.java:291)
 at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java: 
259)

 at org.drools.agent.RuleAgent.configure(RuleAgent.java:228)
 at org.drools.agent.RuleAgent.init(RuleAgent.java:160)
 at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:169)
 at org.acme.insurance.launcher.InsuranceBusiness.loadRuleBase
 

Re: [rules-users] Production rules vs. ECA Rules

2007-07-30 Thread Mark Proctor
ECA is really a specialised subset of Product Rules; focusing more on 
generic event generation and event handling.


Mark
[EMAIL PROTECTED] wrote:

Dear List,

In JBoss Rules documentation it is written that they can be used for production rules. But I frequently read also in other sources about ECA rules. 


Is there any significant difference between “ECA” and “Production” Rules?
If yes, what?

Thanks in advance for your feedback and best Regards,

Kioumars

  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] JBoss Drools BRMS Standalone

2007-07-30 Thread Fernando Meyer
Now you can download BRMS standalone version, this distribution comes  
with a built-in Tomcat 5.5.20 web server and the insurance example as  
demo repository, so it runs out the box. If you want to test BRMS and  
don't have enough time to deploy, just follow to downloads page  
http://labs.jboss.com/drools/downloads


Brief install guide

1. Install a Java Development Kit (JDK) from http://java.sun.com/ 
javase/downloads/index.jsp (avoid JREs, Java EEs, Netbeans, etc. on  
that page - you just want a JDK).


2. Set the JAVA_HOME variable to where you installed Java. Windows  
installers may do this for you.


3. Run bin/startup.sh (*nix) or bin\startup.bat (Windows). Check that  
there are no errors on the console. See below for troubleshooting  
advice.


4. Point your browser at http://localhost/ You should see brms's  
login box.


Problem

A common startup problem is when another program has claimed port 80,  
which BRMS is configured to run on by default. To avoid this port  
conflict, BRMS's port can be changed in conf/server.xml.


If you have installation (or other) problems, ask on the mailing  
lists or irc.


http://labs.jboss.com/drools/irc.html

Fernando Meyer http://fmeyer.org
[EMAIL PROTECTED]
PGP: 0xD804DDFB



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users