Re: [rules-users] Unresolved Object Reference

2007-07-05 Thread Ronald R. DiFrango

Edson,

That is indeed the case, XML Beans is generating final equals/hashCdoe
methods.  I have no idea why that is case.  I may post this over on the XML
Beans board.

Is disabling the shadowing a problem from the rules execution point of view?

Finally, I guess I need to do a source build, can I find the instructions
somewhere on this?

Ron

On 7/5/07, Edson Tirelli <[EMAIL PROTECTED]> wrote:



   There was a problem with CGLIB proxies much similar to this... so
probably the same problem.

   What happens is that to shadow a fact, drools needs to extend the
actual class being asserted, and override the equals and hashcode methods.
So, the class can't be final, nor these methods can be final. Previously I
wasn't checking for final on these methods and that was the reason for the
error.

   I fixed that in trunk. It means, if XML Beans are generating methods
equals/hashCode as final, drools won't be able to shadow them (and so will
automatically disable shadowing for them), but it will not raise the error
anymore.

   Let me know if it is still a problem for you in trunk.

[]s
Edson

2007/7/5, Ronald R. DiFrango <[EMAIL PROTECTED] >:
>
> All this sounds eerily similar to the problem I am reporting.  In the
> 4.0 version I am getting the following exception on those inner classes:
>
>
> Exception in thread "main" java.lang.VerifyError: class
> 
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides
 final method ã Ý*h '+ .û Ý*h '+
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> at java.lang.ClassLoader.defineClass (ClassLoader.java:465)
> at org.drools.rule.MapBackedClassLoader.fastFindClass(
> MapBackedClassLoader.java:40)
> at org.drools.rule.MapBackedClassLoader.loadClass(
> MapBackedClassLoader.java:59)
> at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
> at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java:352)
> at org.drools.reteoo.Rete.assertObject(Rete.java:152)
> at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
> at org.drools.reteoo.ReteooWorkingMemory.doInsert(
> ReteooWorkingMemory.java:70)
> at org.drools.common.AbstractWorkingMemory.insert(
> AbstractWorkingMemory.java:772)
> at org.drools.common.AbstractWorkingMemory.insert (
> AbstractWorkingMemory.java:584)
> at
> com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines(
> RtvDecisionEngine.java:95)
> at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
> RtvDecisionEngine.java :64)
> at com.circuitcity.rtvcrms.test.MainBasedTester.main(
> MainBasedTester.java:34)
>
> The catch is that XML Beans objects are auto generated based upon and
> XSD and we have limited control over what gets generated.
>
> On 7/5/07, Narendra Valada < [EMAIL PROTECTED]> wrote:
> >
> > Thank you for your quick response.
> >
> > I cannot make the Outer class static and public since it is not an
> > inner class.
> >
> > In my example, I have two inner classes : Inner and InnerInner.
> >
> > Class Inner is enclosed by Outer and class InnerInner is enclosed by
> > Inner. I get the "Unable to resolve object type"  error only on the
> > "InnerInner" class and not on the "Inner" class.
> >
> > Both the inner classes are defined as non-static.
> >
> > Thanks,
> >
> > Narendra
> >
> >
> >
> > On 7/5/07, Mark Proctor <[EMAIL PROTECTED] > wrote:
> > >
> > > you need to make your Outer class static and public. Look at the
> > > sample generated with a new drools project, that uses a static public 
class.
> > >
> > > Mark
> > > Narendra Valada wrote:
> > >
> > > * **Hello,*
> > > * *
> > > *I am getting an "Unable to resolve object type" error on certain
> > > XML Bean generated inner classes. I get this error only on inner classes
> > > that have been defined within other inner classes. Please see example 
below.
> > > *
> > > * *
> > > *Is this a known limitation of JBoss Rules (I am using JBOSS Rules
> > > 3.0.6) or the JANINO compiler?*
> > > * *
> > > *Thanks.*
> > > *
> > >
> > > package
> > > *
> > > *com.sample;
> > >
> > > public
> > > class Outer{ public class Inner { public boolean inner =
> > > false; public class InnerInner {
> > >
> > > }
> > >
> > >  }
> > >
> > > }
> > > **package*
> > > com.sample *
> > >
> > > import
> > > *com.sample.Outer1.Inner.InnerInner; *
> > >
> > > rule
> > > *"Hello World 1" *when*
> > >
> > > InnerInner()
> > > *then*
> > >
> > > System.out.println(
> > > "");* *
> > >
> > > *end*
> > >
> > > --
> > >
> > > ___
> > > 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/mai

Re: [rules-users] Unresolved Object Reference

2007-07-05 Thread Edson Tirelli

  There was a problem with CGLIB proxies much similar to this... so
probably the same problem.

  What happens is that to shadow a fact, drools needs to extend the actual
class being asserted, and override the equals and hashcode methods. So, the
class can't be final, nor these methods can be final. Previously I wasn't
checking for final on these methods and that was the reason for the error.

  I fixed that in trunk. It means, if XML Beans are generating methods
equals/hashCode as final, drools won't be able to shadow them (and so will
automatically disable shadowing for them), but it will not raise the error
anymore.

  Let me know if it is still a problem for you in trunk.

   []s
   Edson

2007/7/5, Ronald R. DiFrango <[EMAIL PROTECTED]>:


All this sounds eerily similar to the problem I am reporting.  In the 
4.0version I am getting the following exception on those inner classes:

Exception in thread "main" java.lang.VerifyError: class
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides
 final method ã Ý*h '+ .û Ý*h '+
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.lang.ClassLoader.defineClass (ClassLoader.java:465)
at org.drools.rule.MapBackedClassLoader.fastFindClass(
MapBackedClassLoader.java:40)
at org.drools.rule.MapBackedClassLoader.loadClass(
MapBackedClassLoader.java:59)
at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java:352)
at org.drools.reteoo.Rete.assertObject(Rete.java:152)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(
ReteooWorkingMemory.java:70)
at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:772)
at org.drools.common.AbstractWorkingMemory.insert (
AbstractWorkingMemory.java:584)
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines(
RtvDecisionEngine.java:95)
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
RtvDecisionEngine.java :64)
at com.circuitcity.rtvcrms.test.MainBasedTester.main(
MainBasedTester.java:34)

The catch is that XML Beans objects are auto generated based upon and XSD
and we have limited control over what gets generated.

On 7/5/07, Narendra Valada <[EMAIL PROTECTED]> wrote:
>
> Thank you for your quick response.
>
> I cannot make the Outer class static and public since it is not an inner
> class.
>
> In my example, I have two inner classes : Inner and InnerInner.
>
> Class Inner is enclosed by Outer and class InnerInner is enclosed by
> Inner. I get the "Unable to resolve object type"  error only on the
> "InnerInner" class and not on the "Inner" class.
>
> Both the inner classes are defined as non-static.
>
> Thanks,
>
> Narendra
>
>
>
> On 7/5/07, Mark Proctor <[EMAIL PROTECTED] > wrote:
> >
> > you need to make your Outer class static and public. Look at the
> > sample generated with a new drools project, that uses a static public class.
> >
> > Mark
> > Narendra Valada wrote:
> >
> > * **Hello,*
> > * *
> > *I am getting an "Unable to resolve object type" error on certain XML
> > Bean generated inner classes. I get this error only on inner classes that
> > have been defined within other inner classes. Please see example below.
> > *
> > * *
> > *Is this a known limitation of JBoss Rules (I am using JBOSS Rules
> > 3.0.6) or the JANINO compiler?*
> > * *
> > *Thanks.*
> > *
> >
> > package
> > *
> > *com.sample;
> >
> > public
> > class Outer{ public class Inner { public boolean inner =false;
> > public class InnerInner {
> >
> > }
> >
> >  }
> >
> > }
> > **package*
> > com.sample *
> >
> > import
> > *com.sample.Outer1.Inner.InnerInner; *
> >
> > rule
> > *"Hello World 1" *when*
> >
> > InnerInner()
> > *then*
> >
> > System.out.println(
> > "");*
> >
> > end
> > *
> >
> > --
> >
> > ___
> > 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
> >
> >
>
> ___
> 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





--
 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/mai

[rules-users] Re: Fun with JAXB

2007-07-05 Thread Ronald R. DiFrango

One thing, my subject line was incorrect.  I am utilizing XML Beans
generated classes and I am getting these errors.

This is something that could be a show stopper for me, so any suggestions
out there would be greatly appreciated.

On 7/5/07, Ronald R. DiFrango <[EMAIL PROTECTED]> wrote:


All,

I am using JAXB classes as my model objects that are getting passed into
the rules engine.  I get the exception below.  Here is how I am loading the
rules and adding the objects into working memory:

try
{
builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader(
RtvDecisionEngine.class.getResourceAsStream("rtv.drl" ) ) );
builder.addPackageFromDrl ( new InputStreamReader(
RtvDecisionEngine.class.getResourceAsStream("
modelDiscrepancyRules.drl" ) ) );
ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage ( builder.getPackage() );
}
catch(Exception e)
{
throw new RuntimeException("Failure loading the Rules", e);
}

final StatefulSession session = ruleBase.newStatefulSession();
DetailLine line = rtvLines[i];
session.insert(line);

Ron

--- Exception
---

Exception in thread "main" java.lang.VerifyError: class
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides
 final method .
at java.lang.ClassLoader.defineClass1 (Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at org.drools.rule.MapBackedClassLoader.fastFindClass(
MapBackedClassLoader.java :40)
at org.drools.rule.MapBackedClassLoader.loadClass(
MapBackedClassLoader.java:59)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java :352)
at org.drools.reteoo.Rete.assertObject(Rete.java:152)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java
:190)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(
ReteooWorkingMemory.java :70)
at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:772)
at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:584)
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines(
RtvDecisionEngine.java:95)
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
RtvDecisionEngine.java:64)
at com.circuitcity.rtvcrms.test.MainBasedTester.main(
MainBasedTester.java:34)


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


Re: [rules-users] Unresolved Object Reference

2007-07-05 Thread Ronald R. DiFrango

All this sounds eerily similar to the problem I am reporting.  In the
4.0version I am getting the following exception on those inner
classes:

Exception in thread "main" java.lang.VerifyError: class
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides
final method ãÝ*h'+.ûÝ*h'+
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
   at org.drools.rule.MapBackedClassLoader.fastFindClass(
MapBackedClassLoader.java:40)
   at org.drools.rule.MapBackedClassLoader.loadClass(
MapBackedClassLoader.java:59)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
   at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java:352)
   at org.drools.reteoo.Rete.assertObject(Rete.java:152)
   at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java
:190)
   at org.drools.reteoo.ReteooWorkingMemory.doInsert(
ReteooWorkingMemory.java:70)
   at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:772)
   at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:584)
   at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines(
RtvDecisionEngine.java:95)
   at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
RtvDecisionEngine.java:64)
   at com.circuitcity.rtvcrms.test.MainBasedTester.main(
MainBasedTester.java:34)

The catch is that XML Beans objects are auto generated based upon and XSD
and we have limited control over what gets generated.

On 7/5/07, Narendra Valada <[EMAIL PROTECTED]> wrote:


Thank you for your quick response.

I cannot make the Outer class static and public since it is not an inner
class.

In my example, I have two inner classes : Inner and InnerInner.

Class Inner is enclosed by Outer and class InnerInner is enclosed by
Inner. I get the "Unable to resolve object type"  error only on the
"InnerInner" class and not on the "Inner" class.

Both the inner classes are defined as non-static.

Thanks,

Narendra



On 7/5/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
>
> you need to make your Outer class static and public. Look at the sample
> generated with a new drools project, that uses a static public class.
>
> Mark
> Narendra Valada wrote:
>
> * Hello,
>
> I am getting an "Unable to resolve object type" error on certain XML
> Bean generated inner classes. I get this error only on inner classes that
> have been defined within other inner classes. Please see example below.
>
> Is this a known limitation of JBoss Rules (I am using JBOSS Rules 3.0.6)
> or the JANINO compiler?
>
> Thanks.
>
> package
> com.sample;
>
> public
> class Outer{ public class Inner { public boolean inner =false;
> public class InnerInner {
>
> }
>
>  }
>
> }
> **package*
> com.sample *
>
> import
> *com.sample.Outer1.Inner.InnerInner; *
>
> rule
> *"Hello World 1" *when*
>
> InnerInner()
> *then*
>
> System.out.println(
> "");*
>
> end
> *
>
> --
>
> ___
> rules-users mailing list
> [EMAIL PROTECTED]://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> ___
> 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


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


Re: [rules-users] Unresolved Object Reference

2007-07-05 Thread Narendra Valada

Thank you for your quick response.

I cannot make the Outer class static and public since it is not an inner
class.

In my example, I have two inner classes : Inner and InnerInner.

Class Inner is enclosed by Outer and class InnerInner is enclosed by Inner.
I get the "Unable to resolve object type"  error only on the "InnerInner"
class and not on the "Inner" class.

Both the inner classes are defined as non-static.

Thanks,

Narendra



On 7/5/07, Mark Proctor <[EMAIL PROTECTED]> wrote:


you need to make your Outer class static and public. Look at the sample
generated with a new drools project, that uses a static public class.

Mark
Narendra Valada wrote:

* Hello,

I am getting an "Unable to resolve object type" error on certain XML Bean
generated inner classes. I get this error only on inner classes that have
been defined within other inner classes. Please see example below.

Is this a known limitation of JBoss Rules (I am using JBOSS Rules 3.0.6)
or the JANINO compiler?

Thanks.

package
com.sample;

public
class Outer{ public class Inner { public boolean inner =false;
public class InnerInner {

}

 }

}
package
*com.sample *

import
*com.sample.Outer1.Inner.InnerInner; *

rule
*"Hello World 1" *when*

InnerInner()
*then*

System.out.println(
"");*

end
*

--

___
rules-users mailing [EMAIL 
PROTECTED]://lists.jboss.org/mailman/listinfo/rules-users




___
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] Unresolved Object Reference

2007-07-05 Thread Mark Proctor
you need to make your Outer class static and public. Look at the sample 
generated with a new drools project, that uses a static public class.


Mark
Narendra Valada wrote:

*
Hello,
 
I am getting an "Unable to resolve object type" error on certain XML 
Bean generated inner classes. I get this error only on inner classes 
that have been defined within other inner classes. Please see example 
below.
 
Is this a known limitation of JBoss Rules (I am using JBOSS Rules 
3.0.6) or the JANINO compiler?
 
Thanks.

*

package

*
com.sample; *

public

* *class* Outer{ *public* *class* Inner { *public* *boolean* 
inner =*false*; *public* *class* InnerInner {


}

 }

}

package
* com.sample *

import

* com.sample.Outer1.Inner.InnerInner; *

rule

* "Hello World 1" *when*

InnerInner()

*then*

System.out.println(

"");*

end

*


___
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


[rules-users] Unresolved Object Reference

2007-07-05 Thread Narendra Valada

* Hello,

I am getting an "Unable to resolve object type" error on certain XML Bean
generated inner classes. I get this error only on inner classes that have
been defined within other inner classes. Please see example below.

Is this a known limitation of JBoss Rules (I am using JBOSS Rules 3.0.6) or
the JANINO compiler?

Thanks.

package com.sample;

public class Outer{

   public class Inner {

   public boolean inner=false;

   public class InnerInner {

   }

}

}
package* com.sample

*

import* com.sample.Outer1.Inner.InnerInner;

*

rule* "Hello World 1"

*when
*

InnerInner()

*then
*

System.out.println("");
*

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


[rules-users] query in function

2007-07-05 Thread hypnosat7

Can we call a query in a function in the drl file

Thanks
-- 
View this message in context: 
http://www.nabble.com/query-in-function-tf4030626.html#a11449368
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


RE: [rules-users] order of rules firing

2007-07-05 Thread Anstis, Michael \(M.\)
Hi Smitha,
 
The "when" part of rules causes activations to be created on an agenda
at the time the facts are asserted.
 
When a call to fireAllRules() is made, activations on the agenda are
fired (the "then" part of the rule). The order in which the activations
are executed is governed by "conflict resolution" strategies.
 
If you want the "then" part of your rules to fire in a certain sequence
look at "salience" (the simplest form), or Agenda Groups and RuleFlow
(in increasing levels of complexity).
 
Good luck - JBoss Rules (or whatever new name it might be given - Mark?)
is an excellent product that I am sure you will enjoy using.
 
With kind regards,
 
Mike
 




From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Smitha Bhat
Sent: 05 July 2007 16:43
To: rules-users@lists.jboss.org
Subject: [rules-users] order of rules firing


Hi,
I am new to JBoss rules.
My drl file is not resulting in the functionality that I am
expecting. 
I know that I shouldn't be counting on the rules firing in a
particular order, but I find that as I debug my code, the 'when' of the
3 rules are evaluated first, and then the 'then's. For eg. the SetWatch
gets called after DistanceKm(Rule1), DistanceKm(Rule2) and
CountWatching(rule3) are called. I expected SetWatch to get called after
DistanceKm of Rule2 got called i.e. I expected the 'when' and the 'then'
to get evaluated sequentially. Is my understanding wrong? I tried
setting the salience of the 3 rules, but I get the same behaviour. Is
there something else I need to do, to get the functionality I need?
 
Thanks
 
The 3 rules in my drl as given below.
 

rule "Rule1"
when
$GeoPosition1 : GeoPosition()
$GeoPosition2 : GeoPosition()
eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) 
eval(util.StringEqual($GeoPosition2.getType(), "SI")) 
eval(util.DistanceKm($GeoPosition1, $GeoPosition2) > 100.0) 
eval(util.Watching($GeoPosition1, $GeoPosition2))
then
util.ClearWatch($GeoPosition1, $GeoPosition2);
end
 
rule "Rule2"
when
$GeoPosition1 : GeoPosition()
$GeoPosition2 : GeoPosition()
eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) 
eval(util.StringEqual($GeoPosition2.getType(), "SI")) 
eval(util.DistanceKm($GeoPosition1, $GeoPosition2) <= 100.0) 
eval(! util.Watching($GeoPosition1, $GeoPosition2))
then
util.SetWatch($GeoPosition1, $GeoPosition2);
end
 
rule "Rule3"
when
$GeoPosition1 : GeoPosition()
eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) 
eval(util.CountWatching($GeoPosition1) >= 1)
then
util.SetThreat($GeoPosition1, 1.0);
util.SetColor($GeoPosition1, "red");
end




Got a little couch potato? 
Check out fun summer activities for kids.
 

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


[rules-users] order of rules firing

2007-07-05 Thread Smitha Bhat
Hi,
  I am new to JBoss rules.
  My drl file is not resulting in the functionality that I am expecting. 
  I know that I shouldn't be counting on the rules firing in a particular 
order, but I find that as I debug my code, the 'when' of the 3 rules are 
evaluated first, and then the 'then's. For eg. the SetWatch gets called after 
DistanceKm(Rule1), DistanceKm(Rule2) and CountWatching(rule3) are called. I 
expected SetWatch to get called after DistanceKm of Rule2 got called i.e. I 
expected the 'when' and the 'then' to get evaluated sequentially. Is my 
understanding wrong? I tried setting the salience of the 3 rules, but I get the 
same behaviour. Is there something else I need to do, to get the functionality 
I need?
   
  Thanks
   
  The 3 rules in my drl as given below.
   
  rule "Rule1"
  when
  $GeoPosition1 : GeoPosition()
  $GeoPosition2 : GeoPosition()
  eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) 
  eval(util.StringEqual($GeoPosition2.getType(), "SI")) 
  eval(util.DistanceKm($GeoPosition1, $GeoPosition2) > 100.0) 
  eval(util.Watching($GeoPosition1, $GeoPosition2))
  then
  
  util.ClearWatch($GeoPosition1, $GeoPosition2);
  end
   
  rule "Rule2"
  when
  $GeoPosition1 : GeoPosition()
  $GeoPosition2 : GeoPosition()
  eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) 
  eval(util.StringEqual($GeoPosition2.getType(), "SI")) 
  eval(util.DistanceKm($GeoPosition1, $GeoPosition2) <= 100.0) 
  eval(! util.Watching($GeoPosition1, $GeoPosition2))
  then
  
  util.SetWatch($GeoPosition1, $GeoPosition2);
  end
   
  rule "Rule3"
  when
  $GeoPosition1 : GeoPosition()
  eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) 
  eval(util.CountWatching($GeoPosition1) >= 1)
  then
  
  util.SetThreat($GeoPosition1, 1.0);
  util.SetColor($GeoPosition1, "red");
  end

   
-
Got a little couch potato? 
Check out fun summer activities for kids.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Fun with JAXB

2007-07-05 Thread Ronald R. DiFrango

All,

I am using JAXB classes as my model objects that are getting passed into the
rules engine.  I get the exception below.  Here is how I am loading the
rules and adding the objects into working memory:

   try
   {
   builder = new PackageBuilder();
   builder.addPackageFromDrl( new InputStreamReader(
RtvDecisionEngine.class.getResourceAsStream("rtv.drl" ) ) );
   builder.addPackageFromDrl( new InputStreamReader(
   RtvDecisionEngine.class.getResourceAsStream("
modelDiscrepancyRules.drl" ) ) );
   ruleBase = RuleBaseFactory.newRuleBase();
   ruleBase.addPackage( builder.getPackage() );
   }
   catch(Exception e)
   {
   throw new RuntimeException("Failure loading the Rules", e);
   }

   final StatefulSession session = ruleBase.newStatefulSession();
   DetailLine line = rtvLines[i];
   session.insert(line);

Ron

--- Exception
---

Exception in thread "main" java.lang.VerifyError: class
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides
final method .
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
   at org.drools.rule.MapBackedClassLoader.fastFindClass(
MapBackedClassLoader.java:40)
   at org.drools.rule.MapBackedClassLoader.loadClass(
MapBackedClassLoader.java:59)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
   at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java:352)
   at org.drools.reteoo.Rete.assertObject(Rete.java:152)
   at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java
:190)
   at org.drools.reteoo.ReteooWorkingMemory.doInsert(
ReteooWorkingMemory.java:70)
   at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:772)
   at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:584)
   at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines(
RtvDecisionEngine.java:95)
   at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
RtvDecisionEngine.java:64)
   at com.circuitcity.rtvcrms.test.MainBasedTester.main(
MainBasedTester.java:34)
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with MR3

2007-07-05 Thread Mark Proctor
mic, has been working on this all day and cannot reproduce it. spinning 
off a hundred threads and sesssions; you'll have to provide some code 
that recreates the situation for us.


Mark
s erel wrote:

Please let me know if the permGen issue can be fixed somehow.
Thanks

 
On 7/5/07, *Mark Proctor* <[EMAIL PROTECTED] 
> wrote:


actually, yes you are right - that was indeed the problem. That
iterator is normally only used by the working memory, which is
single threaded, but in this case its on the rulebase, which is
not suppose to hold state. I'll fix this now,  well found :)

Mark

s erel wrote:

Do you know if the fix I mentioned (returning a new iterator each
time) solves the problem or only mask it?
We create the initial RuleBase on server start-up.
 
On 7/4/07, *Mark Proctor* <[EMAIL PROTECTED]

> wrote:

actually I thought i tracked it down, was wrong. Anyway once
the RuleBase is built the "ObjectHashMap objectTypeNodes" in
Rete should not changeOnly I things I can think of are:
1) Some how a thread is seeing a stale version of the map
2) the rulebase is getting updated while propagation is
happening, maybe combine with an issue from 1. In reality the
rulebase addition should obey the standard locking mechanism
and stop this from happening.
3) The initial RuleBase hasn't finished building yet, and
threads are already being spun off to assert data.

I have a feeling its 3...

Mark

Mark Proctor wrote:

ok, that might be it. We generate code in a singleton
classloader, I suspect that each thread is generating its'
own getters. I suspect that created singleton classloader is
not getting GCd and releasing the perm gen. I'm not sure how
to fix this. You can check this yourself by attaching a
jprofiler instance (available for free trial) and looking at
the object counts.

I've tracked down the concurrency issue. The Rete node has a
HashMap of ObjectTypeNodes that is built on the fly, that
was global to the rulebase. I'll have to make it local to
the working Memory. I'll fix that today.

Mark
s erel wrote:

Our server creates hundreds of stateful rule sessions
concurrently. Each created rule seesion is specific to a
thread. We did not encounter
any memory problems with the previous version. As I've
said, it's difficult (actually, impossible) for me to
provide you with a self contained example
since the drl is complicated and contains dozens of complex
objects. However, I am ready to provide you with any
information that can help
us in that manner.
I've also mentioned in the earlier threads the concurrency
problem I've encountered with AbstractHashTable.
Can this has something to do with it?

 
On 7/4/07, *Mark Proctor* <[EMAIL PROTECTED]

> wrote:

I don't beleive there is anything in 4.0 that is going
to cause such quick loss of permgen. Can you create a
self contained example that illustrates this behaviour?
So we can reproduce this?

Mark

s erel wrote:

We've tried to increase the permGen to 256mb. It did
not help and the space run out really fast.
Regarding MVEL, is turning code generation
off something that can (or will) be done with a
configuration parameter/factory method or do I need to
track down all the places in the code?
 
We did not experience such memory behavior with the

previous version we used (3.06) when running the same
tests.
Bugs in 3.06 (no longer present in 4M3) are forcing us
to upgrade.
 
Is there another reason for such behaviour?

Should we wait for release candidate?

 
On 7/4/07, *Mark Proctor* <[EMAIL PROTECTED]

> wrote:

increase your perm gen space,or use the MVEL
dialect with code generation off.


Mark
s erel wrote:

Hello,
 
During capacity tests we've received permGen OOM

exception. The occupied space in the permGen area
increases rapidly. Any opinions?


On 7/3/07, *s erel* <[EMAIL PROTECTED]
> wrote:

In our project we are creating a
StatefulRuleSession and saving it in a
per-thread context (i.e. Each thread has it's
own St

Re: [rules-users] Help with MR3

2007-07-05 Thread s erel

Please let me know if the permGen issue can be fixed somehow.
Thanks


On 7/5/07, Mark Proctor <[EMAIL PROTECTED]> wrote:


actually, yes you are right - that was indeed the problem. That iterator
is normally only used by the working memory, which is single threaded, but
in this case its on the rulebase, which is not suppose to hold state. I'll
fix this now,  well found :)

Mark
s erel wrote:

Do you know if the fix I mentioned (returning a new iterator each time)
solves the problem or only mask it?
We create the initial RuleBase on server start-up.

On 7/4/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
>
> actually I thought i tracked it down, was wrong. Anyway once the
> RuleBase is built the "ObjectHashMap objectTypeNodes" in Rete should not
> changeOnly I things I can think of are:
> 1) Some how a thread is seeing a stale version of the map
> 2) the rulebase is getting updated while propagation is happening, maybe
> combine with an issue from 1. In reality the rulebase addition should obey
> the standard locking mechanism and stop this from happening.
> 3) The initial RuleBase hasn't finished building yet, and threads are
> already being spun off to assert data.
>
> I have a feeling its 3...
>
> Mark
> Mark Proctor wrote:
>
> ok, that might be it. We generate code in a singleton classloader, I
> suspect that each thread is generating its' own getters. I suspect that
> created singleton classloader is not getting GCd and releasing the perm gen.
> I'm not sure how to fix this. You can check this yourself by attaching a
> jprofiler instance (available for free trial) and looking at the object
> counts.
>
> I've tracked down the concurrency issue. The Rete node has a HashMap of
> ObjectTypeNodes that is built on the fly, that was global to the rulebase.
> I'll have to make it local to the working Memory. I'll fix that today.
>
> Mark
> s erel wrote:
>
> Our server creates hundreds of stateful rule sessions concurrently. Each
> created rule seesion is specific to a thread. We did not encounter
> any memory problems with the previous version. As I've said,
> it's difficult (actually, impossible) for me to provide you with a self
> contained example
> since the drl is complicated and contains dozens of complex objects.
> However, I am ready to provide you with any information that can help
> us in that manner.
> I've also mentioned in the earlier threads the concurrency problem I've
> encountered with AbstractHashTable.
> Can this has something to do with it?
>
>
> On 7/4/07, Mark Proctor <[EMAIL PROTECTED] > wrote:
> >
> > I don't beleive there is anything in 4.0 that is going to cause such
> > quick loss of permgen. Can you create a self contained example that
> > illustrates this behaviour? So we can reproduce this?
> >
> > Mark
> > s erel wrote:
> >
> > We've tried to increase the permGen to 256mb. It did not help and the
> > space run out really fast.
> > Regarding MVEL, is turning code generation off something that can (or
> > will) be done with a configuration parameter/factory method or do I need to
> > track down all the places in the code?
> >
> > We did not experience such memory behavior with the previous version
> > we used (3.06) when running the same tests.
> > Bugs in 3.06 (no longer present in 4M3) are forcing us to upgrade.
> >
> > Is there another reason for such behaviour?
> > Should we wait for release candidate?
> >
> >
> > On 7/4/07, Mark Proctor <[EMAIL PROTECTED] > wrote:
> > >
> > > increase your perm gen space,or use the MVEL dialect with code
> > > generation off.
> > >
> > > Mark
> > > s erel wrote:
> > >
> > > Hello,
> > >
> > > During capacity tests we've received permGen OOM exception. The
> > > occupied space in the permGen area increases rapidly. Any opinions?
> > >
> > >
> > > On 7/3/07, s erel <[EMAIL PROTECTED]> wrote:
> > > >
> > > > In our project we are creating a StatefulRuleSession and saving it
> > > > in a per-thread context (i.e. Each thread has it's own
> > > > StatefulRuleSession):
> > > >
> > > > ruleServiceProvider.getRuleRuntime().createRuleSession(contextName,
> > > > properties, RuleRuntime.STATEFUL_SESSION_TYPE);
> > > >
> > > > When a thread session ends, we are calling release on the
> > > > previously created StatefulRuleSession.
> > > >
> > > >
> > > > Changing the following lines:
> > > >
> > > >
> > > > public abstract class AbstractHashTable
> > > >
> > > >
> > > > ...
> > > >
> > > > public Iterator iterator() {
> > > > //if ( this.iterator == null ) {
> > > > //this.iterator = new HashTableIterator( this );
> > > > //}
> > > > //
> > > > //this.iterator.reset();
> > > > //return this.iterator;
> > > >
> > > > HashTableIterator iterator = new HashTableIterator(this);
> > > > iterator.reset();
> > > >
> > > > return iterator;
> > > > }
> > > > Seems to solve the problem I've encountered. What's your opinion?
> > > >
> > > >
> > > >  On 7/2/07, Mark Proctor <[EMAIL PROTECTED

Re: [rules-users] Running Drools on Sun Portal Server 7

2007-07-05 Thread Mark Proctor

if someone has a fix for this, please open a jira and attach.

Mark
Tom Finlayson wrote:

Folks,

I'm having an issue running Drools 3.0.5 on Sun Portal Server 7. When 
our rules are loaded and compiled, they come back as being invalid. 
Debugging reveals this is because the consequence is null. As such, 
addRule in AbstractRuleBase throws the following exception:


java.lang.IllegalArgumentException: The rule called Test Rule is not 
valid. Check for compile errors reported.


This is very similar to a previously reported issue however all our 
rules work fine under Eclipse when running JUnit. Additionally they 
have been successfully run when deployed as a servlet to Sun 
Application Server 8.1. This suggests the problem is due to 
classloading issues in the Portal environment.


Has anyone else experienced this issue or can suggest a fix?

Cheers,

Tom Finlayson



___
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] Problem with update(fact)

2007-07-05 Thread Chris Woodrow

Hi,
This doesn't seem to be a bug, IMHO, since no-loop is supposed (according to
the doc). In this case, factA is called once (thanks to "no-loop", than
fact2 is called once, and so on. Do you mean no-loop should still be on if
it has been used once for a given rule?

Chris

2007/7/3, Felipe Piccolini <[EMAIL PROTECTED]>:


I know I already asked this in a previous email, but no answer and
diferent subject... so I'll ask again

I have an issue using update in 2 rules that update the same object... a
loop is created even when I try to
avoid the loop adding an extra condition to each rule... Im inserting an
ArrayList as a fact too, so I can check
the extra condition...

Can anyone tell me how to fix this?

Consider this:
//---RULES-
package cl.bluesoft.test

#list any import classes here.
import java.util.List
import java.util.ArrayList

import cl.bluesoft.test.rules.Fact

#declare any global variables here

rule "test update A"
salience 699
no-loop
when
 $f : Fact($n: number > 0)
 $list: ArrayList( this excludes "key1")
then
 System.out.println("A-fact number1:"+$f.getNumber()+" list 1:"+$list);
 $list.add("key1");
 $f.setNumber($n + 1);
 update ($f);
 update ($list);
 System.out.println("A-fact number2:"+$f.getNumber()+" list 2:"+$list);
end


rule "test update B"
salience 699
no-loop
when
 $f : Fact($n: number > 1)
 $list: ArrayList( this excludes "key2")
then
 System.out.println("B-fact number1:"+$f.getNumber()+" list 1:"+$list);
 $list.add("key2");
 $f.setNumber($n + 1);
 update ($f);
 update ($list);
 System.out.println("B-fact number2:"+$f.getNumber()+" list 2:"+$list);
end

//---FACT-
public class Fact implements Serializable {
private static final long serialVersionUID = 331627137981862975L;

private int number;

public Fact(int number){
 this.number = number;
}

public Fact(){
 this(0);
}

/**
 * @return the number
 */
public int getNumber() {
 return number;
}

/**
 * @param number the number to set
 */
public void setNumber(int number) {
 this.number = number;
}

}

//--TEST-
public class TestUpdateFact implements Serializable {

private static final long serialVersionUID = -574789596641083743L;

/**
 * @param args
 */
public static void main(String[] args) {
 RuleBase ruleBase = RuleBaseFactory.newRuleBase();
 Package pkg = builder.getPackage();
 
 WorkingMemory session = ruleBase.getStatefulSession();
 ...etc etc...

 List list = new ArrayList();


 Fact fact1 = new Fact(1);

 session.fireAllRules();

 etc, etc...


}

}

//OUTPUT
A-fact number1:1 list 1:[]
A-fact number2:2 list 2:[key1]
B-fact number1:2 list 1:[key1]
B-fact number2:3 list 2:[key1, key2]
A-fact number1:3 list 1:[key1, key2]
A-fact number2:4 list 2:[key1, key2, key1]
B-fact number1:4 list 1:[key1, key2, key1]
B-fact number2:5 list 2:[key1, key2, key1, key2]
A-fact number1:5 list 1:[key1, key2, key1, key2]
A-fact number2:6 list 2:[key1, key2, key1, key2, key1]
B-fact number1:6 list 1:[key1, key2, key1, key2, key1]
B-fact number2:7 list 2:[key1, key2, key1, key2, key1, key2]
A-fact number1:7 list 1:[key1, key2, key1, key2, key1, key2]
A-fact number2:8 list 2:[key1, key2, key1, key2, key1, key2, key1]
B-fact number1:8 list 1:[key1, key2, key1, key2, key1, key2, key1]

 for ever.

So I have a loop... only when I use update and both rules...  condition
about the
list not containing "key1" and "key2" seems not properly chequed... I dont
know...

Can somebody help me? Am I missing something here?

Thanks.

*Felipe
Piccolini M.*
[EMAIL PROTECTED]





___
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


[rules-users] Running Drools on Sun Portal Server 7

2007-07-05 Thread Tom Finlayson

Folks,

I'm having an issue running Drools 3.0.5 on Sun Portal Server 7. When our
rules are loaded and compiled, they come back as being invalid. Debugging
reveals this is because the consequence is null. As such, addRule in
AbstractRuleBase throws the following exception:

java.lang.IllegalArgumentException: The rule called Test Rule is not valid.
Check for compile errors reported.

This is very similar to a previously reported issue however all our rules
work fine under Eclipse when running JUnit. Additionally they have been
successfully run when deployed as a servlet to Sun Application Server 8.1.
This suggests the problem is due to classloading issues in the Portal
environment.

Has anyone else experienced this issue or can suggest a fix?

Cheers,

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


[rules-users] data base scheme

2007-07-05 Thread hypnosat7

In the great article below :
http://legacy.drools.codehaus.org/Loading+and+managing+rules+dynamically+from+a+database

1) Is the data base scheme suggested  the best choice for the Drools 4, or
is there any optimization to add ?
2) If it's the best practice, so how can we link this to the rule repository
implemented in Drools 4 ?

Thanks
-- 
View this message in context: 
http://www.nabble.com/data-base-scheme-tf4028590.html#a11443268
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