Re : Drools 4.0.x branch has still some issues with serialization
by siddhartha banik
Hi Drools Team,
I have checked out *Drools 4.0.x branch* & found that all my test scenarios
with *"Dynamic Rules"* are now *working fine* *:-)*.
Thanks a lot for fixing the issues so promptly. I appreciate it !!!
Now, we will definitely use Drools in our application.
I have a *Good To have* feature request for Drools: "Include check for
duplicate objects being asserted into Working Memory & don't generate any
activation for such objects or silently don't assert them at all in WM." I
tested this scenario with *JESS*, they are already doing that. This will
save Drools user from doing duplicate check, which is bit costly now.
Or can you please suggest me any simple way, by which still I can achieve
this in Drools ?
Thanks & Happy Drooling
Siddhartha
16 years, 8 months
Re: [rules-users] accumulate / sum and ArrayList
by Gerald Cantor
Edson,
Works like a champ. Thank you so much for you quick response.
Regards,
Gerald
----- Original Message ----
From: Edson Tirelli <tirelli(a)post.com>
To: Rules Users List <rules-users(a)lists.jboss.org>
Sent: Thursday, March 13, 2008 7:17:14 PM
Subject: Re: [rules-users] accumulate / sum and ArrayList
Gerald,
It is not clear if you want to calculate the sum of all integers in the original list or the sum of all integers greater than 0.
Assuming you want to sum all integers greater than 0, see example bellow. Adjust the example to your needs if you want something different.
You already know how to access the elements of a list:
Number( intValue > 0 ) from $mo.getNumbers()
You already know how to collect them:
$i : ArrayList ( ) from collect ( Number( intValue > 0 ) from $mo.getNumbers() )
If instead of collecting them, you want to "accumulate" them:
$total : Number() from accumulate( $n:Number( intValue > 0 ) from $mo.getNumbers(),
sum( $n ) )
Hope it helps,
Edson
2008/3/13, Gerald Cantor <geraldmcantor(a)yahoo.com>:
I have an Object in working memory. This object has an ArrayList of Integer
objects. I am trying to create a rule that will count all occurrences of
Integers in this ArrayList that are non-zero and then calculate the sum of
all the Integers in the ArrayList and then check the total against a range.
I understand how to count the non-zero occurrences but I am at a complete
loss as to how to calculate the sum of the Integer objects in the ArrayList.
Here is the rule I have thus far
rule "Rule 1"
dialect "java"
when
$mo : MyObject( )
$i : ArrayList ( ) from collect ( Number( intValue > 0 ) from
$mo.getNumbers() )
$total : Number( ) from accumulate ???
then
System.out.println("Rule 1: i.size() = " + $i.size());
System.out.println("Rule 1: total = " + $total);
end
I have been unsuccessful in finding a post that deals with how to fill in
the ??? portion of my rule. My apologies in advance if I happen to miss such
a post.
Any help is greatly appreciated.
Regards,
Gerald
--
View this message in context: http://www.nabble.com/accumulate---sum-and-ArrayList-tp16033216p16033216....
Sent from the drools - user mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
-----Inline Attachment Follows-----
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
16 years, 8 months
accumulate / sum and ArrayList
by Gerald Cantor
I have an Object in working memory. This object has an ArrayList of Integer
objects. I am trying to create a rule that will count all occurrences of
Integers in this ArrayList that are non-zero and then calculate the sum of
all the Integers in the ArrayList and then check the total against a range.
I understand how to count the non-zero occurrences but I am at a complete
loss as to how to calculate the sum of the Integer objects in the ArrayList.
Here is the rule I have thus far
rule "Rule 1"
dialect "java"
when
$mo : MyObject( )
$i : ArrayList ( ) from collect ( Number( intValue > 0 ) from
$mo.getNumbers() )
$total : Number( ) from accumulate ???
then
System.out.println("Rule 1: i.size() = " + $i.size());
System.out.println("Rule 1: total = " + $total);
end
I have been unsuccessful in finding a post that deals with how to fill in
the ??? portion of my rule. My apologies in advance if I happen to miss such
a post.
Any help is greatly appreciated.
Regards,
Gerald
--
View this message in context: http://www.nabble.com/accumulate---sum-and-ArrayList-tp16033216p16033216....
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 8 months
Re: [rules-users] Drools low concurrency/high synchronization? !NOSIG!
by Leon S
We ran into this problem after upgrading from 3.0.* to 4.0.4.
Is there a JIRA issue filed for this? I see a few MVEL-related issues scoped
for 4.0.5 and 5.0 releases, but nothing that looks like specifically
covering this problem.
Thanks,
Leon
Mark Proctor wrote:
>
> This looks different to what was fixed in 4.0.4. I'm cc'ing brockm to
> get his feedback as it looks like an MVEL bug on accessors.
>
> Mark
> Fernando Meyer wrote:
>> Hi Ingomar,
>>
>> Which drools version are you using? We made improvements on 4.0.4,
>> that fixes concurrency issues on mvel core, so if you aren't using it
>> please do an update and try test against your environment.
>>
>> Please let me know if your problems go away when you upgrade.
>>
>> Thanks
>>
>> On Jan 22, 2008 11:13 AM, Ingomar Otter <ingomar.otter(a)valtech.de
>> <mailto:ingomar.otter@valtech.de>> wrote:
>>
>> Folks,
>> I am currently trying to scale our implementation by farming out
>> request into mutliple threads. I am on a 4 CPU Mac.
>> A few things I am wondering about:
>> 1. Although I see an increase in CPU load when going from single
>> to multi-threaded processing the throughput increased marginally.
>> I am pretty sure that my measurements are correct. I have checked
>> the GC and this is not the source of congestion. My question here
>> is whether Drools is using lot's of synchronization that may
>> explain this.
>> 2. When I share the RuleBase accross threads (which I think is
>> valid?) I get interesting errors during execution. eg:
>>
>> org.drools.RuntimeDroolsException : Exception executing predicate
>> org.drools.base.mvel.MVELPredicateExpression@bb981e
>> atorg.drools.rule.PredicateConstraint.isAllowedCachedRight(
>> PredicateConstraint.java:246)
>> at
>>
>> org.drools.common.TripleBetaConstraints.isAllowedCachedRight(TripleBetaConstraints.java:200)
>>
>> atorg.drools.reteoo.JoinNode.assertObject(JoinNode.java:150)
>>
>>
>> atorg.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
>>
>> atorg.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
>> at org.drools.reteoo.Rete.assertObject(Rete.java:175)
>> atorg.drools.reteoo.ReteooRuleBase.assertObject
>> (ReteooRuleBase.java:192)
>> at
>>
>> org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
>>
>> at
>>
>> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
>>
>>
>> atorg.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
>>
>>
>> atorg.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)
>>
>> atxxxx.DroolsPD.validate(DroolsPD.java:66)
>> at xxxx.DroolsMTRunner.run(DroolsMTRunner.java:30)
>> at java.lang.Thread.run(Thread.java:552)
>> Caused by: org.mvel.CompileException: cannot invoke getter:
>> getSAClass [declr.class: xxx.AbstractSA; act.class: null]
>> atorg.mvel.optimizers.impl.refl.GetterAccessor.getValue(
>> GetterAccessor.java:52)
>> at
>>
>> org.mvel.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:39)
>>
>> at
>>
>> org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
>>
>> atorg.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
>> at
>>
>> org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
>>
>> at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
>> at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
>>
>> atorg.mvel.MVEL.executeExpression(MVEL.java:235)
>> at
>>
>> org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)
>>
>>
>> atorg.drools.rule.PredicateConstraint.isAllowedCachedRight(PredicateConstraint.java:240)
>> ... 13 more
>> Caused by: java.lang.NullPointerException
>> atsun.reflect.GeneratedMethodAccessor6.invoke (Unknown Source)
>> atsun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:25)
>> atjava.lang.reflect.Method.invoke( Method.java:324)
>> at
>>
>> org.mvel.optimizers.impl.refl.GetterAccessor.getValue(GetterAccessor.java:42)
>>
>> ... 22 more
>>
>> Details:
>> * I use StatelessSessions which are private to the threads
>> * No data is shared between threads (with the exception of the
>> RuleBase, as outline above)
>> * I am on JDK 1.5
>>
>> I would be grateful for any pointers for 'correct' use of Drools
>> in an MT environment.
>> Cheers,
>> Ingomar
>>
>>
>> Ingomar Otter
>> Chief Technology Officer
>> ingomar.otter(a)valtech.de <mailto:ingomar.otter@valtech.de>
>> Mobile: +49 172 2367867
>>
>> Valtech GmbH
>> Bahnstraße 16
>> 40212 Düsseldorf
>> Germany
>>
>> Phone: +49 (0)211 179237-0
>> Fax: +49 211 179237-19
>>
>> www.valtech.de <http://www.valtech.de/>
>>
>> Geschäftsführer: Ingo Kriescher
>> Amtsgericht Düsseldorf HRB48672
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>>
>> --
>> Fernando Meyer http://fmeyer.org
>> JBoss Rules Core Developer
>> fernando(a)fmeyer.org <mailto:fernando@fmeyer.org>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
View this message in context: http://www.nabble.com/Drools-low-concurrency-high-synchronization--%21NOS...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 8 months
.jar with source - bad magic number error
by Rick Lacy
I've sent this to JIRA, too, but I haven't seen this documented anywhere and
just thought I'd throw it out there in case anyone else has the same
problem...
I'm using version 4.0.4 of the BRMS. I'm running RAD 7.0.0.5 (based on
Eclipse 3.2.2 I believe), which runs Websphere 6.1.x. I've noticed an issue
with uploading the model to the BRMS. It's supposed to be possible to
include resources other than .class files in a .jar; in particular there's
an option to include the corresponding .java source files. The BRMS works
fine for me if I try to upload a .jar with only .class files, but if I try
to upload one with source included, I get the dreaded
java.lang.ClassFormatError: … bad magic number at offset=0 exception. The
model might look like it's uploaded ok, but any attempt to validate header
information or generated DRL source will yield this exception. It's not
that bad to just strip out the source on .jar files I have, but it would be
even nicer if I didn't have to ;)
Thanks!
Rick
16 years, 8 months
RE: Can I use drools to solve my problem?
by Anstis, Michael (M.)
I think you misunderstand how rules work.
All Facts inserted into working memory will be compared to all patterns in
all rules; and where a match is found an activation recorded (i.e. LHS
runs).
So the following would group all products of type (if you insert
DelieveryList's into WM and set the type for each list you only need the one
rule):-
rule"group by type"
when
$d : DelieveryList ( $t : productType )
$p : Product( type == $t )
then
$d.add($p)
end
You don't need to "iterate" with rules; simply add all the objects to WM.
Cheers,
Mike
_____
From: KinG CD [mailto:kingcd8@hotmail.com]
Sent: 12 March 2008 19:07
To: Anstis, Michael (M.)
Subject: RE: Can I use drools to solve my problem?
Actually I was able to get near to that, but thank you very much, it cleared
my mind. My problem still is to group things. So I have a list of products
and I want to group them by type. So I want to create N lists for N types,
each list with every product of a certain type.
e.g
Product
-type
-name
-id
=======
productList{product1, product2, product3,...,productN}
I want a rule that
rule"group by type"
when
iterate the List and generate a productListbyType grouping all
products of typeN
then
deliveryList.add(productListbyType)
remove each product from the main List(i dont think i really nedd
that)
end
and loop in that rule until list is 'cleared'(all products have been sent to
their right lists.
sorry for bothering you, but i really searched for that and did not found. I
could iterate the list with the from collect bu i dont know how to use an
"abstract" type, how to iterate for all kind of types. we can have N types.
thank you very much.
_____
Subject: RE: Can I use drools to solve my problem?
Date: Mon, 10 Mar 2008 10:21:45 +0000
From: manstis1(a)ford.com
To: rules-users(a)lists.jboss.org
CC: kingcd8(a)hotmail.com
In my opinion it will be much easier if you insert individual Orders and
Products
Here's a hurriedly put together example to help you think in terms of rules
(I have no experience of your problem domain so this might be laughably
wrong):-
Global ArrayList branch1;
rule "Delievery split - Branch 1"
when
$p : Product( $b : branch = "Branch 1" )
$o : Order( products contains $p )
then
OrderDelievery od = new OrderDelievery($o, $p, $b);
insert(od);
end
rule "Consolidate delieveries"
when
$od : OrderDelievery( branch = "Branch 1" )
then
branch1.add($od);
end
Or you could just retrieve the OrderDelievery objects from WM at the end.
Drools can definately achieve what you want. If you can solve the problem
with hard-coded rules you can solve it with Drools.
Good luck,
Mike
_____
From: KinG CD [mailto:kingcd8@hotmail.com]
Sent: 07 March 2008 17:08
To: Anstis, Michael (M.)
Subject: RE: Can I use drools to solve my problem?
alright. I was trying not to boder you.
My companie is developing a billing software for a e-commerce site. So we
have an Order and we have to transform it into deliveries. So each Order has
many products and I have to filter it and define X deliveries(i call it
'delivery split'). There are filters like disponibility(in how many days it
will be ok), brach(in what city is the product), type(if it is a kit,
ticket...),...
I tried many ways and i really think that drools isn't the best tool for my
problem. The point is that mi boos dont want to use the hard code for define
the deliveries. He wats drolls to do everything. So i tried inserting the
the order in the WM, and using 'rom' chained with 'collect' i could iterate
and set a list based in some rules, but how can i create lists based on the
branch. how can i group in Y different lists the Z different products i
have.
I also inserted each product manually and tried to manipulate each one. But
the point is that the rules should be interdependent but i was not able to
do it.
the resume is that i want to take the order and set N deliveries based on
interdependent rules. i would like to do almost everything with drools not
using the hard code.
Sorry for the English, thanj you very much for the help, i'm a little lost.
ect: FW: Can I use drools to solve my problem?
> Date: Fri, 7 Mar 2008 15:45:22 +0000
> From: manstis1(a)ford.com
> To: rules-users(a)lists.jboss.org
> CC: kingcd8(a)hotmail.com
>
> Posted to forum for a wider audience.
>
> I think you will need to be more specific with your use case.
>
> With kind regards,
>
> Mike
>
> -----Original Message-----
> From: kingcd8(a)hotmail.com [mailto:kingcd8@hotmail.com]
> Sent: 07 March 2008 15:35
> To: Anstis, Michael (M.)
> Subject: Can I use drools to solve my problem?
>
> I have a list of products and want to divide this list in other lists
> applying the rules, than i want to apply the same rules to this new lists.
> So I keep dividing them until no rules are applicable anymore.
>
> Thank you
_____
Encontre o que você procura com mais eficiência! Instale já a Barra de
Ferramentas com Windows Desktop Search! É GRÁTIS!
<http://www.windowslive.com.br/>
_____
Encontre o que você procura com mais eficiência! Instale já a Barra de
Ferramentas com Windows Desktop Search! É GRÁTIS!
<http://www.windowslive.com.br>
16 years, 8 months
conversion of .pkg file to other formats
by Rick Lacy
Greetings.
I'm using Drools for a project at work. I'm investigating the feasibility
of using the BRMS in our environment. I have a question about the binary
packages that are available for download from the BRMS. Given one of these
.pkg files, is there an easy API call that would get me a text string
representing the .drl file equivalent of the .pkg file? I realize that I
can use the 'Show package source' from the BRMS. However, if we decide to
go with .pkg files for deployment, it would be really nice to be able to get
a human-readable form of what was last deployed to production for any given
.pkg for auditing / troubleshooting purposes. I perused the docs, and I
found something similar to what I want, but it seems to be specific to
decision tables.
Thanks,
Rick
16 years, 8 months
Serialize RuleBase ClassNotFoundException error.
by Pedro Costa
Hi All,
I have a RuleBase I use it create a working memory,
I add some object to the working memory,
I execute the rules
I get some results
I serialize both the working memory and the rule base
I need the working memory
So, I try to desirialize the RuleBase
When trying to do so, I get the following error:
java.lang.ClassNotFoundException: No ClassLoaders found for:
com.oss.activation.rules.core.types.clientorder.ServiceOrderShadowProxy
com.oss.activation.rules.core.types.clientorder.ServiceOrder is one of the
objects i added to the working memory
I also tryed create the working memory with the keepReference option set to
false but got the same error....
Any knows what could be wrong here?
Thanks!
Pedro.
16 years, 8 months