Package parameters
by Yoni Mazar
Hi all,
We are at the begining of a new clinical decision-support project. We are
considering using a BRMS to manage and execute our business logic. As part
of our research, we evaluated JRules and Drools. JRules has a nice feature
that we could not find in Drools. We'd like to know if we are
misunderstanding something, or maybe this feature is missing.
In JRules, one can define a ruleset (corresponds to a package) with
parameters. Each parameter has a datatype (a class), a direction
(in/out/inout), and an alias. Then, within the rules, the user can refer to
the parameter alias. For example, a user can define a ruleset with the
following parameters:
*class=LabResult, direction=in, alias=hemoglobin
*class=LabResult, direction=in, alias=creatinin
Then, within a rule, one can write:
when hemoglobin.value<10 and creatinin.value>34
then...
Now, the application retrieves the patient data accordingle (hemoglobin and
creatinine data separetly) and sets the ruleset parameters:
ruleset.parameters.add("hemoglobin",hemoglobinFact)
ruleset.parameters.add("creatinin",creatininFact)
This approach simplifies the rule authoring process significantly!
Writing this logic in Drools will be:
package cdss
import LabResult;
rule
when
LabResult(type=hemoglobin && value <10)
LabResult(type=creatinin&& value <34)
then...
workingMemory.Assert(hemoglobinFact);
workingMemory.Assert(creatininFact);
Does someone has an idea how to bridge this gap using Drools?
Im not sure if using parameters JRule complies with JSR94 specification.
Thanks,
Yoni
--
View this message in context: http://www.nabble.com/Package-parameters-tp17979190p17979190.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 6 months
Eclipse plugin error: DRL-files in multiple folders?
by Tobias Abstreiter
Hi!
I have a problem using the drools Eclipse plugin 4.0.7 (with Drools 4.0.7).
In our project rules are located in different folders. One of it is called "global" (containing many functions, imports, ...) whereon most of the rules in the other folders depend. The package name is identical.
Running the application works fine but the Eclipse plugin reports many "... cannot be resolved"-errors when I convert the Eclipse Java project into a Drools project. I believe that the plugin has problems to find all rule files. Is that possible?
Is there a way to tell the plugin to look in multiple rule-folders?
Thanks in advance,
Tobias
__________________________________________________________________
MicroNova electronic GmbH
Tobias Abstreiter
Telekommunikation & Netzmanagment
Unterfeldring 17
D-85256 Vierkirchen
Tel.: +49 (08139) 93 00-42
Fax.: +49 (08139) 93 00-80
eMail: Tobias.Abstreiter(a)micronova.de
Web: http://www.micronova.de
Geschäftsführer: Josef W. Karl - Sitz der Gesellschaft: Jetzendorf
Registergericht: Ingolstadt - HRB-Nr.: 181 373
__________________________________________________________________
16 years, 6 months
DSL debugging?
by Barry Kaplan
I have a very simple DSL snippet:
PPositionQuantityAllocatedToLegs {position} {rulePriority}=
Integer(intValue < {position}.quantity) from accumulate(
StrategyLeg(priority > {rulePriority}, instrument == {position}.instrument,
longShort == {position}.longShort, legQuantity : quantity)
legsQuantity(legQuantity) )
In the IDE it seems to expand correctly without errors. However, at runtime
I get the below error. How does one decipher such a message?
Caused by: org.drools.rule.InvalidRulePackage: [20,0]: unknown:20:0
mismatched token: [@148,506:513='expander',<7>,20:0];
at org.drools.rule.Package.checkValidity(Package.java:424)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
at
com.sig.buyingpower.DroolsOptionStrategyBuyingPowerPositionAggregator.loadRules(DroolsOptionStrategyBuyingPowerPositionAggregator.java:91)
at
com.sig.buyingpower.DroolsOptionStrategyBuyingPowerPositionAggregator.<clinit>(DroolsOptionStrategyBuyingPowerPositionAggregator.java:117)
--
View this message in context: http://www.nabble.com/DSL-debugging--tp18095970p18095970.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 6 months
Problems with drools-4.0.7 examples
by Stephen Schaub
I am new to Drools.
I downloaded the drools-4.0.7 examples from
http://download.jboss.org/drools/release/4.0.7.19894.GA/drools-4.0.7-exam...
I have Eclipse 3.3 with the GEF dependency, and installed the Drools
plugins. I then imported the drools examples into a clean Eclipse
workspace. I'm getting many errors reported in the Eclipse Problems
view on the .drl files.
I attempted to run the HelloWorldExample, and got a runtime error. I
checked the build path of the project, and it references
drools-compiler and drools-core projects, neither of which are in my
workspace. I manually removed these, and added the dependencies
mentioned in the Drools README_DEPENDENCIES.txt.
I looked around for info on setting up the drools examples, and didn't
find any. I would appreciate a pointer...
--
Stephen Schaub
16 years, 6 months
Rule syntax question
by Joe12345678990000 Amazander
Greetings,
I have two questions regarding Drools' capability:
1. Does Drools support mathematic operations in the "If" part?
If I use MVEL, can I write something like this:
$h: Holder($h.account.balance - 1000 > 25)
I know this can be replaced as
$h: Holder($h.account.balance >1025)
But I need to know if the first expression is valid. I tested and it did not
work for me - am I doing something wrong?
2. Does Drools support function call with parameters?
If I use MVEL, can I write something like this:
...
import com.mytest.util.CommonFunction.myTest;
...
dialect "mvel"
salience 2
when
$h: Holder(eval(myTest($h.account.balance) >= 0))
then
$r.account.label = 17;
update($r);
end
myTest is a static method of CommonFunction.
>From what I read in the doc, "function" is most useful in the then part -
but can I use it in the "if" part? This does not work for me in my test -
did I do anything wrong?
Any help will be appreciated.
Thanks,
Joe
16 years, 6 months
Drools infixOr with a from Collection Not Working???
by Carlsen, Len
Hi,
I have a rule with an infixOr and an infixAnd that test for objects in a
collection which doesn't execute even though it should.
# This rule will not execute even though it should
rule "FAIL_AorBandC"
when
test : TestClass( string=="TEST" )
( TestClass( string == "A" ) from test.list
or
TestClass( string == "B" ) from test.list )
and
TestClass( string == "C" ) from test.list
then
System.out.println( "FAIL_AorBandC: " + test.getString() );
end
All other combinations of ANDs and ORs such as (A and B) or C, (A or B),
(A or B) or C will work except the one above if a from collection is
used.
(A or B) and C will work if a from collection is not used.
Has anyone come across this? Is this a bug?
Thanks,
Len
16 years, 6 months
Business rule name weirdness
by Keith Bennett
Does anyone have any idea why drools.getRule().getName() inside of the
rule consequence would be returning the old business rule name? I
renamed the business rule, and I am seeing through testing that the
old name is being resolved by Drools at runtime, not the new one.
What the heck is going on? I am using the Drools 4.0.7 libraries.
Keith
16 years, 6 months
Advice sought on choosing Stateful or Stateless sessions
by Ron Kneusel
Greetings!
I read through the manual, but it is a little too terse regarding when one might choose Stateless versus Stateful sessions. My initial testing has been with Stateful sessions and these work nicely but memory use explodes as the number of facts added increases much beyond 100.
So, my questions:
1. Do stateless sessions execute faster than stateful? I'm assuming that even if they don't, they use memory more effciently?
2. I read that stateless sessions do not allow for facts to be modified yet I saw an example online which was using "insert()" in the DRL file. Will this work if there is a rule that has not already fired but might after the insert? In a stateless session will a rule only fire once and ignore new facts? (I believe so).
3. It also seems that a stateless session has no agenda and therefore will simply fire the first rule that matches so that salience must be used to prioritize rules. Is this correct?
3. The difference between a stateless session and a sequential stateless session is also unclear (to me) from the manual. Can someone explain it?
What I am looking to build is essentially a filter, something that gets a bunch of input facts and applies the rules to see if any alarms should be raised based on the inputs. My test programs have been using a global which tracks the alarms raised. I just look at it after the engine has run and use it as my output. Each run of the rules engine is separate from the previous run, ie, there is no accumulation of "knowledge", which is why I think a stateless session is the way to go but I'm not sure.
Any help appreciated!
Ron
_________________________________________________________________
The i’m Talkathon starts 6/24/08. For now, give amongst yourselves.
http://www.imtalkathon.com?source=TXT_EML_WLH_LearnMore_GiveAmongst
16 years, 6 months
Drools 4.0.4 and Jboss 4.2.2 GA
by Ojwang Wilson O
All,
I am having the following error when deploying drools 4.0.4 within JBOSS
4.2.2 GA. Please help.
====================
01:06,259 INFO [STDOUT] ERROR 17-03 17:01:06,248
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,318 INFO [STDOUT] ERROR 17-03 17:01:06,316
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,348 INFO [STDOUT] ERROR 17-03 17:01:06,347
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,477 INFO [STDOUT] ERROR 17-03 17:01:06,476
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,506 INFO [STDOUT] ERROR 17-03 17:01:06,506
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,523 INFO [STDOUT] ERROR 17-03 17:01:06,522
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,649 INFO [STDOUT] ERROR 17-03 17:01:06,648
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,660 INFO [STDOUT] ERROR 17-03 17:01:06,659
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,935 INFO [STDOUT] ERROR 17-03 17:01:06,934
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,065 INFO [STDOUT] ERROR 17-03 17:01:08,064
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,243 INFO [STDOUT] ERROR 17-03 17:01:08,242
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,994 INFO [STDOUT] ERROR 17-03 17:01:08,993
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:33,956 INFO [STDOUT] ERROR 17-03 17:19:33,956
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:33,988 INFO [STDOUT] ERROR 17-03 17:19:33,987
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:34,039 INFO [STDOUT] INFO 17-03 17:19:34,038
(SecurityServiceImpl.java:login:45) Logging in user [wojwang]
17:19:34,048 INFO [STDOUT] INFO 17-03 17:19:34,047
(DefaultAuthenticator.java:authenticate:38) User logged in via
default authentication module (no security check).
17:19:34,068 INFO [STDOUT] ERROR 17-03 17:19:34,067
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:24:34,104 INFO [STDOUT] ERROR 17-03 17:24:34,102
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
===================
Regards
Wilson
16 years, 6 months