Dependency Enumeration List in Drools
by srinivasasanda
The concept was..
I have one Model with fact named *Person*---with *country,state* as fields..
I need to create enumeration for country and state which should be load
dynamically.
Here is my enumeration code
'Person.country' : (new com.sample.DataList()).getMycountriesList()
Now,Its working fine..The countries list was succesfully loading in rule
diplaying as drop-down list.But If i select *US* in one of the
list-box,*states* must be displayed dynamically.
'Address.state[country=USA]' : (new com.sample.DataList()).getMyUSList().
But,If i have 100 countries It is not good way to write 100 times this code
specifying country=....
'Address.state[country=UK]' : (new com.sample.DataList()).getMyUKList()
'Address.state[country=Australia]' : (new
com.sample.DataList()).getMyAustraliaList()
........
......
.......etc
How can I achieve dynamically..When I click USA in drop-down box.State list
must be displayed.How can I achieve this..Please suggest me
--
View this message in context: http://drools.46999.n3.nabble.com/Dependency-Enumeration-List-in-Drools-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Managing memory
by Laird Nelson
Hello; this is probably a pretty basic kind of question, but I want to see
what other users' tricks are for managing memory in their sessions.
My application is a straightforward survey-type application. There are
questions, choices, answers (choice selections) and so on. Once someone
has selected an answer, the rule evaluation kicks in. The determination of
which question to show next is made based on...well, pretty much anything.
Typically it's on the current user's last answer to a question, but it
might also involve his answers to several previous questions in his own
path through the survey.
This being psychology-related, there are hundreds of questions and probably
hundreds of rules. "If the question the user just answered is question 4,
and if the user selected 'sometimes' as the answer to question 4, and if he
also selected 'never' as the answer to question 1 during this interview
session, and he is over 40, then show him question 25 next" is a good
example of one such rule. You can see how there might be nearly one rule
for each question.
(The rulebase session itself could probably be sequential--none of the
facts in the session is modified in such a way that reevaluation of the
rulebase is necessary.)
OK, so, currently I load pretty much everything into the (stateful)
knowledge session I have. That means--what with all the question text and
answer text and everything--there is a LOT of data in this particular
session. Multiply times the number of concurrent interviews being
administered and this thing chews through heap in a hurry.
One approach I thought of was to simply load the current question into the
session as a fact and then rely on various accumulate functions to load
other questions and answers as necessary. But this approach isn't much
better than a linear series of if/then statements, if I understand
correctly.
What are some of the so-called best practices here? Are there particular
Drools-centric development approaches I should be taking, or architectural
choices I should be making? Or is this just a case of throw hardware at
the problem? :-)
Again, I'm not so much looking for A Single Right Answer as I am reports
from the field. You may feel free to contact me directly if you wish.
Best,
Laird
--
http://about.me/lairdnelson
13 years, 1 month
Tell me to RTFM
by ronalbury
I am sure this must be a case of RTFM, but please tell me which FM and if
there is a section, in particular I should read.
I am running JBoss Designer Studio 4.1.1.GA. It allows me to create RF
files and comes with a number of Flow (or should I say jBPM) components, but
not all of them. Do I need to download and install the full jBPM to get the
rest of the components in eclipse?
The feature I most want now is *embedded sub-process*. I have been trying
to play with *reusable sub-process* to get a feel for sub-processes in
general, but I'm stuck here too ... I'm sure this is another RTFM. I assume
that when I am designing an RF I should be able to reference another RF to
use as the sub-process as part of the graphical RF definition. The other
jBPM components (e.g. RuleTask, Gateway, etc) have pretty self-explanatory
properties ... but when I look at the reusable sub-process I see no way to
indicate what RF I want to use for that sub-process.
Thanks in advance
--
View this message in context: http://drools.46999.n3.nabble.com/Tell-me-to-RTFM-tp3570837p3570837.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Setting typesafe in decision tables
by abr
In Drools 5.3, is it possible to add the typesafe notation to an object
within a decision table?
The idea behind this question is to be able to define conditions on fields
that cannot be resolved at compile time but that can be at runtime.
(e.g. define conditions on event.payload.field1 where event.payload is a
java.lang.Object and field1 an attribute of the object's class set in
event.payload at runtime)
I've tried to disable MVEL strict mode but without success.
Note: this worked in Drools 5.1 because of the more permissive parsing
method.
By the way, if you have other ideas that should work, I opened to them :-)
Best,
Alexis
--
View this message in context: http://drools.46999.n3.nabble.com/Setting-typesafe-in-decision-tables-tp3...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Hard constraints to enforce employee seniority
by Patrik Dufresne
Hi all,
I'm trying to create rules to model my problem. So far, I didn't manage to
create rules to make Drools converge to a solution because of score traps.
I don't see any way to avoid it (as I'm not an expert with Drools). I can
express the rule as follow : a senior employee should work before a less
senior employee.
I've implement it as a hard constraint :
rule "hard-Seniority"
when
$employee : Employee()
$assignment : PlanifEventAssignment( $planifEmployee : employee )
not PlanifEventAssignment( employee == $employee )
eval(Helper.compareEmployee($employee, $planifEmployee) < 0)
then
insertLogical(new IntConstraintOccurrence("hard-Seniority",
ConstraintType.NEGATIVE_HARD,
1,
$employee, $assignment));
end
The function Helper.compareEmployee(e1, e2) return -1 if e1 is more senior
then e2 (mostly based on hire date and other boolean fields).
This way, the rule make sure a senior employee is working. But it's a score
trap since, many moves are required to resolve the constraint. e.g:
PlanifEventAssignment1 = e2
PlanifEventAssignment2 = e3
PlanifEventAssignment3 = e4
PlanifEventAssignment4 = e5
e1 is not working. Multiple move are require to reach the best solution :
PlanifEventAssignment1 = e1
PlanifEventAssignment2 = e2
PlanifEventAssignment3 = e3
PlanifEventAssignment4 = e4
So I'm asking you. What is the best way to make Drools converge ? Do I need
to change my rule, or should I create a BigMove ?
--
Patrik Dufresne
13 years, 1 month
Breakpoint on DRL rule file not catching
by Colwell, Dave
Breakpoints in my DRL files are not causing the Eclipse debugger to pause the
running thread. My Macbook Pro (Lion) is configured with the following:
- Eclipse Indigo
- GEF
- Drools plugins (Core, Guvnor, Task) from JBoss Tools
- The Preferences | Drools | Installed Drools Runtime is configured with a
single checked entry pointed to the binaries folder in a Drools 5.3.0
distribution.
I can create a Drools project, which also generates a simple DroolsTest.java
and Sample.drl file. I'm able to set breakpoints in the RHS of the rules.
However, when I Debug the DroolsTest.java as a Drools Application the
breakpoints never catch.
Thank you for any recommendations.
Dave
13 years, 1 month