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
15 years, 8 months
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.
______________________________________________________________________
15 years, 8 months
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.
15 years, 8 months
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.
15 years, 8 months
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.
15 years, 8 months
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.
15 years, 8 months
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
*******************************************
15 years, 8 months
Re: [rules-users] Problem Setting globals in drools session
by Greg Barton
Let's keep this on the list. Also, since your reply text is at the end of the email I'll repaste it below:
--- On Tue, 7/6/10, djerir smail <1983djerir(a)gmail.com> wrote:
> > Thank you for your
> response,my application is deployed in Mobicents slee AS, I
> think it uses multiple classloaders .how can I fix that
> please
> >
I've never used Mobicents before so I don't have the first clue, but a quick google on "mobicents classloader" returns this as the first result:
http://markmail.org/message/z3sy5gtaghxc3366
>From that link: "Working with classpaths/URLs would result the same class to be loaded in multiple classloaders, and then you would have linkage errors when passing from one component to other..." Sounds familiar. :) There should be some solution in Mobicents for passing objects between components such that they share a common class.
--- On Tue, 7/6/10, djerir smail <1983djerir(a)gmail.com> wrote:
> From: djerir smail <1983djerir(a)gmail.com>
> Subject: Re: [rules-users] Problem Setting globals in drools session
> To: "Greg Barton" <greg_barton(a)yahoo.com>
> Date: Tuesday, July 6, 2010, 2:25 PM
> Greg Barton a écrit :
> > Does your application use multiple classloaders? It's
> possible for two instances with the same class definition to
> not have "equal" classes if the class is loaded twice from
> different classloaders.
> >
> > --- On Mon, 7/5/10, djerir smail <1983djerir(a)gmail.com>
> wrote:
> >
> >
> >> From: djerir smail <1983djerir(a)gmail.com>
> >> Subject: [rules-users] Problem Setting globals in
> drools session
> >> To: "Rules Users List" <rules-users(a)lists.jboss.org>
> >> Date: Monday, July 5, 2010, 2:38 PM
> >> Hello everybody,
> >>
> >> When I try to sett my globals I get this
> error
> >>
> >> 2010-07-05 21:26:04,531 ERROR [STDERR]
> >> java.lang.RuntimeException: Illegal class for
> global. Expected
> >> [ulb.mfe.srabre.ra.BREINTERFACE], found
> [ulb.mfe.srabre.ra.BREINTERFACE].
> >>
> >> Can anyone explain to me what does this error mean
> please
> >> .
> >>
> >> MY DRL FILE
> >>
> >> package ulb.mfe.srabre.rule
> >>
> >> import ulb.mfe.srabre.ra.BREINTERFACE;
> >> import ulb.mfe.srabre.ra.DROOLSSLEEAgent;
> >>
> >> global ulb.mfe.srabre.ra.BREINTERFACE
> BRERAInterface;
> >> global ulb.mfe.srabre.ra.DROOLSSLEEAgent
> DROOLSSLEEAgent;
> >>
> >> rule "MaxBtsAlarmrule"
> >> dialect "mvel"
> >>
> >> when
> >>
> >> $B : BREINTERFACE()
> >> then
> >> System.out.println(" HELLO
> ");
> >> end
> >>
> >>
> >>
> >>
> >> my code
> >>
> >>
> >> public void Insert(Object fact) {
> >> try{
> KnowledgeSessionConfiguration
> >> sessConfig =
> KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
> >>
> sessConfig.setOption(ClockTypeOption.get("pseudo"));
> >>
> StatefulKnowledgeSession
> >> session =
> knowledgeBase.newStatefulKnowledgeSession();
> >>
> session.setGlobal("BRERAInterface", this.breinter);
> >>
> session.setGlobal("DROOLSSLEEAgent", this.droolssleeAgent);
> >>
> session.insert(this.breinter);
> >>
> System.out.println("Fact is now
> >> inserted");
> >>
> session.fireAllRules();
> >> } catch (Throwable t) {
> >>
> logger.info("sml couldn't set
> >> up a session");
> >>
> t.printStackTrace();
> >> }
> >> }
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users(a)lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >>
> >
> >
> > Thank you for your
> response,my application is deployed in Mobicents slee AS, I
> think it uses multiple classloaders .how can I fix that
> please
> >
>
>
15 years, 8 months
Re: [rules-users] rules-users Digest, Vol 44, Issue 15
by Greg Barton
I think isolating it in a test case is the best way. Like Edson said, this is a simple use case, proven trouble free many times over by many drools users. Isolating the test case will either show you where the funky behavior is happening on your side, or provide a comprehensible regression test for the drools devs to use.
GreG
On Jul 6, 2010, at 12:34 PM, "Axelrod, Nelson" <naxelrod(a)jcvi.org> wrote:
Hi Greg,
I've tried to adjust/increase the JVMP heap memory but that does not
help solve this problem. I've set the VM option
-XX:+HeapDumpOnOutOfMemoryError. No heap dump files are generated, so I
assume that is not the problem either.
I can isolate this problem within a test case and add a bug report to
Drools JIRA. Any other ideas as to how else this could occur, or how to
troubleshoot this further? It is really disconcerting.
Thanks,
Nelson
------------------------------
Message: 3
Date: Tue, 6 Jul 2010 09:05:16 -0700 (PDT)
From: Greg Barton <greg_barton(a)yahoo.com>
Subject: Re: [rules-users] How is this possible?
To: Rules Users List <rules-users(a)lists.jboss.org>
Cc: "Richter, Alexander" <ARichter(a)jcvi.org>,
"<rules-users(a)lists.jboss.org>" <rules-users(a)lists.jboss.org>
Message-ID: <376326.67572.qm(a)web81506.mail.mud.yahoo.com>
Content-Type: text/plain; charset="utf-8"
Does the amount of heap allocated affect it? I'm wondering if there's a
hidden OutOfMemoryError happening. (Which, if you're catching Throwable
anywhere, is a possibility. Use the HeapDumpOnOutOfMemoryError VM flag
to diagnose this.) And this should be easy to reproduce in your unit
tests: just insert many unrelated objects into working memory during
the test. In fact you could construct tests thst show the same code
succeeding without the excess objects then failing with them. That
would be essential if you think this is a core drools problem and want
it fixed.
GreG
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
15 years, 8 months