Error using multiple evals
by Ayush
Hi All,
When I'm trying to execute multiple evals I'm getting errors. Below is what
I'm trying to do
MyEvent(prop1="XYZ") over window:time(1m) from entry-point
MyStream
or
(MyEvent() over window:time(1m) from entry-point MyStream
and
Number($i1 : doubleValue)
from accumulate(
MyEvent(
prop1 == "CONNECT",
prop2 == 3,
eval((prop3 matches ("match "+getFirstNameRegex()+" Connect")) == true)
) over window:time(1m) from entry-point MyStream, count()
)
and
eval($i1 > getNodeCount()*0.35))
or
(MyEvent() over window:time(1m) from entry-point MyStream
and
Number($i2 : doubleValue)
from accumulate(
MyEvent(
prop1 matches "(second|Third{1}_CONNECT",
prop2 == 1,
eval((prop3 matches ("MatchOne|MatchTwo){1}::"+getMMSCNameRegex()+",
failure")) == true)
) over window:time(1m) from entry-point MyStream, count()
)
and
eval($i2 > getConnectionCount()*0.4))
or
(MyEvent() over window:time(1m) from entry-point MyStream
and
Number($i3 : doubleValue)
from accumulate(
MyEvent(
prop1 matches "(E1|E2){1}_CONNECT",
prop2 == 3,
eval((prop3 matches ("REPT (one|five|seven){1}:: "+getServerID()+" is
down")) == true)
) over window:time(1m) from entry-point MyStream, count()
)
and
eval($i3 > getThirdNodeCount()*0.5))
When I'm trying to execute the above LHS I get
org.drools.rule.InvalidPatternException: Required Declarations not bound:
'$i1'.
Please help it's urgent
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Error-using-multiple-...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Question about Drools accessing a global HashMap and comparing it to an object value
by mviens
MyObj is a Java object that contains:
String state;
String code;
public void addError(String message);
myObjList is an ArrayList<MyObj> containing from 2 to 20,000 objects
state2CodeMap is a HashMap<String, ArrayList<String>> containing an entry
for each US state. The associated ArrayList contains a minimum of 1 entry,
up to 200 entries.
I need to create a rule that checks all of the MyObj objects in myObjList,
gets the appropriate ArrayList from state2CodeMap based on myObj.state and
then if myObj.code not memberOf $codeList, run the "then" portion of the
rule.
I have created about 60 fairly simple rules, that are working just fine, but
this one is a little too complex for me to userstand how to write it in
Drools. Looking at this page (
http://blog.athico.com/2007/06/chained-from-accumulate-collect.html
http://blog.athico.com/2007/06/chained-from-accumulate-collect.html ), I can
see that nested "from" seems to be supported, but the page seems to be for
Drools 4. Plus, I have had to teach myself Drools in the past week. I could
really use some help with this. Any assistance is greatly appreciated!
Mike V.
global List myObjList;
global HashMap state2CodeMap;
# this rule is working just fine!
rule "Check for null State"
when
$objs : ArrayList() from collect(MyObj(state == null || state ==
"") from myObjList)
then
for (MyObj myObj : (ArrayList<MyObj>)$objs)
{
myObj.addError("State must have a value");
}
end
# I really have no idea how to write this rule
rule "Check for valid code"
when
$objs : ArrayList() from collect(MyObj())
then
for (MyObj myObj : (ArrayList<MyObj>)$objs)
{
myObj.addError("Code is not valid for the State");
}
end
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Question-about-Drools...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Templates(without spreadsheet) with DSL
by Bala
Hi,
Is that possible to use templates with dsl without converting the dsl and
dslr to drl?
I have opted the below way to support templates with DSL and dslr.
But want to know is there a way to use the templates in dsl without
converting it to drl for ObjectDataCompiler.compile method call? Or am i
missing something?
ObjectDataCompiler compiler = new ObjectDataCompiler();
InputStream dslResource =
ResourceFactory.newClassPathResource("Rules.dsl",
DroolsValidator.class).getInputStream();
dsl = convertStreamToString(dslResource);
DrlParser parser = new DrlParser();
String resultDrl = parser.getExpandedDRL( subRuleDesc, new
StringReader(dsl));
drl = compiler.compile(rulesData, getInputStream(resultDrl));
Thanks,
Bala
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Templates-without-spr...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Drools Flow - Python how?
by jinsthomas
Hi all,
I recently joined this group. We are using Drools flow to create some
workflows to automate some of the tasks. Would like to have some advice on
how we can use python instead of Java or Mvel. Do we have some good
tutorials/articles on this. In Drools flow we have nodes like 'Script' ,
'Converge', 'Diverge' etc. Currently i could we can either use MVEL or Java,
but from the internet we are getting a feel like we can use even python for
this.
Would some body please advice
Cheers
J Thomas
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-Python-ho...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Looking for smart way to import huge amount of rules into BRMS
by Benson Fung
Hi,
I need to import a drl file with 9000 rules inside into BRMS. However, I
found that it takes very long time to import and it also takes long time to
get downloaded into the application to build the ruleBase. Is there any
smart way or faster way to manage this procedure? Please advise
Thanks
13 years, 10 months
large rulebase load time
by Joe White
For a large rulebase (200k+ rules) will the call to
addPackageFromDrl(drlString) run faster if the number of rules is
smaller but the rules include more || statements between predicates?
There is only one type of object ever inserted in working memory and I
have many rules with the same RHS. I can collapse those rules into one
LHS with ors between the predicates in the object, but I would only go
through the effort of optimizing if it would improve load time.
Thanks for your help.
Joe
This message is confidential. It may also be privileged or otherwise
protected by work product immunity or other legal rules. If you have
received it by mistake, please let us know by e-mail reply and delete it
from your system. You may not copy this message or disclose its contents
to anyone. The integrity and security of this message cannot be
guaranteed on the Internet.
13 years, 10 months
Clearing an AgendaGroup
by Evert Penninckx
Hi
I have a rule set with two agenda groups. I have a rule with autofocus on
group1. If the rules in group1 are "exhausted" it activates group2 using
setFocus().
rule "Active second group"
agenda-group "group1"
auto-focus true
salience -1
when
eval(true)
then
drools.setFocus("group2")
end
Now I noticed that while executing rules from group2, rules from group1 were
still being triggerd and executed.
So I added this to the then clause.
drools.getWorkingMemory().getAgenda().clearAndCancelAgendaGroup("group1")
Alas, it made no difference. Some debugging made clear that after the then
clause the stack contained only MAIN and "group2".
Am I missing some basic notion on agenda groups?
Greetz
Evert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Clearing-an-AgendaGro...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
proper syntax for multiple function calls within LHS
by garySFCA844
hello,
I'm a newbie to Drools. I'm trying to write a rule that performs some math,
without resorting to a function or eval. I searched the forum but found lots
of posts on nested function calls,etc but not what I was searching for.
For simplicity, lets assume I have the following classes
public class ONE{
double A
double B
double C
}
public class TWO{
double D
double E
}
where A, B, C, D, E are themselves calculated values (apr, price at some
date, etc)
1. What does the LHS of a rule that compares A > D look like?
2. What does the LHS of a rule that compares A+B > C look like?
3. What does the LHS of a rule that compares A+D > C look like?
I apologize in advance if this was covered already.
Thanks.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/proper-syntax-for-mul...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Guvnor UI bugs?
by jlegelis
I'm running Drools 5.1.1 on JDK 1.6, client is Chrome on XP. I've noticed
quite a few UI bugs in Guvnor, most feel like browser caching issues,
setter/getter issues etc. For example, when creating test scenarios,
changing the values in the 'given' clause then running the scenario results
in the 'old' values being sent. Anybody else notice this or have any
workarounds?
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-UI-bugs-tp2356...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months