How can I write a rule that will only fire once for every object in the working memory
by Waruzjan Shahbazian
Hallo,
I was wondering if it's possible to create a rule that can only be
activated once. So if at a certain point the LHS is matching, it will be
fired and deactivated immediately, so the rule never ever gets fired for
the object it has updated, no matter if the LHS will matches after a few
updates()'s at a later time.
The only way I can achieve this, is by manually evaluating in the LHS if
the certain object has the certain values I am gonna set in the RHS, so
if it has, I don't fire the rule. But this takes some unnessery time and
I was wondering if it couldn't be more easier/faster.
Example:
----------------------------------------------------
$product : Product(title matches "(?i).*SOMEWORD.*", $productClasses :
productClasses)
$activated : Boolean(booleanValue == false)
from accumulate($productClass : ProductClass(
schema.code == "DROOLS", code == "012345" ) from $productClasses,
init(boolean activated = false;),
action( activated = true;),
result( activated ) )
then
Set the schema and code of the product
update($product)
----------------------------------------------------
So in the example above I am actually iterating over all the
productClasses of the product and checking if they have the right codes.
If I actually could just fire the rule on all the products
whose title matches "(?i).*SOMEWORD.*", and deactivate the rule for the
instance of the $product, I wouldn't have to accumulate over the list of
productClasses of the product to see if the rule
was fired before for this particulare product.
The "no-loop" attribute doesn't work here, because it gets ignored when
another rule updates the product. So when this rule has fired, and
updated the product, some other rule gets activated and updates the
product, and than this rule gets fired, because the LHS still matches.
Any help is welcome,
Waruzjan
16 years, 11 months
BRMS locks jackrabbit
by safi
Hi,
we are trying to use Drools as a business rules engine and we have
encountered some difficulties. First of all when we log into BRMS, the
jackrabbit session is created and JCR is locked. This seems to be natural
and of course it is correct but we need to communicate with repository from
other applications which is not possible due to locking. Do you have any
idea how to simply solve it?
We have tried to sign out from the BRMS but is does not seem to work (to
unlock the JCR). The solution could be to use jackrabbit in model 2 or 3,
but we could not find any instructions how to configure BRMS to use these
models. There is a configuration file components.xml in the BRMS WEB-INF
folder which is used for configuring the repository, so is there any
property or anything which could be used for configuring BRMS to use a JNDI
to access the repository?
>From our point of view it seems that we will have to implement
JCRRepositoryConfigurator and set <property
name="configurator">outRepositoryConfigurator</property> into the
components.xml. Is it right?
We are using Drools 4.0.3 and we deploy BRMS to Glassfigh V2 b58g.
Thank you for your answers.
Safi
--
View this message in context: http://www.nabble.com/BRMS-locks-jackrabbit-tp15018752p15018752.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 11 months
package deserialize improvements
by jack wu
i remember seeing some one mentioning org.drools.rule.Package serialization is slow and there are some improvement code coming in. is that code already in the code base? thanks.
jack.
---------------------------------
Never miss a thing. Make Yahoo your homepage.
16 years, 11 months
can i reuse rulebase
by jack wu
my profiler shows that it takes the same amount of time to do:
final RuleBase ruleBase = RuleBaseFactory.newRuleBase( RuleBase.RETEOO, conf );
as to do:
session.executeWithResults();
i am wondering if i can cache the ruleBase and do addPackage() and removePackage() for each executeWithResults().
the ducmentation says always create a new ruleBase. so i am kind of confused. thanks for the help.
thanks.
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
16 years, 11 months
How to fire just one rule in a .drl.
by Christie, Blair
I am trying to set up a set of unit tests for the set of rules in a
.drl file.
How can you fire just one rule in a .drl packaqe.
Cheers,
Blair
16 years, 11 months
Drools low concurrency/high synchronization? !NOSIG!
by Ingomar Otter
Folks,
I am currently trying to scale our implementation by farming out
request into mutliple threads. I am on a 4 CPU Mac.
A few things I am wondering about:
1. Although I see an increase in CPU load when going from single to
multi-threaded processing the throughput increased marginally. I am
pretty sure that my measurements are correct. I have checked the GC
and this is not the source of congestion. My question here is whether
Drools is using lot's of synchronization that may explain this.
2. When I share the RuleBase accross threads (which I think is valid?)
I get interesting errors during execution. eg:
org.drools.RuntimeDroolsException: Exception executing predicate
org.drools.base.mvel.MVELPredicateExpression@bb981e
at
org
.drools
.rule
.PredicateConstraint.isAllowedCachedRight(PredicateConstraint.java:246)
at
org
.drools
.common
.TripleBetaConstraints.isAllowedCachedRight(TripleBetaConstraints.java:
200)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:150)
at
org
.drools
.reteoo
.CompositeObjectSinkAdapter
.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:
153)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:
192)
at
org
.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at
org
.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:
909)
at
org
.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:
881)
at
org
.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:
682)
at xxxx.DroolsPD.validate(DroolsPD.java:66)
at xxxx.DroolsMTRunner.run(DroolsMTRunner.java:30)
at java.lang.Thread.run(Thread.java:552)
Caused by: org.mvel.CompileException: cannot invoke getter: getSAClass
[declr.class: xxx.AbstractSA; act.class: null]
at
org
.mvel.optimizers.impl.refl.GetterAccessor.getValue(GetterAccessor.java:
52)
at
org
.mvel
.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:
39)
at
org
.mvel
.ast
.VariableDeepPropertyNode
.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
at
org
.mvel
.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
at
org
.mvel
.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at
org
.drools
.base
.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)
at
org
.drools
.rule
.PredicateConstraint.isAllowedCachedRight(PredicateConstraint.java:240)
... 13 more
Caused by: java.lang.NullPointerException
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org
.mvel.optimizers.impl.refl.GetterAccessor.getValue(GetterAccessor.java:
42)
... 22 more
Details:
* I use StatelessSessions which are private to the threads
* No data is shared between threads (with the exception of the
RuleBase, as outline above)
* I am on JDK 1.5
I would be grateful for any pointers for 'correct' use of Drools in an
MT environment.
Cheers,
Ingomar
--
Ingomar Otter
Chief Technology Officer
mailto:ingomar.otter@valtech.de
Mobile: +49 172 2367867
Valtech GmbH
Bahnstraße 16
40212 Düsseldorf
Germany
Phone: +49 (0)211 179237-0
Fax: +49 211 179237-19
http://www.valtech.de
Geschäftsführer: Ingo Kriescher
Amtsgericht Düsseldorf HRB48672
16 years, 11 months
RE: [rules-users] java.lang.OutOfMemoryError: Java heap space onDrools 4.0.4
by Shiva Shankar Reddy Katula
I have allocated 2 GB memory to application server ....
More over when I am running the same using the previous version jars
i.e., 3.0.x drools I never get this...
Thanks,
Shiva
Tel: +91-40-27782000 Ext: 4259
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of
Christopher.Mathrusse(a)sybase.com
Sent: Tuesday, January 22, 2008 12:43 PM
To: Rules Users List
Subject: Re: [rules-users] java.lang.OutOfMemoryError: Java heap space
onDrools 4.0.4
Allocate more memory for the JVM when starting the application/server.
As an example, pass the following in to the JVM on startup:
-Xms128m -Xmx256m
By default, the JVM only allocate 64M of memory. You simply need to tell
the JVM to allocate more.
"Shiva Shankar Reddy Katula" <shivashankar.k(a)sonata-software.com>
Sent by: rules-users-bounces(a)lists.jboss.org
01/21/2008 10:38 PM
Please respond to
Rules Users List <rules-users(a)lists.jboss.org>
To
"Rules Users List" <rules-users(a)lists.jboss.org>
cc
Subject
[rules-users] java.lang.OutOfMemoryError: Java heap space on Drools
4.0.4
Hi,
I am getting the following outofmemory error after upgrading from 3.0.x
to 4.0.4.
I use to never get this error before.
I don't think this is because of system memory issue.
I have 8 GB RAM Linux Machine with JBOSS Server.
Do anybody have this issue if so what is the resolution.
22:22:38,177 ERROR [STDERR] Exception in thread "Timer-354"
22:22:38,177 ERROR [STDERR] java.lang.OutOfMemoryError: Java heap space
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding.trim(StringCoding.java:64)
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding.access$400(StringCoding.java:37)
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding$CharsetSE.encode(StringCoding.java:353)
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding.encode(StringCoding.java:378)
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding.encode(StringCoding.java:384)
22:22:38,177 ERROR [STDERR] at
java.lang.String.getBytes(String.java:829)
22:22:38,183 ERROR [STDERR] at
org.drools.rule.builder.dialect.java.JavaDialect.addClassCompileTask(Jav
aDialect.java:472)22:22:38,183 ERROR [STDERR] at
org.drools.rule.builder.dialect.java.JavaDialect.addFunction(JavaDialect
.java:442)
22:22:38,183 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addFunction(PackageBuilder.java:406)
22:22:38,183 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:289)
22:22:38,183 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
:167)
Thanks,
Shiva
Tel: +91-40-27782000 Ext:
4259_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
16 years, 11 months
java.lang.OutOfMemoryError: Java heap space on Drools 4.0.4
by Shiva Shankar Reddy Katula
Hi,
I am getting the following outofmemory error after upgrading from 3.0.x
to 4.0.4.
I use to never get this error before.
I don't think this is because of system memory issue.
I have 8 GB RAM Linux Machine with JBOSS Server.
Do anybody have this issue if so what is the resolution.
22:22:38,177 ERROR [STDERR] Exception in thread "Timer-354"
22:22:38,177 ERROR [STDERR] java.lang.OutOfMemoryError: Java heap space
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding.trim(StringCoding.java:64)
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding.access$400(StringCoding.java:37)
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding$CharsetSE.encode(StringCoding.java:353)
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding.encode(StringCoding.java:378)
22:22:38,177 ERROR [STDERR] at
java.lang.StringCoding.encode(StringCoding.java:384)
22:22:38,177 ERROR [STDERR] at
java.lang.String.getBytes(String.java:829)
22:22:38,183 ERROR [STDERR] at
org.drools.rule.builder.dialect.java.JavaDialect.addClassCompileTask(Jav
aDialect.java:472)22:22:38,183 ERROR [STDERR] at
org.drools.rule.builder.dialect.java.JavaDialect.addFunction(JavaDialect
.java:442)
22:22:38,183 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addFunction(PackageBuilder.java:406)
22:22:38,183 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:289)
22:22:38,183 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
:167)
Thanks,
Shiva
Tel: +91-40-27782000 Ext: 4259
16 years, 11 months