rules problem
by Puneet duggal
hi all,
I am new to drool business rules ,
i have a web application in which i have 100 rules
so i want to know which rules are going to be
executed based on the facts i suppilied .
my drl files is loaded at run time from database.
thanks
14 years, 8 months
Using Drools Flow To Build A Web Application
by Stephen L
Can Drools Flow be used to build the structure of a web application similar
to how Spring page flow or Seam jBPM works?
I'm looking to build a Spring MVC web application that does estimation based
on a list of questions and business rules. The web application will have
one (or more) questions per page. Each page will have its own html and
javascript to facilitate the visual representation of the question being
asked so I need each node to be a separate page or at least specify unique
view information.
I understand how Drools Expert could be used to specify the business rules.
I even see how it might be possible to build the entire system with rules,
however, I feel I want to define the page order and business logic/rule as
the estimation proceeds.
What I'm not seeing is how to use Flow to specify the structure and flow of
the system in the context of a web application.
How would I start a process from a controller or servlet and then have the
workflow provide the response model and view once the first "page" (workitem
or other node) is hit?
What is the best way to continue the flow with each additional page
submission? Would I pull the users ksession from their http session, insert
or update facts and then allow the flow to run and respond again with
another "page"?
Thanks for the help,
Stephen
14 years, 8 months
Drools Solver - Multiple Entries <ScoreDrl>
by Antonio Neto
Hi all,
In the Drools Solver documentation there is a point that say we can add
multiples entries <ScoreDrl>. But when I try do that, Drools Solver uses
just one entry to calculate the score, and I need put 2 files in the input.
Anybody could help me, please?
Thank you
14 years, 8 months
Drooles Expert - Chapt 2- Quick Start
by Kurt Guenther
As a learning exercise, I've been putting the examples described into
Drooles, and I've found numerous mistakes. The Account example appears
to go into an infinite loop.
Where do I report problems?
--Kurt
14 years, 8 months
template 101
by Stefan Marconi
Hi,
just starting using drools and need to use templates but having error
messages (described in comments in the code below).
I checked the meaning of the error messages but still can't figure it out.
I modified an simple rule according to the template section of the drools
manual: btw I use the eclipse with the drools-core plugin.
Thanks for your help. Stefan
template header
symbol
package com.test.processor; # [ERR 102] Line 4:26 mismatched input ';'
expecting 'identifier' in template header
template "test"
rule "A stand alone rule @{symbol}"
dialect "mvel"
when
eval(@{symbol} == "AAA")
then
System.out.println("this symbol is" + @{symbol})
end
end template # Multiple markers at this line
# - [ERR 103] Line 13:0 rule 'rule_key' failed predicate:
{(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
# - [ERR 101] Line 13:4 no viable alternative at input 'template' in rule
end
14 years, 8 months
Drools Execution Server Executing Twice
by jgautier
Hi All,
I have created a rule in guvnor that acts on one model. When the rule is
executed there is a value added to a global ArrayList object. I can verify
that this rule is executing once when running a test scenario in guvnor. I
have also created a java application to test the execution which also
verifies it is running once. However when running the package through the
drools execution server VIA xml the response I get shows two values in my
global arraylist even though there is only one object and one rule. I have
also added a println to the rule and when executing via the test scenario in
guvnor i see one line printed to the console. when executing it as the
webservice i see 2 lines printed to the console. Does anyone else have a
similar issue to this? I have found this issue on the issue tracker
https://jira.jboss.org/jira/browse/GUVNOR-354 but it looks like this person
resovled the issue by ignoring duplicates in their return response which
seems like an unacceptable solution. Thanks for your response!
jgautier
--
View this message in context: http://n3.nabble.com/Drools-Execution-Server-Executing-Twice-tp729952p729...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 8 months
Problem using parameter for n-of-m flow join
by Mike Fischer
I'm defining my "n" in an action node prior to the join:
kcontext.setVariable( "numTablesCurrentBatch", batch.getTables().size() );
For the "n" parameter of my n-of-m join, I am using
#{numTablesCurrentBatch} as the passed variable.
When I run my workflow I get the following exception:
java.lang.IllegalArgumentException: Could not find variable
numTablesCurrentBatch when executing join
I apologize for asking a repeat question, but I've exhausted Google in
trying to resolve this issue. Does anyone have experience with this
type of situation?
Thanks,
Mike
14 years, 8 months
Problem using parameter for n-of-m flow join
by Mike Fischer
I'm defining my "n" in an action node prior to the join:
kcontext.setVariable( "numTablesCurrentBatch", batch.getTables().size() );
For the "n" parameter of my n-of-m join, I am using
#{numTablesCurrentBatch} as the passed variable.
When I run my workflow I get the following exception:
java.lang.IllegalArgumentException: Could not find variable
numTablesCurrentBatch when executing join
I apologize for asking a repeat question, but I've exhausted Google in
trying to resolve this issue. Does anyone have experience with this
type of situation?
Thanks,
Mike
14 years, 8 months
Rule using accumulate
by Andrés Corvetto
Hi guys,
I'm new to drools, and i'm trying to build a small prototype.
I have 2 entities in my model: Offers and Bids. Both have a size (and a
price). I need a rule that matches a single Bid with multiple Offers adding
up in size to the Bid size. Matched Offers have to be sorted
by (increasing) insertion time .
I have managed to write a rule using 'accumulate', but i feel it's not too
efficient, since i have to match every Offer in the working memory with the
right price, sort them and then pick the first n ones.
Here's the rule:
rule "Match Bids"
when
$b : Bid($s:size, $p:price)
$i : OfferAccumulator(acumSize >= $s) from accumulate ( $o:Offer(price<=$p)
,
init(OfferAccumulator accum = new OfferAccumulator($s); ),
action( accum.add($o);),
reverse ( accum.remove($o);),
result( accum ))
then
System.out.println( "Matched Bid:" + $b + "," + $i.getOffers());
end
and here's OfferAccumulator:
public class OfferAccumulator {
private int sizeLimit=0;
private int accumSize=0;
Set<Offer> offers = new TreeSet<Offer>();
public OfferAccumulator(int sizeLimit) {
this.sizeLimit = sizeLimit;
}
public void add(Offer op) {
accumSize+=op.getSize();
offers.add(op);
}
public void remove(Offer op) {
if (offers.remove(op)) {
accumSize-=op.getSize();
}
}
public List<Offer> getOffers() {
List<Offer> ret = new ArrayList<Offer>();
int accum=0;
Iterator<Offer> it = offers.iterator();
while (it.hasNext() && acum<sizeLimit) {
Offer offer = it.next();
accum+=offer.getSize();
ret.add(offer);
}
return ret;
}
}
Can you think of a more efficient way of achieving the same result? Is there
a way of controlling the order in which facts are feeded to the accumulator?
Thanks in advance!
Andres
14 years, 8 months