how to use only updated value in drools
by learner
I am having a drl file with 2 rules
The 1st rule updates a attribute, say updates attribute b to 10 based on
some condition.
The 2nd rule has a check for values with b not equal to 10. It logs error
for those values not equals to 10.
The b value gets updated to 10 in rule 1. However in the second rule it does
not use updated value and logs error.
Is there a way to use the updated b value in the 2nd rule. I tried using
modify but still the error gets logged.
--
View this message in context: http://drools.46999.n3.nabble.com/how-to-use-only-updated-value-in-drools...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 9 months
Re: [rules-users] NoClassDefFoundError: org/drools/lang/DRLLexer
by bharadwaj2012
kbuilder.add(
ResourceFactory.newClassPathResource("COBValidation.drl"),
ResourceType.DRL);
and have follwing dependenies
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow</artifactId>
<version>${jbpm-flow.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>knowledge-api</artifactId>
<version>${knowledge-api.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools-core.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools-compiler.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
<version>${antlr-runtime.version}</version>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
<version>${mvel2.version}</version>
</dependency>
--
View this message in context: http://drools.46999.n3.nabble.com/NoClassDefFoundError-org-drools-lang-DR...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 9 months
Drools Fusion: expiration
by Matteo Cusmai
Hi all,
i have noticed a strange behavior, but i am not sure that i depend on
drools or depend by my bad knowledge of it.
I am using drools fusion and i have a lot of classes with role event. I
have put them the expiration value to 5 minutes.
>From my understanding, if i use explicit expiration, as i do, when it pass
5 minutes and that event is out of scope of all my rules, that event is
deleted.
But, i noticed that the last event hasn't retracted after 5 minutes and
this behavior makes the system no stable, because it works differently
after some minutes.
If i don't use explicit expiration, the system seems to work fine, so i am
however happy, but i would like to understand the issue.
Thanks a lot,
Matteo.
13 years, 9 months
Time Sliding Window Question
by Bernhard Unger
Hello,
I am fairly new to Drools and tried my first steps with Drools Fusion and
was running into the following problem:
According to the Drools Fusion User Guide Version 5.4.0.Final on page 32 the
following pattern should work and select events in between the last 10
minutes:
...
StockTick() over window:time( 2m )
...
I tried the following example, simulating RHQ EventComposite Events with a
simple Junit test:
...
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(new ClassPathResource("rhqrules.drl", getClass()),
ResourceType.DRL);
KnowledgeBaseConfiguration config =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption(EventProcessingOption.STREAM);
nowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
KnowledgeSessionConfiguration conf =
KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
conf.setOption(ClockTypeOption.get("pseudo"));
ksession = kbase.newStatefulKnowledgeSession(conf, null);
...
inside the test method:
...
For-Loop inserts new Events and increases the pseudo clock in one minute
steps:
...
for (int i = 0; i < 100; i++) {
timestamp = clock.advanceTime(1, TimeUnit.MINUTES);
ksession.insert(new EventComposite("EventDetail" + i, resourceId,
"resourceName" + i, "resourceAncestry" + i, resourceTypeId,
eventId, severity, "sourceLocation" + i, timestamp));
}
...
ksession.fireAllRules();
...
The .drl definition should fire only events of the last 10 minutes, however
all inserted 100 events are fired:
declare EventComposite
@role( event )
end
rule "Rule1 events in between last 10 minutes"
when
$event : EventComposite() over window:time( 10m )
then
System.out.println("Event in between the last 10 minutes:: " + $event);
end
On the other hand this rule works as expected and selects only events older
than 10 minutes:
rule "Rule2 events not in between the last 10 minutes"
when
$eventA : EventComposite( )
not EventComposite( this.resourceId == $eventA.resourceId ) over
window:time( 10m )
then
System.out.println("Event not in between the last 10 minutes: " +
$eventA);
end
My question is:
What did I wrong in the definition of Rule-1, what is the correct statement
for finding the last 10 minutes events?
Background information:
I am doing some research on implementing using the drools framework inside
the RHQ framework for complex event processing. I would like to show that
this is possible and could be uses reasonable for RHQ event processing.
Any help is highly appreceated!
Thanks and kind regards
Bernhard
13 years, 9 months
Prevent saving the resource when using guvnorEditorObjRef, in case if validation fails.
by worldofprasanna
Hi All,
We have embedded the Guvnor decision table asset into our html page and
obtained the guvnorEditorObjRef to validate the new rule which is added. We
wrote our business logic within the function,
guvnorEditorObjRef.registerBeforeSaveAllButtonCallbackFunction()
And it works fine. But the problem is when we find the business validation
got failed, we couldn t stop the resource from saving. Check In dialog box
opens and we couldn t find a way to prevent it from saving.
Is there anyway to prevent the asset from Saving in case, if the validation
failed ?
Thanks,
Prasanna Venkataraman.
--
View this message in context: http://drools.46999.n3.nabble.com/Prevent-saving-the-resource-when-using-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 9 months