Few rules, many facts
by Yuri de Wit
I am working on a drools application with few rules and large number
of facts. In my first design I tried to avoid excessive joins thinking
I was helping improve performance but didnt realized that I was
actually shooting myself in the foot. I was basically creating a
single facade-fact that would contain two or three diff concerns
joined under the same interface. The problem I am seeing is that for
simple things like changing the status of one of many facts would
cause that fact to be reevaluated against all the other facts.
I then realized that thinking relationally about the problem would not
only simplify my solution but also probably make a lot faster.
However, in this new and relational solution I will need to make use
of many "not" CE.
My question is: is there any cost in using "not"s that I should be
awae of? Any other words of wisdom re: improving the performance in
small rules x many facts?
thanks,
-- yuri
18 years, 5 months
Rules question
by Yuri de Wit
Is it possible to do something like this with Drools 4.0?
rule
when
p:Parent()
not Child( this in p.children )
then
...
end
I basically dont want to keep a reference fro Child to Parent.
thanks,
18 years, 5 months
Issue with not Fact equality checks?
by Eric Miles
I have a single rule in my test bed as such:
rule "5th Item Not Test"
when
$first : FirstClass($i1 : item1, $i2 : item2, $i3 : item3, $i4 :
item4, $i5 : item5)
not SecondClass(item1 == $i1, item2 == $i2, item3 == $i3, item4 ==
$i4, item5 == $i5)
then
System.out.println("NOT test matched");
end
In the not SecondClass() section of the test, the last equality checks
always fail, no matter what it is. I can switch the order around of the
checks, no matter what the last 2 are, they cause THEN clause to not
fire, even when I am absolutely positive there is not a match. (I can
remove the not and the equality works fine). Is there a limit on the
number of equality tests I can do with a not? It seems as though it is
4. I have attached a test case that can reproduce this (it is different
from my project's code, but I have been able to reproduce this in
multiple projects). It is a maven Eclipse project and includes a junit
with some minor instructions. If these instructions do not make sense,
please email me.
18 years, 5 months
JBossRules and JAVA Servlet / JSP (part2)
by Mohammed JBossRules
2007/7/20, Mohammed JBossRules <jboss.lakehayli(a)gmail.com>:
>
> Hi,
> an other question , when i'm trying to execute the same code in the sample
> test java file provided by the wizard, I get some other errors :
>
> java.lang.NoClassDefFoundError: org/drools/WorkingMemory
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
> at java.lang.Class.getConstructor0(Unknown Source)
> at java.lang.Class.newInstance0 (Unknown Source)
> at java.lang.Class.newInstance(Unknown Source)
> at org.apache.catalina.core.StandardWrapper.loadServlet(
> StandardWrapper.java:1104)
> at org.apache.catalina.core.StandardWrapper.allocate(
> StandardWrapper.java:806)
> at org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:129)
> at org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:175)
> at org.apache.catalina.core.StandardHostValve.invoke(
> StandardHostValve.java:128)
> at org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:104)
> at org.apache.catalina.core.StandardEngineValve.invoke (
> StandardEngineValve.java:109)
> at org.apache.catalina.connector.CoyoteAdapter.service(
> CoyoteAdapter.java:261)
> at org.apache.coyote.http11.Http11Processor.process(
> Http11Processor.java:844)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process (
> Http11Protocol.java:581)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java
> :447)
> at java.lang.Thread.run(Unknown Source)
>
>
> it works fine if i'm using a simple class, but when i try to use my
> servlet, it falls;
>
> and finally, is it possible to contribute withe a tutorial showing how to
> set up drools on eclipse and running a DroolsTest sample file,(arabic,
> english and frensh version) that's all i can propose for the moment.
>
> thank you.
>
>
>
>
>
>
> 2007/7/20, Mohammed JBossRules <jboss.lakehayli(a)gmail.com>:
> >
> > hello,
> > Thank you all for your replays; as you've suggested, what i should
> > import into my build path was not the core and compiler but all the set
> > contained in the drools library, maybe that would help someone later!
> > here is the list of jars
> > antlr-runtime.jar
> > drools-compiler.jar
> > drools-core.jar
> > drools-decisiontables.jar
> > drools-documentation.jar
> > drools-jsr94.jar
> > jsr94.jar
> > junit.jar
> > jxl.jar
> > mvel14.jar
> > xercesImpl.jar
> > xml-apis.jar
> > xpp3.jar
> > xstream.jar
> > Thankyou Mark for the link
> > with kind regards,
> >
> > ps: tried many times to post this mail yesterday but seems that it
> > doesn't work, sorry if you received it more than once!
> > Mohammed JBossRules wrote:
> > > Hello,
> > >
> > > I'm a new user for JBossRules, and I'm feeling like turning around
> > > since a while, so i thought that sole body could help...
> > > I'm using JBossRules( V4.0.0.12865MR3) on eclipse (Version: 3.3.0Build
> > > id: I20070621-1340) on MS-Windows XP and Java(TM) SE Runtime
> > > Environment (build 1.6.0_01-b06)
> > > now the problem is how to use my rules (simple rules in a DRL file) in
> >
> > > a dynamic project based on JSP/Servlets...
> > > i've imported the compiler, the core, jsr94, decisiontable, and also
> > > the core 3.2.3 jars to my build path , but when i try to execute the
> > > same code i'm having errors like:
> > > The import org.drools cannot be resolved
> > > but i have imported the core!!
> > > what's wrong? help please
> > >
> > > regards
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users(a)lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> >
> >
>
18 years, 5 months
BRMS import
by Shepherd, Michael
Hi,
Can I import an existing set of JBoss rules (Drools 3) into BRMS?
Thanks,
Mike
18 years, 5 months
How to compare to Class type in LHS??
by Felipe Piccolini
Hi,
Im trying to compare a field to a Class type but when parsing I
get NPE and when I debug,
the constraint is a ReturnValueConstraint but the
restriction.getRequiredDeclarations()
return a Declaration[] array initializated, but empty, so I can't get
the declaration evaluated...
I needed because I'm working on a kind of parser for the rules for
analisys and testing... but using
the already parsed package.
Here is a pseudo rule for test...
rule "Test A"
when
$mf: MyFact(clazz == (SomeClass.class))
then
System.out.println("Test A: OK");
end
Actualy, the rule compiles (with the NPE output, not stackTrace, just
the java.lang.NullPointerException,
and it works fine.. I mean I get "Test A: OK" as output, but cant get
the SomeClass.class reference when I
look into the debugger.
Is this the right way to compare clases? if not, whats the right way?
(Im trying to not do == "SomeClass")
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
18 years, 5 months
assertObject gone
by Jean Safar
Hi,
I download 4.0.0.MR3 and the examples do not compile anymore. In essence and
surprisingly, they try to call assertObject on a stateful session but this
method is nowhere to be found anymore.
Regards,
Jean Safar
18 years, 5 months
Is this syntax correct?
by Shai Bentin
I need to fire a rule if I have more then one fact that has an endDate property from the last 24 months... is the follwoing correct?
rule "testing123"
when
olList: ArrayList(size > 1) from collect(CreditEventLocal(creditEventTypeVlId == "SOMETHING", $endDate: endDate -> ($endDate.after(DateUtils.addMonthsFromToday(-24)))))
then
System.out.println("eurika");
end
Anyhow, if it is then I get a NullPointerException which doesn't tell me what the problem is. It happens in building time of course:
I'm using drools4.0.0MR2
Exception in thread "main" java.lang.NullPointerException
at org.drools.rule.builder.dialect.java.JavaConsequenceBuilder.build(JavaConsequenceBuilder.java:53)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:65)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:353)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:233)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:157)
at com.emi.framework.antTasks.PackageRules.addPackages(PackageRules.java:227)
at com.emi.framework.antTasks.PackageRules.execute(PackageRules.java:143)
at com.emi.framework.antTasks.PackageRules.main(PackageRules.java:325)
18 years, 5 months