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
13 years, 5 months
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.
13 years, 5 months
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.
13 years, 5 months
Avoid evaluation of expensive LHS terms
by Joe Ammann
Stumbled over this today in a specific case, but my question is about a
general practice (I'm quite new to Drools, 5.2.0.M2 btw). I have a
knowledge session with a fair amount of facts (0.5 Mio) and mostly
simple rules. One rule has a LHS expression that I know will be
expensive to execute, in the example that I encountered this it looks like:
rule "Count facts"
when
all : Number() from accumulate (s : X(), count(s))
blacklisted : Number() from accumulate (s : X(status ==
X.BLACKLISTED), count(s))
....
then
....
end
I want to execute this rule only after other rules have already executed
(and changed the status of most of the X facts). There's quite a number
of X facts (~200'000). Most of them have their status modified during
execution of other rules. If I run the rule base without the above
rules, performance is perfect, some tens of seconds. If I activate the
rule, execution never finishes (I stop it after a few minutes, never saw
it finished).
I *THINK* (correct me if I'm wrong) what happens is that especially the
second expression of the LHS gets executes over and over again whenever
one of the facts is modified by one of the other rules. Makes sense, but
I nevertheless want to try to avoid it.
Until now I tried unsuccessfully:
- "protect" the rule with a guard fact as the first expression, which is
inserted only late in the processing
- move the rule to another ruleflow-group (or agenda-group) and activate
it only at the end of the processing
- use the rule in a second independent knowledge base and session, and
insert the facts once the first has finished
I'm perfectly aware that I could solve this specific problem of counting
facts with different techniques, but my question is more general (as the
subject says). Because I have other cases where (as a last resort) I
need to go to a database or online service to get the required
information. It seems that others have similar problems
(http://drools.46999.n3.nabble.com/Short-circuiting-evaluations-on-LHS-td5...).
But in my experience, that technique ("protecting" the expensive pattern
in the LHS with a cheap one that evaluates to false until you really
need the expensive one) does not work. I get the impression that
(contrary to popular experience that a "false" value in an AND sequence
terminates the whole sequence) the drools LHS are processed differently.
Am I missing something really stupid?!
--
CU, Joe
13 years, 5 months
usage of @startTimestamp
by Lavoisier Farias
Hi everybody,
I am delepoing an application using Drools to correlate events from a
network management system. Can anyone recommend me a good tutorial which
teaches how to use real time clock ? I am using the book of Michal Bali,
which is very good indeed. The book examples uses the following code:
clock.advanceTime(*xx seconds*, TimeUnit.SECONDS);
However, I would like to use the property of an event called *startTime *and
*endTime *which means the time on which the event starts and the time the
event finishes. I know there is the property @startTimestamp mentioned at
the book. But, where can I find more examples of usage of @startTimestamp in
rule files ?
Best Regards,
*
Lavoisier José Leite Farias*
Skype: lavoisierfarias
Twitter: http://twitter.com/LavoisierFarias
13 years, 5 months
Troubles with Oryx designer in Guvnor - jBPM 5.1.CR1
by Dan Seaver
I'm attempting to use the Oryx designer in Guvnor, however I can't seem to
save / redisplay any diagram. I've tried it with various configurations,
including using the jBPM demo, but always get the same results. After I save
the newly created BPMN diagram, the Oryx designer refreshes to a blank
diagram. The new diagram name is on the list of Guvnor processes (for the
default package), and when I try to open it, I get the same blank diagram.
After starting the jBPM demo (5.1.CR1), I see the h2 database started, jboss
started and the human task service started. The jboss log looks pretty clean
except for an SLF4J error and a mention that the persistence provider caller
for org.jbpm.persistence.jpa does not implement the ejb3 spec correctly.
Also, there is an error regarding the log4j FileAppender.
Then I goto Guvnor with FireFox (or Chrome or IE6) and create the new BPMN
process. I get the following message in the jboss log:
2011-06-20 16:00:05,288 INFO [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
(null: -1, -1): Premature end of file.
Then I create the process with the designer:
2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
SLF4J: Class path contains multiple SLF4J bindings.
2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
SLF4J: Found binding in [vfszip:/D:/dev/Drools/jbpm
5.1.CR1/jbpm-installer/jboss-5.1.0.GA/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class]
2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
SLF4J: Found binding in [vfszip:/D:/dev/Drools/jbpm
5.1.CR1/jbpm-installer/jboss-5.1.0.GA/server/default/deploy/designer.war/WEB-INF/lib/slf4j-jdk14-1.5.6.jar/org/slf4j/impl/StaticLoggerBinder.class]
2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
2011-06-20 16:00:03,242 INFO [org.oryxeditor.server.EditorHandler]
(http-localhost%2F127.0.0.1-8080-1) The diagram editor is running in
development mode. Javascript will be served uncompressed
2011-06-20 16:00:05,116 INFO [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
INFO 20-06 16:00:05,116 (NilAuthenticator.java:authenticate:35) All users
are guests.
2011-06-20 16:00:05,288 INFO [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
(null: -1, -1): Premature end of file.
and save:
2011-06-20 16:06:51,247 INFO [STDOUT] (http-localhost%2F127.0.0.1-8080-7)
ERROR 20-06 16:06:51,247 (LoggingHelper.java:error:69)
java.lang.NullPointerException
at java.net.URLEncoder.encode(URLEncoder.java:188)
at
org.drools.guvnor.server.contenthandler.BPMN2ProcessHandler.storeAssetContent(BPMN2ProcessHandler.java:129)
at
org.drools.guvnor.server.RepositoryAssetOperations.checkinVersion(RepositoryAssetOperations.java:187)
at
org.drools.guvnor.server.RepositoryAssetService.checkinVersion(RepositoryAssetService.java:227)
...
Anybody have any ideas on what could cause this on my system and how I may
be able to solve it? Any help would be appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Troubles-with-Oryx-designer-in-Guvnor-j...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
problems with process executions, constraints, and multiple sessions
by Jordi Alvarez
Hello,
I am involved in a project in which we are using Drools as the BPM.
We are experiencing some problems with wait state nodes. More concretely,
the problem seems to deal with
the execution of constraints in those wait states.
Let me first describe our context:
We are using JPA with Hibernate and Oracle. Our process instances are all
identified by a
business identifier (a string). This business identified would correspond to
the identifier of a case;
and a case normally has associated a process instances (and subprocesses of
that process).
Additionally, the processes we have developed make extensive
use of timers and wait states with constraints that refer to the process
instance and other facts that
we are using as events.
We have a stateful session for every case / business identifier.
We have a main process that calls subprocesses. As we said, in that process
and subprocesses we use wait states.
The constraints in those wait states are "waiting" for a fact to be inserted
in the stateful session. Once
the corresponding fact is inserted, the corresponding constraint should be
activated.
At this point is where the problem arises. All the constraints have been
unit tested with no problem at all.
But we have detected some problems that can arise when there is more that
one process waiting in the same wait state
(every process in a different Drools stateful session).
The situation is as follows:
1. There is a main process instance MPA with business id BA that has a
subprocess SPA (also with the same business id).
This subprocess is waiting in a given wait state W1 (these processes are
running in the stateful
session corresponding to the business id BA, from now on SA).
2. There is a second main process and subprocess with business id BB. The
state for these second set of processes is the
same one, and they are running in a second stateful session (the one for
business id BB), from now on SB.
3. A fact FA is inserted in SA. This fact makes the constaint in SPA true,
which makes SPA to leave the wait
state and continue with the execution.
Then, in some situations stateful session SA tries to also continue SPB,
which runs in a different stateful session
(that of SB). That, of course, produces some posterior problems that were
the origin of our investigations.
After some more deep investigations, it seems that the reason session SA
tries to continue SPB is that the constraint
in W1 for SPA gets activated twice. We have detected (and posteriorly
corrected) some situations in which this happens.
For example: the process in the constraint was associated not only to SPA
but to other processes in SA (the main process SPA for example).
we corrected this and obtained a better behaviour in which the problem is
more difficult to reproduce.
We have tried also to replace constraints with rule nodes, and set the
lock-on-active and no-loop. The results were a bit different
but seemed not to avoid the problem.
So, there is someone that has experimented situations similar to the
described above? Additionally, can someone from the drools
team give a bit of light to this situation? Why the reasonings in a stateful
session are interacting with processes running on a different
stateful session?
many thanks in advance,
Jordi Alvarez
13 years, 5 months
Question on Drools migration from 3.0 to 5.1
by Liqun Du
Hi All,
We have an issue in rule when migrating drools from 3.0 to 5.1 with "eval". To demo this error, I use the following code:
public class Info {
public String getItem(int i) {
return "item is " + i;
}
}
In Drools 3.0, the following rule is fine:
rule "test eval"
salience 1
when
info : Info()
eval(into.getItem(0) != null)
then
System.out.println("test eval");
end
But when using drools 5.1, it shows error "info can not be resolved". I found a way to resolve this issue but don't know this is the best practice.
declare Item
name : String
end
rule "insert item before eval"
salience 0
when
info : Info()
then
Item item = new Item();
item.setName(info.getItem(0));
insert( item );
end
rule "test eval"
salience 1
when
item : Item(n : name)
eval( n != null)
then
System.out.println("test eval");
end
BTW, using "declare" in rule may cause memory leaking? We are seeing heap size growing after migrated to 5.1.
Thanks,
Liqun
13 years, 5 months