Can somebody help me with this rule engine execution
by Venkat
I want to do this.
rule
when
condition (when condition is successful then go to next rule, but when
it fails it should just log it)
then
end
I have done for successful scenario using activation-group, but don't know
what to specify in the consequence for that to tell to go to next rule.
How can I log it when the rule fails, it should not go to anymore rules, it
should just break from the rule engine.
Can somebody let me know how to do this.
Thanks,
--
View this message in context: http://drools.46999.n3.nabble.com/Can-somebody-help-me-with-this-rule-eng...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Bug in "enabled" rule attribute???
by bdolbeare
The following DRL produces a Null Pointer Exception when the "enabled"
attribute is set to false on "test rule 2". Any ideas why? Changing this
value to true or commenting out the rule causes things to succeed.
Environment: Java 7 and Drools 5.4
package tests
import org.apache.log4j.Logger;
import java.util.List;
global Logger log
declare Data
name : String
end
rule "insert Data"
when
then
insert(new Data("test"));
end
rule "test rule 2"
enabled false
when
d : List() from collect (Data( name == "test") )
then
log.info(String.format("%s hit on %s", kcontext.getRule().getName(), d));
end
Exception executing consequence for rule "insert Data" in tests:
java.lang.NullPointerException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1283)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1209)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1442)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:278)
at tests.DroolsTest.testStateless(DroolsTest.java:98)
at tests.DroolsTest.runTest(DroolsTest.java:60)
at tests.DroolsTest.main(DroolsTest.java:45)
Caused by: java.lang.NullPointerException
at org.drools.common.DefaultAgenda.createActivation(DefaultAgenda.java:569)
at
org.drools.reteoo.RuleTerminalNode.modifyLeftTuple(RuleTerminalNode.java:297)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:259)
at
org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:676)
at
org.drools.reteoo.ReteooWorkingMemory$EvaluateResultConstraints.execute(ReteooWorkingMemory.java:591)
at
org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:345)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:342)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)
at
org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:187)
at
org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:181)
at
tests.Rule_insert_Data_2eb7a40b15e640d6bc777e1075d1218b.defaultConsequence(Rule_insert_Data_2eb7a40b15e640d6bc777e1075d1218b.java:7)
at
tests.Rule_insert_Data_2eb7a40b15e640d6bc777e1075d1218bDefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at
tests.Rule_insert_Data_2eb7a40b15e640d6bc777e1075d1218bDefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1273)
--
View this message in context: http://drools.46999.n3.nabble.com/Bug-in-enabled-rule-attribute-tp4019049...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Matching consecutive events
by jpullmann
Dear contributors,
this rule is expected to match a sequence of 2 consecutive events:
rule "test"
when
// a)
$ev1 : LocalizationEvent( type == TYPE.HINT, $target : target )
from entry-point "events/localization"
$ev2 : LocalizationEvent( type == TYPE.HINT, target == $target, this
after $ev1 ) from entry-point "events/localization"
// b)
// Ev1 directly followed by ev2: no other HINT in between
not( LocalizationEvent( type == TYPE.HINT, target == $target, this
after $ev1, this before $ev2 ) from entry-point "events/localization" )
then
do()
end
The second event is interpreted as a "confirmation" of the first event (a).
No other (deviating) event is allowed between them (b). With this
restriction
in place, the rule requires a sequence of 3 input events for activation,
otherwise
2 events are sufficient (as expected). The events are ordered correctly and
it is
not obvious, why a third event is needed since the interval between ev1 and
ev2 is
closed ? This leads to an unnecessary delay in rule activation.. How could
this be
avoided and are there other approaches to match a concrete event sequence
pattern ?
Many thanks
Jaro
--
View this message in context: http://drools.46999.n3.nabble.com/Matching-consecutive-events-tp4018980.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
ResourceChangeScanner and ResourceChangeNotifierImpl - hundereds of threads
by paulB
Hi all,
I've run into a memory issue when using Drools, and I was hoping someone
could help out.
I have a project that uses StatefulKnowledgeSession's, and every couple of
weeks I get OutOfMemory from the JVM. I've done heap dumps and analyzed the
dominator_tree, etc. No luck yet in identifying the culprit.
However, I did notice that I have hundreds of the following threads (shown
below) for .ResourceChangeNotifierImpl$ProcessChangeSet and
ResourceChangeScannerImpl$ProcessChangeSet. The thread count increases
every time a new session is created (and maybe every time a rule is
evaluated??). This seems kind of odd to me. I'm using drool-spring to
instantiate the kbase, kagent, and resource-change-scanner.
My spring configuration is as follows, using v1.5 of the xsd under Drools
5.4.0.Final and jBPM 5.3.0.Final:
Thank you for any ideas.
--
View this message in context: http://drools.46999.n3.nabble.com/ResourceChangeScanner-and-ResourceChang...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Error in Drools when clicking "Generate Task Form Template"
by Sadiroveski
Dear helpers,
I designed process in drools with human tasks included, add the variables,
inputsets and bindings.
When I clicked on the "Generate Task Form Templates", to add forms I got the
following:
----------------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
java.lang.ArrayIndexOutOfBoundsException: 1
org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.applyTaskProperties(Bpmn2JsonUnmarshaller.java:3482)
org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.applyProperties(Bpmn2JsonUnmarshaller.java:1921)
org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.unmarshallItem(Bpmn2JsonUnmarshaller.java:1645)
org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.unmarshallItem(Bpmn2JsonUnmarshaller.java:1560)
org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.unmarshall(Bpmn2JsonUnmarshaller.java:225)
org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.unmarshall(Bpmn2JsonUnmarshaller.java:201)
org.jbpm.designer.web.server.TaskFormsServlet.doPost(TaskFormsServlet.java:73)
javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
org.jbpm.designer.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:70)
note The full stack trace of the root cause is available in the JBoss
Web/7.0.1.Final logs.
-------------------------------------------------------------------------------------------
Any help please,
--
View this message in context: http://drools.46999.n3.nabble.com/Error-in-Drools-when-clicking-Generate-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Apply role to whole class hierarchy
by Joerg Henne
Hi all,
we are processing events through a Fusion rule base. To be recognized as
such, model classes must be declared as @role(event). We are using a rather
extensive hierarchy of events, all derived from a single abstract class.
Unfortunately, it doesn't seem to be possible to declare just this base
class as an event and have the 'event' role for the others derived from
that.
Is there a way around having to declare each and every single event class
separately?
Thanks
Joerg
--
View this message in context: http://drools.46999.n3.nabble.com/Apply-role-to-whole-class-hierarchy-tp4...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Re: [rules-users] [Planner] Train routing problem
by ge0ffrey
Take a look at the VRP example too: it's basically the TSP example, but with
multiple vehicles.
1) It depends, but I would add a hard constraint for this. Once 5.5.0.Final
is out, you might use move Filtering instead, so it doesn't even evaluate
those solutions (but that also blocks it from tunneling through an
infeasible solution to a new, better feasible solution, so that filtering
might be a bad thing).
2) The bigger problem is that in this design you'll be assigning an order of
StopTimes, but your goal is not to assign the StopTimes, but to assign a
trainride (from start A to destination B) to a route (through StopTimes).
The number of StopTimes depends on the route taken. This greatly influences
the design. There isn't a good example out of the box in Planner for this,
but Lukas has such a case working well for RAS2012 with Planner, which I am
hoping he'll open up after 15th August.
Note: the answer on 2) makes the answer on 1) obsolete.
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-Train-routing-problem-tp4018955...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Comparison operation requires compatible types when using Date literal inside nested OR
by Eric Martineau
I'm new to drools, so hopefully I can post enough information to get some help. We are running Drools 5.3.3.Final (though we've seen the same issue with 5.4.0.Final and 5.3.0.Final)
I'm trying to test some rules created in drl format. Here's an example of a drl that executes fine – it checks a birthday field against a date literal:
------------------------------------------
package drools.rules.funnelid.two
import com.infusionsoft.bpm.services.TestRuleFact;
rule "Test Rule"
dialect "java"
when
$testRuleFact : TestRuleFact( ( contactable.contact.birthday < "29-Dec-1977" ) )
then
$testRuleFact.setTrue( );
end
-------------------------------------------
However, this drl fails compilation with the following error:
package drools.rules.funnelid.two
import com.infusionsoft.bpm.services.TestRuleFact;
rule "Test Rule"
dialect "java"
when
$testRuleFact : TestRuleFact( ( contactable.contact.title str[equals] "Owner" && contactable.contact.birthday < "01-Jan-1980" ) || ( contactable.contact.country str[equals] "USA" && contactable.contact.leadSourceIdOverride == "12" ) )
then
$testRuleFact.setTrue( );
End
------------------------------------------
Here's the error I get:
DRL contains errors, no actions will be processed: Unable to Analyse Expression str0.evaluate( contactable.contact.title, "Owner" ) && contactable.contact.birthday < "01-Jan-1980" || str1.evaluate( contactable.contact.country, "USA" ) && contactable.contact.leadSourceIdOverride == "12":
[Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
[Near : {... ) && contactable.contact.leadSourceIdOverride == "12" ....}]
^
[Line: 8, Column: 32] : [Rule name='Test Rule']
Some things that cause the error to go away:
* Removing the offending clause: contactable.contact.birthday < "01-Jan-1980"
* Changing the || to an &&
I'm at a loss and would love some help. Even if I knew which class was raising the exception would help, but I can't seem to find it anywhere.
Thanks,
Eric
13 years, 8 months
Question with Persisting Knowledge Sessions Then Upgrading Drools
by Darin Wilcox
I have been working on persisting knowledge sessions to an H2 database that
are used for long running processes. The question I have is surrounding
the following description:
- - A stateful knowledge session is created using the
JPAKnowledgeService and persisted to a database.
- - A process is started within the knowledge session.
- - The process contains a human task blocking the completion of the
process.
Because the stateful nature of the knowledge session, an instance of the
process is inserted into the processinstanceinfo table and an instance of
the human task is inserted into the task table. State is therefore
maintained until the human task is completed and the process can continue
execution.
While the knowledge session, process and human task are awaiting
completion, is it possible to upgrade the version of Drools/jBPM being
used? Will the upgrade effect the de-serialization of the objects from the
database or will they be able to be retrieved and used as before? Is there
a best practice for accomplishing upgrading drools versions with knowledge
sessions that may have been previously existing?
Thanks,
- Darin
13 years, 8 months
Drools with Gemfire
by rtella
I'm looking into integrating Drools with a system that has large (40GB+)
Gemfire Maps. The rules would need to access the Gemfire Maps, which can be
updated at any time. I understand I can't access the Gemfire Maps as
global data since they aren't immutable. Inserting the maps also doesn't
seem like a good idea either since I'd have to call modify() frequently on
Maps with as many as 1M elements. Is there any alternative for accessing
large amounts of changing data?
thanks for your help,
Rich
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-with-Gemfire-tp4019026.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months