working with deep object graph
by Chris Mathrusse
I'm using JBoss Rules 4.0MR2 and I'm just starting out trying to learn the
concepts and syntax. My challenge is that I am placing into Working Memory a
List of Message objects. A Message contains an Order, and Order contains a List
of Line Items, a Line Item contains a Catalog, a Catalog contains a PriceCode,
and a PriceCode contains a value.
I'm trying to create rules that will identify the negative cases. My rules are
designed to find Orders, contained within each Message, that should not be
Released. If any rule finds a match the Order is no longer eligible for Release
and the Message will be updated appropriately. I've had some success with some
of the rules I've defined but now I'm getting into the more complex ones and
they are giving me some challenges when I need to work with Lists. The following
rule compiles and executes correctly but is not complete.
rule "Is Academic or Not For Resale"
when
$msg : Message( state == MessageState.RELEASING )
$order : RequestOrder( requestStatus == RequestStatus.ACCEPT ) from $msg.order
$itemList : List( ) from $order.lineItems
then
System.out.println("Rule Name: " + drools.getRule().getName());
end
So this rule compiles and it does print the message so I know that things are
working. But now my challenge is to test the PriceCode value contained in each
LineItems Catalog?
Message -> Order -> LineItems -> Catalog -> PriceCode -> value
Should I load all the Order and Line Item objects up into working memory or can
I express what I want in a rule without having to do that?
Thanks for taking the time to help me with this.
17 years, 5 months
Rule order in DSL file
by Rajesh.Sachin10
I used 'salience' key word to control the order of firing in drl file. But it
is not working properly when we use both DSL file and DRL file to execute
rules. The order of firing is in random manner in DSL file.
How to control the order of firing in dsl file?
Eg:
My requirement consists of 6 [when] [then] conditions in DSL file.
If first 3 rules get fired, then only the 4th and 5th rule should fire.
Then if 5th rule is fired then 6 rule should execute.
How to control this in DSL file?
--
View this message in context: http://www.nabble.com/Rule-order-in-DSL-file-tf3876953.html#a10985646
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 5 months
Use of the same reference in multipe rules
by Rajesh.Sachin10
I asserted 3 class (Class1, Class2, Class3) in the working memory. I make an
reference for the class (Class1) in the first rule. Is it possible to use
the same reference in the 2nd rule?
Eg:
[when] class : Class1() eval(class.getVarName1() == "{value1}");
[then] .........do something.......
[when] eval(class.getVarName2() == "{value2}");
[then] ...........do something........
My requirement is to use the same class (Class1) in all the rules. I don't
want to iterate other two classes (Class2 & Class3) in rule 2.
--
View this message in context: http://www.nabble.com/Use-of-the-same-reference-in-multipe-rules-tf387342...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 5 months
Help Needed.
by Rajesh_Kumar
hi ,
First of all congratulations to you for JBRMS release.
You and your team has done a great job.
Micheal I am facing some issue , when I use jbrms.
I have written a sample technical rule by following all the steps as
mentioned in the document.
I am able to download binary package also,but when I tried to use this
package in my rule engine class using following code it's giving some
error like ...
FileInputStream fis = new FileInputStream( "C:/drools/TestPackage.pkg"
);
ObjectInputStream ois = new ObjectInputStream( fis );
Object objPackage = ois.readObject() ;
when ObjectInputStream object tries to read the object , its giving
some an error
ois.close();
fis.close();
Could you please help me out for this ...
java.io.InvalidClassException: org.drools.rule.Rule; incompatible types
for field salience
at java.io.ObjectStreamClass.matchFields(Unknown Source)
at java.io.ObjectStreamClass.getReflector(Unknown Source)
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.HashMap.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.drools.rule.PackageCompilationData.readExternal(PackageCompilationDa
ta.java:128)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.rule.Package.readExternal(Package.java:160)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at com.sample.DroolsTest.readRule(DroolsTest.java:36)
at com.sample.DroolsTest.main(DroolsTest.java:17)
17 years, 5 months
decision tables
by kranthikumar dalai
Hi to every one,
Can i examples of drools with decision tables. I gone
through documentation. But can i have some other examples.
Regards:
Kranthi Dalai ( I posted so many querries regarding this,,,,, but no one
answered..)
17 years, 5 months
RE: [rules-users] Decision tables
by Hehl, Thomas
Yes, you can give the spreadsheet to your HR people for modification.
Please read: http://www.catb.org/~esr/faqs/smart-questions.html
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of kranthikumar dalai
Sent: Tuesday, June 05, 2007 8:40 AM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Decision tables
Hi To every one,
I understood the pricing example. But problem is that i
have to give the table to my HR-People that they can modify and update the
rules. That's the question i am asking.
Thanx & Regards:
Kranthi Dalai
17 years, 5 months