app-dev 'toe in water' help please
by dhartford
Hey all,
I'm trying to dip some toes into the water with Drools, and have an
application that would be a good start but having some understanding/lacking
an appropriate example issue.
The application context, let's say, is Mortgages, and already using the
Mortgage rules that are stored in a running instance of Guvnor.
Going back to 'toe in water', lets assume that all 'facts' are loaded on
call (so nothing is pre-loaded, all data to run a rule is supplied at the
time the rule is called). This is to make it easier to get started without
jumping all-in just yet ;-)
Using the mortgage business rule 'CreditApproval' that is already loaded
into Guvnor, I can see passing the Application object, with the creditRating
field/fact to a rule.
However, instead of populating and returning a loanApplication object, how
would I return just the decision/end result of a rule if it was only one
value (the approved/not approved decision) from the java app? KnowledgeBase
is loaded from the java app, but struggling with StatefulKnowledgeSession
versus StatelessKnowledgeSession and how to simply get back the rule
decision value (again, preferably without a specific object if it is only
one value)?
I'm also looking to only fire/execute one rule at a time for now until we
get comfortable - any help for an app developer trying to ease their way
into drools?
Sorry if I not overly clear, still trying to learn the appropriate
terminology :-)
-Darren
--
View this message in context: http://drools.46999.n3.nabble.com/app-dev-toe-in-water-help-please-tp3249...
Sent from the Drools: User forum mailing list archive at Nabble.com.
1 week
Effective Dating of Rules
by MaverickDrools
Is there a way to effective date a rule through a program?
Requirement:
without using the Guvnor UI to write the rules, trying to upload a .drl file
using REST APIs which already has rules specified "without" the
date-effective/date-expire attributes. Is there a way to maintain versions
that could be used by effective dating the entire package itself?
Or in general, how do we effective date the rules in Guvnor without using
date-effective attributes for rules and create a knowledgebase from the
package based on the current date?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Effective-Dating-of-Rules-tp4022422.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
2 weeks, 3 days
drools-solver results question
by Andrew Waterman
Hello,
I'm starting to work with the drools-solver to help on a gaming
project. Basically, we have a game that works in two modes: 1) a
competitive game where humans (or agents) compete with one another on
a well defined game board to achieve 24 points by using three (or
four) agricultural development tokens. 2. A puzzle, where all 4
players work cooperatively to create an equitable solution, where all
4 players win with at least 24 points by means of our agricultural
development tokens.
I am starting to work with drools-solver to address the puzzle part of
our game. Basically, we are interested in having the solver do two
things for us: a) find the optimal solution for our game/puzzle,
based upon our requirements [this part seems quite straightforward]
and b) getting the total number of solutions that satisfy our
constraints. We would like, as well, to be able to inspect these
other, sub-optimal, solutions, in order to explore our game and puzzle
further. From my reading of the "Solver" API , it looks like we will
only be able to get the optimal solution. Does anyone have any
suggestions for a workaround in this case? Or is there some
functionality in the solver that I am missing?
I look forward to your feedback.
best wishes,
Andrew
---------------------------------
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
1 month, 1 week
Need help with setFocus
by new2drools
Hi All,
Need some help with understanding setFocus.
I have the following use case:
if (condition1) {
if (condition2) {
} else if (condition3) {
} else if (condition 4) {
}
}
if (condition5) {
if (condition2) {
} else if (condition3) {
} else if (condition 4) {
}
}
I created 3 rules (rule2, rule3, rule4) for checking condition2, condition3,
condition4 and
created 1 agenda group (groupX) for them.
I created 2 rules (rule1, rule5) for checking condition1, condition5 and
created 1 agenda group(groupY) for them.
rule "rule1"
agenda-group "groupY"
when
//
then
drools.setFocus("groupX");
end
rule "rule3"
agenda-group "groupX"
activation-group "someActiveGroup"
when
//
then
//
end
>From the java code:
ksession.getAgenda().getAgendaGroup("groupY").setFocus();
Problem: The first time, drools.setFocus("groupX") is invoked, I see that
it's working fine. rule2 or rule3 or rule4 get triggered. But, the SECOND
time that drools.setFocus("groupX") is invoked, I don't see that any rule in
agenda-group groupX is being invoked...even though one of the rule's LHS
explicitly matches...thinking that the activation-group is cancelling all
the activation's (after one rule in that activation group is fired), I even
removed the activation-group statement. But, it didn't help...ideally, I
would like to bunch rule2, rule3, rule4 in one activation group.
Can you please let me know as to why the second invocation of setFocus is
not working? I even tried to remove everything in LHS of rule2/3/4, to see
if the second invocation would work...it doesn't...
Thanks!!
--
View this message in context: http://www.nabble.com/Need-help-with-setFocus-tp24177742p24177742.html
Sent from the drools - user mailing list archive at Nabble.com.
1 month, 4 weeks
Drools beginner - unable to resolve method using strict-mode
by Stefan Schuster
Hi,
I'm new to drools, and I made my first steps using the very nice
video-tutorial "Build Pong in 13 minutes using JBoss Drools" found here:
http://www.youtube.com/watch?v=Omj4PR3v-nI
Eclipse shows building errors, but Pong start anyway. What does this error
mean?
in move.drl there is following rule:
*<rule "Move Bat Up" timer(expr: bat.speed, bat.speed) no-loop when*
* ui : PongUI( ready == true )*
* ( KeyPressed( keyText == "A" ) and bat : Bat( playerId ==
PlayerId.PlayerOne, y > pconf.padding + pconf.sideLineWidth )*
* or*
* KeyPressed( keyText == "K" ) and bat : Bat( playerId ==
PlayerId.PlayerTwo, y > pconf.padding + pconf.sideLineWidth ) ) *
* td : TableDirty( ) *
*then *
* tableG = ui.getTablePanel().getTableG();*
* tableG.setColor( Color.BLACK ); // background*
* tableG.fillRect( bat.x, bat.y, bat.width, bat.height );*
* *
* modify( bat ) { y = bat.y - 2 };*
* tableG.setColor( Color.WHITE ); // background*
* tableG.fillRect( bat.x, bat.y, bat.width, bat.height ); *
* modify( td ) { dirty = true };*
*end*
the error message is:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.td<http://org.drools.spi.knowledgehelper.td/>
()]
[Near : {... @Modify with( td ) { dirty = true }; ....}]
in another File (ui.drl) TableDirty is defined:
*declare TableDirty*
* @propertyReactive*
* dirty : boolean*
*end*
Any ideas what this error message means? And why can I start pong despite
this error?
Thanks a lot for helping me
Stefan
5 months, 3 weeks
conways game of life
by Mark Proctor
For anyone looking for a good and complex example on how to write rules
properly, please look at Conways Game of Life in drools-examples, for
extra bonus points compare it to the old version in M1. You'll see
nearly all the logic is moved from java to the drl and we have removed
the need for nested objects by using objects relaitionally, which also
allows us to exploit cross products to drive the application.
Mark
5 months, 3 weeks
Multi-threading / Parallelism in Drools
by Anitha Naduvath
HI all ,
Mine is a microservice (REST based stateless endpoint )running on the
cloud. Our service mainly deals with Invoices , where the Items of the
Invoice need to be evaluated against a set of rules .
We are now evaluating Drools to implement these business rules .
I have the following query with respect to Multi-threading / Parallelism
options in Drools.
*Use Case 1 :*
Our service receives an invoice with say 15000 Items , to be processed . We
need to evaluate the same set of rules for each of the items. It is Ok to
process each item in parallel . How do I achieve this in Drools ?
*Use case 2:*
Our service is called from 100 different end users . Such users may have
invoices ranging from 1 item to 15000 items in the invoice . How do I make
sure that the I maintain the same response time for all ? Should I use KIE
Execution Server which is a standalone exceution server ? In such a case,
is this server something like another microservice ? . So, will there not
be performance issues in making a REST call from my service to the KIE
Execution Server ? On the other hand , if I embed the runtime in my
application, then will it mean that I kind of tie the runtime One to One to
the user request ?
What is the best approach for the runtime considering both the use cases
here ?
*Also, can anybody explain what they mean in section 1.3.1.3 of the Drools
documentation
<https://docs.jboss.org/drools/release/6.5.0.Final/drools-docs/html_single...>:*
- 1.3.1.3. Runtime
The "runtime" requirements mentioned here are if you are deploying rules as
their binary form (either as KnowledgePackage objects, or KnowledgeBase
objects etc). This is an optional feature that allows you to keep your
runtime very light. You may use drools-compiler to produce rule packages
"out of process", and then deploy them to a runtime system. This runtime
system only requires drools-core.jar and knowledge-api for execution. This
is an optional deployment pattern, and many people do not need to "trim"
their application this much, but it is an ideal option for certain
environments.
Thanks!
Anitha .
9 years, 4 months