Subject: Re: [rules-users] DSL is Dropped?
by Sikkandar Nawabjan
Mark,
I did see your reply on one of the question that DSL is not enable for M1. In which version it will be enable. we plan to use milestone.
Is it going to be enable or DSL feature going to be removed?
Thanks and Regs,
Basha
17 years, 7 months
RE: [rules-users] Rules Design Question
by Michael Rhoden
Please give a better example or some pseudo code of what you are trying
to do.
-Michael
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Ronald R.
DiFrango
Sent: Friday, April 06, 2007 8:15 AM
To: Rules Users List
Subject: [rules-users] Rules Design Question
All,
I have a rules design question for the community. I have 3 lists of
different types of objects that I need to sum if a certain attribute is
present on each one of them. Then after the summing has taken place
execute other rules based upon the results of the summation.
Is there a way that I can accomplish this via salience or agenda groups?
Thanks in advance,
Ron
17 years, 7 months
query regarding drl to xml conversion...
by Niloy Debnath
hi,
I'm going to convert a PackageDescr object which has the rules to XML file.I'm trying to convert it into xml using dump method of XmlDumper class. The problem with that is while the rest of the code is fine i cannot get the lhs part. There is no method in fact as far as i know to actually specify the lhs. The setLhs method does not help in this regard. I tried to construct all the parameters ususally specified in the lhs like the ColumnDescr object and FieldBinding object but there is no way to bind these to the PackageDescr object.
So the lhs is coming out as null while the rest of the code is fine ...even the rhs..
I am attaching the code and the output again. please go through and advise.
thanking you,
Niloy Debnath
student(comp sc & engg)
OUTPUT OF TEST2 :
<?xml version="1.0" encoding="UTF-8"?>
<package name="org.drools.examples"
xmlns="http://drools.org/drools-3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-3.0 drools-3.0.xsd">
<import name="org.drools.examples.Hell.Message" />
<rule name="Hell">
<lhs>null
null
</lhs><rhs>System.out.println( message );m.setMessage( "Goodbye cruel world " );m.setStatus( Message.GOODBYE );modify( m );</rhs>
</rule><rule name="Good">
<rule-attribute name="activation-group" value="dekhajak" />
<lhs><rule-attribute name="activation-group" value="dekhajak" />
<rule-attribute name="activation-group" value="dekhajak" />
</lhs><rhs>System.out.println( message ); m.setMessage( message );</rhs>
</rule>
</package>
no visitor implementation for : class org.drools.lang.descr.PatternDescr : org.drools.lang.descr.PatternDescr@14318bb
no visitor implementation for : class org.drools.lang.descr.PatternDescr : org.drools.lang.descr.PatternDescr@14318bb
no visitor implementation for : class org.drools.lang.descr.PatternDescr : org.drools.lang.descr.PatternDescr@14318bb
no visitor implementation for : class org.drools.lang.descr.PatternDescr : org.drools.lang.descr.PatternDescr@14318bb
---------------------------------
Check out what you're missing if you're not on Yahoo! Messenger
17 years, 7 months
DSL not working on 3.1 M1
by Felipe Piccolini
Hi,
I dont know if this is for User or for developer list, but I'm
having problems with dsl expanders on drl file. Using
3.1 M1 plugin and 3.1 M1 core (all with deps) a simple example using
a .dsl expander file compile and fire rules,
but doesnt activate any. The same example not using expander works
fine (I have to put the drl code on drl file and
comment the expander line on the drl file).
Its seems that the expander is not working properly.
Changing the project classpath to use 3.0.6 libs makes all works
fine, the problem is I need to use some functionality
I think is just working on 3.1.
Thx.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 7 months
(no subject)
by Felipe Piccolini
Hi,
I dont know if this is for User or for developer list, but Im
having problems with dsl expanders on drl file. Using
3.1 M1 plugin and 3.1 M1 core (all with deps) a simple example using
a .dsl expander file compile and fire rules,
but doesnt activate any. The same example not using expander works
fine (I have to put the drl code on drl file and
comment the expander line on the drl file).
Its seems that the expander is not working properly.
Thx.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 7 months
XmlDumper related problem
by Niloy Debnath
hi,
i'm trying to implement the VISIT methods of XmlDumper class but it gives the errors like,
no visitor implementation for : class
org.drools.lang.descr.PatternDescr : org.drools.lang.descr.PatternDescr@1a758cb
no visitor implementation for : class
org.drools.lang.descr.PatternDescr : org.drools.lang.descr.PatternDescr@1a758cb
java.lang.NullPointerException
at org.drools.xml.XmlDumper.appendXmlDump(Unknown Source)
at org.drools.xml.XmlDumper.visitPackageDescr(Unknown Source)
at org.drools.examples.test2.main(test1.java:69)
i cant understand why it is giving like...
at org.drools.xml.XmlDumper.appendXmlDump(Unknown Source)
at org.drools.xml.XmlDumper.visitPackageDescr(Unknown Source)
i've the method like this,
XmlDumper xmldumper = new XmlDumper();
xmldumper.visitPackageDescr(pdesc);
where pdesc is the object of PackageDescr class.can anybody help me ? i dont know whether i am able to make you understand about my problem or not,if no then plz tell me what information you need.but plz provide me a solution,i need it urgently.
thanking you,
Niloy Debnath
Student
---------------------------------
Check out what you're missing if you're not on Yahoo! Messenger
17 years, 7 months
Forward references within "when" clauses
by Art Griesser
Hello,
Is it possible to write a rule that specifies two objects hold on to
each other?
When saving the following snippet, the Eclipse IDE complains <<Unable
to return Declaration for identifier 'a'>>:
rule "purple-eyed_ozies"
when
p : Person(eye_color == "purple", nm : name, address == a )
a : Address( person == p, country == "oz")
then
System.out.println( "Found purple-eyed ozian: "+nm );
end
If I can avoid it, I would rather not use keys or object ids to
implement the association or link. For whatever it may be worth, I am
trying to duplicate the following experiment that works in JESS:
(deftemplate person (slot name) (slot eye_color) (slot address) )
(deftemplate address (slot person) (slot street) (slot city) (slot
zip) (slot country) )
(deffunction people ()
(bind ?p (assert(person (name rincewind) (eye_color octarine))))
(bind ?a (assert(address (country klatch) (person ?p))))
; Yes, when we break the bidirectional relationship
; by commenting out the next line, rincewind is no longer found.
(modify ?p (address ?a))
(bind ?p (assert(person (name atuin) (eye_color purple))))
(bind ?a (assert(address (country klatch) (person ?p))))
(modify ?p (address ?a))
(bind ?p (assert(person (name barney) (eye_color purple))))
(bind ?a (assert(address (country oz) (person ?p))))
(modify ?p (address ?a))
(bind ?p (assert(person (name scarecrow) (eye_color octarine))))
(bind ?a (assert(address (country oz) (person ?p))))
(modify ?p (address ?a))
)
(defrule purple-eyed_ozies
?p <- (person (eye_color purple) (name ?nm) (address ?a))
?a <- (address (person ?p) (country oz))
=>
(printout t "Found purple-eyed ozian: " ?nm "
"))
(defrule octarine-eyed_klatchians
?a <- (address (country klatch) (person ?p))
?p <- (person (eye_color octarine) (name ?nm) (address ?a))
=>
(printout t "Found octarine-eyed klatchian: " ?nm "
"))
(people)
(run)
(exit)
Thank you,
Art
17 years, 7 months
Help writing LHS
by Felipe Piccolini
Hello,
Im working in 2 rules and I'm having some problems writing the LHS
in a way the final
user can understand reading the drl (which uses a dsl expander).
The first rule is something like this:
Two facts: User and Form.
The rule is something like this:
'If the User is "User1" or "User2" or "User3" then The Form can
be approved if the amount of Credit1(defined in the Form)
is less than the User's maximum limit and the amount of
Guarantee (another amount of money) is less than User's minum limit"
I try to write it in a DSL:
A user the type User1,User2 or User3=u: User(type=User1|=User2|
=User3, max: maximumLimit, min: minimumLimit)
A Form for a credit=f : Form(cred: creditAmount, guar:
guaranteeAmount)
The Credit amount is less than User's Maximum Limit=cred < max
The Guarantee amount must be less than the User's Minimum
Limit=guar < min
But it doesn't work, I know it shoudnt work, but How can I write the
sentences in a way that can be used all in a rule, but also can be
readed separatedly?
The other rule I need help is something like this:
Having a List with some objects (lets say Credit is the object
with name, value and period as attributes)
"The List only contains Credits of this types: {Credit
(type=1,period=36, value=80) or Credit(type=2,period=48,value=100)
or ... etc, etc)"
How can I write the LHS of something like this if the fact is
the List of Credits?
I have Edson's words in my mind all the time: "eval is EVIL"
So the question is how can I do this without eval and using DSL
templates
so the templates can be readed properly from a human been?
Thanks for your help.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 7 months
NoViableAltException
by John Howard
I'm getting an ANTLR exception when parsing a DRL file. The expression is:
eval(Distribution.getDistributionHex("5332").
isSuitDistributionMatch(dh.getSuitDistribution()))
Split over two lines so that I can post.
NoViableAltException(-1!=[685:3: ( ( (LT|GT|LE|GE) shiftExpression )* |
'instanceof' typeSpec )])
I think this was working in the previous version of JBoss rules, I'm now running
3.1 M1.
Thanks,
John
17 years, 7 months