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, 9 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, 9 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, 9 months
How to write Hibernate query lang(HQL) in .DRL file
by zeeshan
Hi !
According to my requirement I need to fetch and Insert data from database
using Hibernate Query from .DRL file.
I have idea how to execute HQL in Plain Java class but according to my
requirement,I need to fire query to database from .DRL file which I tried
but unable to get output instead I was getting errors.
Can anyone suggest me process to execute Hibernate Query from DRL file
or please provide me some sample code or any link.
Thanks !!
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-i...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
[Drools Planner] Multi depot CVRP / CVRPTW
by Mats Norén
Hi,
I've been looking at the VRP example in Drools and I'm thinking about using
it for multi depot cvrp and / or capacitated vrp with time windows.
Has anyone else tried planner for these use cases and can maybe shed some
light on their implementation?
Regards,
Mats
12 years, 11 months
"Rule-Id" for a Drools Rule
by harishtejwani
All:
We are using Drools to detect specific events/conditions in our system.
In the 'then' condition of Drools rule, we would like to persist the "Rule
Id" of the rule that created the specific event/condition
This is because all our reporting is based on "rules" as filters, where
users can look at exceptions by specific rules.
Is there a suggestion or sample as how can the "Rule Id" be persisted or
indicated in the then condition that is immutable or can be long-lived. The
current approach of using Rule Name itself as the ID is brittle as this can
be changed and suddenly all reports would break.
If we assign ID's to rules, where do we keep the mapping of RULE ID to
Rules. If we store rules in GUVRNOR is there a way we can get Rule Id's for
Rules?
Best regards
Harish Tejwani
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-Id-for-a-Drools-Rule-tp2914385p291...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 11 months
Fact insertion & retraction in working memory
by jigna
I need to add rule for filtering an event for 30 seconds.
i.e. The action would be taken once event has occurred for the first time &
then all the events of the same type would be ignored 30 seconds
& action should again take place if event has occurred anytime after 30
seconds.
I have tried creating a Throote class for holding thrittle value & timestamp
of firts occurance of events.
Following are the three rules which I am creating for the same.
It works correctly with first two rules, however for triggering third rule,
I need to insert an event which is not '000000A1'
& then this would give result retarcting ThrottleInfo Object which is
holding timestamp of this event for which throttle period has passed.
How can I make third rule trigger when there is not event of type '000000A1'
after throttle period?
Also is it possible to simplify this & write in single rule using timestamp
or any other features of fusion?
import com.igate.iheal.model.ErrorInfo
import com.igate.iheal.model.ThrottleInfo
import com.igate.iheal.model.process.IHEALProcessModel
declare ErrorInfo
@role(event)
@timestamp(errorTimeStamp)
end
rule "Error Rule 1"
no-loop true
when
$Error1:ErrorInfo(errorCode=="000000A1")from entry-point ErrorEntryPoint
not(exists(ThrottleInfo(errorCode=="000000A1")))
then
#Passing throttle duration as 30 seconds
insert(new
ThrottleInfo("000000A1",30,System.currentTimeMillis()));
retract($Error1);
System.out.println("New throttle info instance created");
end
rule "Error Rule 2"
no-loop true
when
$Error2:ErrorInfo(errorCode=="000000A1") from entry-point
ErrorEntryPoint
exists(ThrottleInfo(errorCode=="000000A1"))
$ThrottleError:ThrottleInfo(errorCode=="000000A1")
eval($ThrottleError.isThrottleCompleted()==true)
then
modify($ThrottleError)
{setErrorTimeStamp(System.currentTimeMillis())};
retract($Error2);
System.out.println("Modified throttle info instance");
end
rule "Error Rule 3"
#no-loop true
when
$Error3:ErrorInfo(errorCode!="000000A1") from entry-point ErrorEntryPoint
not(ErrorInfo(errorCode=="000000A1"))
exists(ThrottleInfo(errorCode=="000000A1"))
$ThrottleError:ThrottleInfo(errorCode=="000000A1")
eval($ThrottleError.isThrottleCompleted()==true)
then
retract($ThrottleError);
System.out.println("Delete unused throttle info instance");
end
--
View this message in context: http://drools.46999.n3.nabble.com/Fact-insertion-retraction-in-working-me...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 11 months