Events: to be or not to be
by Edson Tirelli
Hi people,
I've been noticing that there is still a lot of confusion on how to model
business domains, more specifically, since Drools 5 with the addition of the
Drools Fusion features, what should be modeled as an event and what should
not.
So, I wrote a quick blog about it, that I hope will help clarify things a
bit. This is not target at any user or use case in specific, but intends to
eventually raise some discussion and improve general understanding of the
theme.
http://blog.athico.com/2010/07/events-to-be-or-not-to-be-that-is.html
Hope it helps,
Edson
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
16 years
Fusion pseudo-time and custom timestamps
by djb
Hi,
So I am making progress... I am taking medical insurance claims and
inserting them into the entry-points as events, using the date of the claim
as the timestamp of the event.
I just want to check how am I meant to do this? I decided I probably need a
pseudo-clock as I am using historical data. I presume I am meant to work
out how long it has been since the last claim, and then call advanceTime, as
below...
long previousClaimTime = 0;
for (ClaimOrReversal cor : history)
{
if (cor.isSubmittal())
{
long ms = cor.getTimestamp().getTime() - previousClaimTime;
clock.advanceTime(ms, TimeUnit.MILLISECONDS);
claimEntry.insert(cor);
}
previousClaimTime = cor.getTimestamp().getTime();
}
However, nothing is firing (claimEntry above corresponds to the entry point
name below).
Not even this:
rule claimReceived
when
$event : ClaimSubmittedEvent() from entry-point
"ClaimReceivedEntryPoint"
then
System.out.println("YEAH!");
end
What am I doing wrong?
Regards,
Daniel
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Fusion-pseudo-time-an...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
Unit test for Ad-Hoc Task / Ad-Hoc Subprocess
by mardo
Hi there (->Kris),
for the unit test testAdHocSubProcess() in trunk, shouldn't there be added
at the end:
assertProcessInstanceCompleted(processInstance.getId(), ksession);
, which would fail. Either this is an error or I haven't properly understood
a concept of the ad-hoc subprocess. Can you give me a hint?
Thanks & Cheers
Markus
16 years
Doubt regarding drools Rule Engine.
by Pardeep Ruhil
Hi,
I have some doubts related Drools Rule Engine. I have read the documents related to it but still want to confirm some of my doubts
Doubts :
1 Can I execute rules by specifying the effective date ?
For eg. :- Like I write a rule and that rule will remain active till the date specified, after that date the rule becomes disabled or inactive.
2 Can I define depending upon the location ?
For eg. :- I will write rules for different location (like for New York, London , Australia) and depending upon the user's location the corresponding rule gets executed.
3 Can I call a rule by name ?
4 Can I execute another rule depending upon some condition in one rule. ( In short can I call one rule from another)
Please help me clear my doubts.
Thanks & Regards
Pradeep Ruhil
________________________________
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
16 years
Re: [rules-users] Drools issue
by djb
In Drools, you can call any java code in the "when" block using eval(...),
however, it is not advised because it cannot be used as a node in the RETE
graph.
so,
rule "basic rule"
when
$a: Account( validAccount == true ) // condition
eval($a.isValidAccount("blah"))
then
System.out.println("Account is not valid"); // consequence
end
depends on your goal though -- if you are making a validation program, you
probably want to use rule templates. otherwise, you might as well just use
a HashMap and a 3 line java program.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-issue-tp951185...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
Re: [rules-users] Drools issue
by djb
Hi, you're allowed to call any java in the then clause. The when clause,
however, is in a logic syntax.
Remember, you will have to import any classes that you use.
But usually you'll only want to access globals. Otherwise you are modifying
or updating or inserting variables that you linked in the when section.
So, you probably want:
global com.my.Results results;
if you wanted to access your global results variable. And of course, you'll
need to declare that global with setGlobal in the code. There are examples
in the documentation.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-issue-tp951185...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
Re: [rules-users] Drools issue
by djb
Hi, you're allowed to call any java in the then clause. The when clause,
however, is in a logic syntax.
Remember, you will have to import any classes that you use.
But usually you'll only want to access globals. Otherwise you are modifying
or updating or inserting variables that you linked in the when section.
So, you probably want:
global com.my.Results results;
if you wanted to access your global results variable. And of course, you'll
need to declare that global with setGlobal in the code. There are examples
in the documentation.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-issue-tp951185...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
What Drools library should be used with JDK 1.6 ?
by Tatyana Polnyi
What Drools library should be used with JDK 1.6 ?
This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.
This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to European legal entities.
16 years
Re: [rules-users] rules-users Digest, Vol 44, Issue 16
by Axelrod, Nelson
Hi Edson,
Yes, I have been writing and checking the audit log. It shows several
activations of the "test" rule, and I've pasted them below if that
helps. There are no other activation events with fact handles to [19,
6313, 3681] except for the "test" rule.
These two rules intentionally do not have any side effects written in
the RHS, specifically to avoid the case that an activation of one rule
would somehow lead to a change affecting the LHS of another rule or any
other side effects. I load all of the facts before the rules, and no
other code is executed except for the KnowledgeSession fireAllRules()
method followed by dispose().
<org.drools.audit.event.ActivationLogEvent>
<type>4</type>
<activationId>test [19, 6313, 3681]</activationId>
<rule>test</rule>
<declarations>f=Feature.ORF00019(19);
hit=org.jcvi.annotation.facts.HmmHit.ORF00019.TIGR00549.ABOVE_TRUSTED.13
836
502(3681); p=FeatureProperty.TIGR00549(6313)</declarations>
</org.drools.audit.event.ActivationLogEvent>
<org.drools.audit.event.ActivationLogEvent>
<type>6</type>
<activationId>test [19, 6313, 3681]</activationId>
<rule>test</rule>
<declarations>f=Feature.ORF00019(19);
hit=org.jcvi.annotation.facts.HmmHit.ORF00019.TIGR00549.ABOVE_TRUSTED.13
836
502(3681); p=FeatureProperty.TIGR00549(6313)</declarations>
</org.drools.audit.event.ActivationLogEvent>
<org.drools.audit.event.ActivationLogEvent>
<type>7</type>
<activationId>test [19, 6313, 3681]</activationId>
<rule>test</rule>
<declarations>f=Feature.ORF00019(19);
hit=org.jcvi.annotation.facts.HmmHit.ORF00019.TIGR00549.ABOVE_TRUSTED.13
836
502(3681); p=FeatureProperty.TIGR00549(6313)</declarations>
</org.drools.audit.event.ActivationLogEvent>
Nelson
----------------------------------------------------------------------
Message: 1
Date: Tue, 6 Jul 2010 12:39:22 -0400
From: Edson Tirelli <tirelli(a)post.com>
Subject: Re: [rules-users] How is this possible?
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID:
<AANLkTik_Ge7ay6M4gcakpUAgccshwCmU7ke2IYNFJhg6(a)mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"
Nelson,
How do you know one rule is firing, but not the other? Are you
checking
the audit log or using an agenda listener for that? Otherwise, if you
think
the rule is not firing because of your println in the consequence, you
might
be looking at the wrong "symptom". There is a huge difference between
writing an "if" like that in the consequence of a rule and writing a
constraint like "hitId == "TIGR00549"" in the condition of the rule,
because
the LHS of a rule is evaluated at "insert" time while the RHS is
evaluated
at the consequence fire time.
So, from the information given, trying to imagine a scenario to
explain
why the syserr in the "test" rule shows up while the one in the first
rule
doesn't, here is a possible explanation:
* You insert the fact HmmHit, it activates both rules, but in a given
time,
before the "Hmm Hit" rule is fired, the value of hitId changes. In this
case, the rule would still fire, but the "if" in the consequence is only
evaluated after the change (during consequence fire time) and so
evaluates
to false, not printing the message.
This is a pretty simple use case and we have several customers/users
with
thousands of rules and millions of facts in a single session and they
are
not facing anything like you described. So, while a bug is always a
possible
explanation, we need a way to reproduce your problem in order to give
you a
proper answer.
Edson
*******************************************
16 years