Accessing List<String> with mvel in condition
by esstrata
Hi,
I've tried several options but none working so I welcome any help.
* I'm using Drools 5.1.1.
* I succesfully insert several List<String> into Working Memory and I'm able
to printout them with a debug rule.
* The problem is, when I try to access a position in a list I get no match
even though I have values that should match. Here is the relevant code:
rule "B Number has characters other than numbers"
dialect "mvel"
when
$traffic_row : List(this[5] matches "[^0-9]")
then
System.out.println("row found" + $traffic_row)
end
Thank you in advance
--
View this message in context: http://drools.46999.n3.nabble.com/Accessing-List-String-with-mvel-in-cond...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 1 month
Drools implementation problem
by dan.dobrescu
Hello,
I'm trying to implement Drools in our project, but I really don't know which
method to adopt. First of all, our project is about creating marketing
campaigns for mobile network operators. So, we've got a Web UI where we let
the user define his own rules for the campaign.. Now.. here's my problem.
Should i try to translate everything in the UI in a custom drl with a custom
agenda-name (because there can be many custum campaigns with different
flows), or should I create an object with different properties which should
reflect the chosen options in the web-ui and then use it in my rules to
create the behaviour?
If I should go with the first option, how can I store it? Should I store the
drl in Guvnor(but the models my change from time to time.. not the
attributes used in the rules, other attributes.. and I can't import several
jars from an url to have access to the models, can I?) or in DB, and the
dynamically add the rules at run-time?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-implementation-problem-tp3113482...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 1 month
Re: [rules-users] Reuse of rule
by Küng Sabrina
Yes, sorry. I will try the extends and get back with a clearer question.
Thanks.
________________________________
From: Küng Sabrina
Sent: Mittwoch 1 Jun 2011 13:22
To: 'rules-users(a)lists.jboss.org'
Subject: RE: Reuse of rule
Thanks for your input. I am looking forward to the plugin.
How can I use a rule in the if-part (or as precondition) of another rule? Is that possible without using a ruleflow?
________________________________
From: Küng Sabrina
Sent: Montag 30 Mai 2011 13:52
To: 'rules-users(a)lists.jboss.org'
Subject: Reuse of rule
Hello
How can I write a rule, that can be used in several other packages resp. rulesets without copying the code?
15 years, 1 month
newbie question: forming event pairs
by Wouter De Borger
Hi all,
I'm new to drools and I have the following problem:
A stream of Start and Stop events comes into the engine.
The start and stop events should be paired and transformed into ranged
events.
Each start event should be paired to the first next stop event that is not
part of a pair already, with precedence for the last start event that came
in.
The problem is comparable to what a parser would do to match nested braces.
A sequence of the form
1: Start
2: Start
3: Start
4: End
5: Start
6: End
7: End
8: End
should form the following pairs
3-4
5-6
2-7
1-8
I checked the documentation but I still have two problems:
1. how can I find the next stop event (or previous start)
2. how can I make sure the pairs are formed innermost first?
Thanks in advance,
Wouter
15 years, 1 month
Building
by హరీష్ చౌదరి కూకట్ల
Hello EveryOne,
I am new to drools and I have couple of questions.
1. How to build group of .drl files as a package and load it into the
session.
2. Is there a way to see what rules are loaded into the session
programatically
Thank you very much,
Harish Kukatla.
15 years, 1 month
Drools 5.2.0.Final released
by Geoffrey De Smet
The Drools community is happy to announce the release of *Drools
5.2.0.Final*.
This includes:
* Drools Expert (rule engine)
* Drools Fusion (CEP: complex event processing)
* Drools Planner (planning optimization)
* Guvnor (BRMS web application)
* Drools IDE (Eclipse plugin)
Read the release announcement:
http://blog.athico.com/2011/06/drools-52-released.html
--
With kind regards,
The Drools team
15 years, 1 month
Drools' use of hashCode
by M. H.
Hi all,
I have encountered a situation I don't quite understand, I would be happy to
have some explanations about it. This is my first post here and I'm quite
new to all this so don't be afraid to go back to basics if I'm missing
something:
I have 3 classes :
public class Child
{
private Date time;
+get
+set
+constructor
}
public class Father
{
private Child child;
private int value;
+get
+set
+constructor
public void setTime(Date d)
{
child.setTime(d);
}
}
public class GdFather
{
private Father father;
+get
+set
+constructor
}
then 2 rules :
rule "1"
when
$father : Father(value==1)
then
$father.setTime(new Date(2));
$father.setValue(0);
update($father);
end
rule "2"
when
$father : Father()
$GdFather : GdFather(father==$father)
then
System.out.println($father);
end
////////////////////////////////////////
I didn't change the identity assert behavior, I insert a father and the
corresponding GdFather in the workingMemory, and all seems to work OK.
The issue occurs when I override the hashCode function in the Father class :
if I use this definition :
@Override
public int hashCode()
{
return child.getTime().hashCode();
}
then rule 2 is not fired after modification of the father, and is not either
if I change the function to return child.hashCode() with a Child hashCode
returning time.hashCode().
This also happens with a properly overriden equals function, and both Drools
5.1.1 and 5.2.0.CR1.
What I don't understand is why is it using the overriden hashCode function
with an identity assert behavior? What is it used for? And it looks like it
is using the overriden hashCode, but not equals, is that correct, and if so,
why?
How can I get the second rule to fire and have a custom hashCode() ?
Thank you in advance for your answers,
M.H.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-use-of-hashCode-tp3090419p309041...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 1 month
the condition starts with "-" in DSL mapping
by James Gu
Hi,
I am using guvnor-5.2.0.CR1-jboss-as-5.1. I found a bug in DSL mapping.
This is the DSL items.
[when]There is an TestObject=TestObject()
[when]-startDate is before {date}=startDate>DateUtils.parseDate("{date}")
[when]-endDate is after {date}=endDate>DateUtils.parseDate("{date}")
I created a business rule added these three lines in order. I clicked "view
source" and get this result. The second condition is not in the right place.
rule "test121"
dialect "mvel"
when
TestObject( startDate>DateUtils.parseDate("01/01/2009",
endDate>DateUtils.parseDate("01/01/2008") ) )
then
end
This is what I expected. I guess guvnor is looking for the first ")" and add
the condition (start with "-") before it. Actually it should look for the
last ")" and add the condition before it.
rule "test121"
dialect "mvel"
when
TestObject( startDate>DateUtils.parseDate("01/01/2009") ,
endDate>DateUtils.parseDate("01/01/2008") )
then
end
This problem also exists in drools-5.1.1-guvnor. It will be great if it can
be fixed soon.
Thanks,
James
--
View this message in context: http://drools.46999.n3.nabble.com/the-condition-starts-with-in-DSL-mappin...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 1 month