Coding syntax differences
by kissro@lidp.com
Let me preface my question by saying I'm new to both Java and drools so
if it is silly or the answer is obvious, you know why. Given the two
rules below, what, if any, is the difference between the two?
rule "Low Premium"
when
p : Policy( sex == "m" && premium < 50.00 )
then
p.setStatus( 32 );
end
rule "Low Premium"
when
p: Policy( sex == "m", premium < 50.00 )
then
p.setStatus( 32 );
end
The first rule is from a .drl I coded and the second was generated from
.dsl mapping. My specific question is about the "when" portion. Is
there a difference between the two? Does the "," represent "and"? If
so, how would "or" be written or represented in the .dsl/.drl?
Rod
17 years, 3 months
Assigning variables in decision tables
by Hehl, Thomas
Mark, You made a comment on my JIRA that I thought I'd post here for
discussion:
Mark Proctor commented on JBRULES-1155:
---------------------------------------
anAnwer is a method/function that returns a boolean? Must admit I don't
understand what you are trying to do there. Anyway if all you are trying to
do is assign the results of a function/method call then why not just use an
= assignment?
BooleanAnswer = anAnswer(anAnswer.setAnswer(true));
Any valid java can used.
What I'm really trying to do is simply return a boolean from a set of really
complicated rules in my decision table. I run through the rules and if it
passes, I return true.
The reason I didn't do what you suggested above is b/c there is no
documentation to suggest this is valid syntax and, after several postings to
this list, no one responded to my requests on how to do this assignment.
So, how do I do an assignment in a decision table to simply return a
boolean? Otherwise, can you explain the syntax you posted to me. This
doesn't look like any Java I've seen and I can't make heads or tails of how
it should work.
Thanks.
Thom Hehl
Sr. eJuror Architect
* Office (859) 277-8800 x 144
* Thomas.Hehl(a)acs-inc.com <mailto:Thomas.Hehl@acs-inc.com>
ACS, Inc.
Government Solutions
1733 Harrodsburg Road
Lexington, KY 40504-3617
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message and notify
sender via e-mail at Thomas.Hehl(a)acs-inc.com
<mailto:Thomas.Hehl@acs-inc.com> or by telephone at 859-277-8800 ext. 144.
Thank you.
17 years, 3 months
How to use not operator in drool.
by Gaurav2007
Hi ALL,
I am using drool4.0.1 in my application i am able to use IN,OR,AND operator
but i am facing problem in using not operator.
my requirement of not operator is just like a not gate.
the way i am using it is :
eval(not((Map( this["city"] !="mumbai"))||(Map( this["city"] =="delhi"))))
so can you please help me out to solve this problem:
should i use not operator or some thing else in drool.
Thanks,
--
View this message in context: http://www.nabble.com/How-to-use-not-operator-in-drool.-tf4430240.html#a1...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
examples documentation
by Mark Proctor
As no one from the community was willing to do it :( we've been building
out the examples documentation, although it's slow going. Anyway I've
put up a latest export of just the examples docs, please read and get
feedback asap.
http://www.athico.com/manual/html/ch10.html
Still plenty more to do there, but enough to be useful now :)
Mark
17 years, 3 months
Synasc, Business Rules Forum and RuleML
by Mark Proctor
http://blog.athico.com/2007/09/synasc-business-rules-forum-and-ruleml.html
Synasc, Business Rules Forum and RuleML
<http://blog.athico.com/2007/09/synasc-business-rules-forum-and-ruleml.html>
Members of the Drools team will be at three conferences during September
and October. Being a globally dispersed team we'll also be using this
time to do plenty of R&D, so if you want to get together for some really
heavy technical stuff, then you know where to go :) Of course we'll also
chat about our stuff, at any level, to just about anyone who will listen :)
Synasc 2007 ( September 26-29, 2007 ) http://synasc07.info.uvt.ro
<http://synasc07.info.uvt.ro/>
9th International Symposium on Symbolic and Numeric Algorithms for
Scientific Computing
Timisoara, Romania
Kris and myself will be at Synasc 2007, where there will be a 2 hour
intermediate Drools session with a focus on declarative programming.
Business Rules Forum and RuleML2007 http://www.businessrulesforum.com
<http://www.businessrulesforum.com/> http://2007.ruleml.org
<http://2007.ruleml.org/> (October 21-26, 2007)
Orlando, USA
Edson and myself will be attending both conferences, I'm also on panel
with a preliminary title "Rule Interchange and Applications:Practice and
Opportunities".
17 years, 3 months
Problem loading DRL from DSL?
by kissro@lidp.com
Is there a bug with drools when you try to use a dsl and drl? I've read
several post where people seem to be getting the same errors as I am.
My drl looks like this:
package com.insurance
expander underwriting.dsl
rule "Low Premium"
when
There is a policy
- for a male
- with a premium less than 50.00
then
Accept the policy;
end
I have this code to read the drl and associated dsl and build a package:
String drl = "/underwriting.drl";
String dsl = "/underwriting.dsl";
PackageBuilder builder = new PackageBuilder();
InputStreamReader drlInput = new
InputStreamReader(InsuranceExample.class.getResourceAsStream(drl));
InputStreamReader dslInput = new
InputStreamReader(InsuranceExample.class.getResourceAsStream(dsl));
builder.addPackageFromDrl(drlInput, dslInput);
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( builder.getPackage() );
When I run the code I get a 'ExpanderException'
Exception in thread "main" org.drools.rule.InvalidRulePackage:
org.drools.lang.ExpanderException@157aa53
org.drools.lang.ExpanderException@6f50a8
org.drools.lang.ExpanderException@187814
org.drools.lang.ExpanderException@73a7ab
org.drools.lang.ExpanderException@104faf8
org.drools.lang.ExpanderException@1f8c6df
org.drools.lang.ExpanderException@1c86be5
org.drools.lang.ExpanderException@123b25c
org.drools.lang.ExpanderException@92bbba
org.drools.lang.ExpanderException@162dbb6
org.drools.lang.ExpanderException@146c1d4
org.drools.lang.ExpanderException@5f8172
org.drools.lang.ExpanderException@2ba11b
org.drools.lang.ExpanderException@5e179a
org.drools.lang.ExpanderException@15fadcf
at org.drools.rule.Package.checkValidity(Package.java:408)
at org.drools.common.AbstractRuleBase.addPackage
(AbstractRuleBase.java:288)
Can someone tell me what I'm doing wrong and what the correct code would
be for reading a drl/dsl and building a package and rulebase? Does
building drl rules from a dsl not work in drools 4.0.1?
Thanks,
Rod
17 years, 3 months
Multivariable and multislots
by Lars Braubach
Hi,
I was wondering how I can express pattern matchings in drools
that operate on sets of values (multivalues). As an example I
composed a Jess/Clips rule that is able to match every block
that has a green as well as a red block on top of it.
(deftemplate Block
(slot name(type STRING))
(slot color(type STRING))
(multislot on (type symbol))
)
(defrule multimatch
?b1 <- (Block (on $?a1 ?x $?c1) (color "red"))
?b2 <- (Block (on $?a2 ?x $?c2) (color "green"))
=>(printout t "match multimatch:" ?x ?b1 ?b2))
This rules triggers for every value of the multislot "on" which
is contained in both multifields. I tried playing around with
"memberof" and "contains" in drools but found no possibility
to operate on two sets. Is it possible?
Kind regards,
Lars
17 years, 3 months
Is there a way to get the rule name in the RHS?
by Irving Reid
I'd like to record which rule executed to update an object. I know that I could add code to the RHS to explicitly set a hard-coded rule identifier into the action, but I was wondering if there was a way to take advantage of the rule name, since it's already there.
- irving -
17 years, 3 months
Drools 4 Stateful Session dispose
by mule1
Hello,
I have just started looking at drools 4 to upgrade from drools 3. While
reading the documentation, was wondering whether it is necessary to call
session.dispose() after session.fireAllRules() for the StatefulSession. If I
don't call session.dispose(), does that mean that the session will still be
garbage collected?
Also, Reading the documentation, I was not exactly clear for the difference
between Stateful and Stateless sessions. Can you explain when
StatefulSession and when StatelessSession can be used?
Thanks.
--
View this message in context: http://www.nabble.com/Drools-4-Stateful-Session-dispose-tf4437732.html#a1...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Using Data Enumerations in BRMS 4.0.1 with DSLs
by Shahad Ahmed
Does anyone know if the new data enumeration functionality in the BRMS
version 4.0.1 works with DSL sentences?
I have a Customer object that has a String attribute called value that can
be be one of the values "High", "Medium" and "Low". I've defined a data
enumeration for this as follows in the BRMS:
'Customer.value': ['High','Medium','Low']
This works fine using the guided editor and I see a drop down list
containing ['High','Medium','Low'] whenever I create a rule involving a
Customer value attribute. I then created a DSL which has the following
definitions in it:
[condition][]There is a Customer=c: Customer()
[condition][]- who is {value} value=value == "{value}"
I then created a guided rule that has the following when condition, where [
] represents the text box the guided editor creates to enter a value for the
{value} placeholder:
There is a Customer
- who is [ ] value
However, I had hoped that the data enumeration stuff would have worked out
that {value} represents a Customer.value attribute and consequently provided
a drop down list of values. So, I'm not sure if this is a bug, or this is
just not implemented and a possible JIRA enhancement request.
Thanks,
Shahad
17 years, 3 months