Fire Rule in Stateless Knowledge Session
by snehils
Hi,
I am new in Drools. I am using Drools version 5.1.0
My requirement is kind of request response, where I have to perform some
checks for the request and respond the result. Hence, I decided to go with
stateless knowledge session.
I have prepared .DRL file and it contains set of rules. When some request
receives I have to identify the rule(s) belongs to that request and then
fire the rule(s).
I am not able to figure out how to categories the rules request wise in DRL
file? Also, how to fire only those rules which belongs to the category.
For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are
rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs
to Rq2 and R4, R5 belongs to Rq3.
When some request receives only its belonging rules should be fired. For
example, on receiving of Rq2 only R3 should be fired.
Please provide me some code snipped or link.
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Sessio...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Problem with Banking Tutorial
by Stefan Schuster
Hello,
I have a problem with the banking tutorial number 3, which is part of the
examples of drools expert.
It simply adds some Numbers as facts, and retracts them in an increasing
order.
It is very short, therefore I post the whole Code:
BankingExample3.java
_________________________________________________
package org.drools.tutorials.banking;
public class BankingExample3 {
public static void main(String[] args) {
Number[] numbers = new Number[] {wrap(3), wrap(1), wrap(4),
wrap(1), wrap(5)};
new RuleRunner().runRules( new String[] { "Example3.drl" },
numbers );
}
private static Integer wrap(int i) {
return new Integer(i);
}
}
_________________________________________________
Example3.drl:
_________________________________________________
package org.drools.tutorials.banking
rule "Rule 01"
when
$number : Number()
not Number( intValue < $number.intValue )
then
System.out.println("Number found with value: " + $number.intValue()
);
retract( $number );
end
_________________________________________________
Output:
_________________________________________________
Loading file: Example3.drl
Inserting fact: 3
Inserting fact: 1
Inserting fact: 4
Inserting fact: 1
Inserting fact: 5
Number found with value: 1
Number found with value: 1
Number found with value: 3
Number found with value: 4
Number found with value: 5
_________________________________________________
that seams absolute logically to me.
But now I alter the Numbers in the Java-Part:
Number[] numbers = new Number[] {wrap(3), wrap(1), wrap(2)};
and the output destroys everything I thought I understood:
Loading file: Example3.drl
Inserting fact: 3
Inserting fact: 1
Inserting fact: 2
Number found with value: 1
Number found with value: 3
Number found with value: 2
Can someone reproduce this behavior?? It seams absolutely strange to me. I
would have expected the order 1,2,3. Any explanations?
Thanks in advance for helping me!
12 years, 6 months
Guvnor: Accessing Bound Variable in "Then" Statement
by Vann_the_Red
Hello. I started with a search and didn't find an answer. I apologize if my
search-fu was lacking today.
I'm a non-developer tasked with rules creation and testing using guvnor. I
have found some scenarios where I can bind a variable to either the whole
input model or a fact in the input model and then later access those in the
output model by selecting "Bound Variable" from the popup box in the Then
statement. In other scenarios, "Bound Variable" is not an option (only
Literal or Formula). What must I do to be able to access the bound
variables from the When statement(s) in the Then statement(s)?
TIA,
Vann
This is a repost because I wasn't on the mailing list yet and I gather most
didn't see it. Apologies again.
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Accessing-Bound-Variable-in-Then...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Guvnor-5.5
by Ricardo
Is any one tried guvnor-5.5 in websphere application server?
What happen to the conponents.xml?
Why guvnor is tightly coupled with jbossAS even each version (jbossAS) got
separate war file?
this seems a big impediment for using guvnor as rule authoring tools.
Is one knows well aware these and already know how to deal this, please
advise me?
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-5-tp4022096.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
filtering object having max value
by mohan
Hi folks,
I want to filter object instance in WM when max value of an object field
(rental ) is less than X (reloadValue) . X will vary over time.
I tried to use below query but I couldn't get expected results. Could anyone
please help me?
Thanks.
--------------------------------------------
rule "Insuf-Balance-Reload Alert"
dialect "java"
when
$re : ReloadEvent($rechargeNum : rechargedNumber,$reloadVal :
reloadValue ) from entry-point "RELOAD-EVENT"
InsufBalFailFact(mobileNo == $rechargeNum,$reloadVal > rental, $pkgId :
pkgId,$rental : rental)
not InsufBalFailFact(mobileNo == $rechargeNum, rental > $rental)
then
System.out.println($rechargeNum+","+$pkgId +","+$rental);
end
--
View this message in context: http://drools.46999.n3.nabble.com/filtering-object-having-max-value-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Unable to resolve knowledgebase from classpath in JBoss 7 (VFS)
by dastraub
ClasspathKieProject isn't able to resolve knowledgebase from a JBoss 7
deployments :
17:34:02,419 INFO [stdout] (MSC service thread 1-5) kmodules:
vfs:/content/rtm-cep-impl.war/WEB-INF/classes/META-INF/kmodule.xml
17:34:39,089 ERROR
[org.drools.compiler.kie.builder.impl.ClasspathKieProject] (MSC service
thread 1-5) Unable to build index of kmodule.xml
url=vfs:/content/rtm-cep-impl.war/WEB-INF/classes/META-INF/kmodule.xml
null
To fix this (I have a presentation about a project prototype on monday ...),
I made the following changes:
After some NPE-Fixes in the same class, the ClasspathKieProject is able to
resolve the rules
--
View this message in context: http://drools.46999.n3.nabble.com/Unable-to-resolve-knowledgebase-from-cl...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Translate Drools to CLIPS rules
by Stadin, Benjamin
Hi,
I'm interested in possibilities to convert (one-way) Drools to CLIPS rules. I've followed the discussion about the canceled support for the CLIPS parser in Drools ("Drools Clips", last reply 2 Feb 2013). However, are there any options left to make a one-way conversion?
My interest in this is that I currently do a little research about how to fill the gap between central business rule engines and business process implementation and execution on smartphones / tablets (iOS, Android, Windows Phone 8). Currently I'm under the opinion that good old CLIPS could theoretically be a common denominator to enable common rule definition, and partial execution of these on mobile devices.
Regards,
Benjamin Stadin
12 years, 6 months