How do I assign a local variable from a function call?
by samd
All I want to do is something simple like the following:
$changedList: java.util.List( ) from getChangedList( $x, $y );
Then in the same .drl file a function something like:
function List getChangedList( $x, $y )
{
return JavaClass.staticDoSomethingToGetListMethod( $x, $y);
}
I have tried doing this and I get:
Unable to build expression for 'from' node 'getChangedList( $x, $y)'
It looks like there is supposed to be something in between the from and the
function? I have been looking for examples for something like this and have
not found any.
Thanks
--
View this message in context: http://www.nabble.com/How-do-I-assign-a-local-variable-from-a-function-ca...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 4 months
Can drools comtinue testing even if one of the conditions fail ?
by DroolUser
Hi,
I'm using drools for testing if the few attributes of my MO are not null.
I construct the rule in the .drl file in following way :
rule "name"
when
condition1
condition2
condition3
condition4
then
consequence
end
I have observed that the drool engine verifies the conditions line by line
(in the sequence they have written). The moment condition fails, control
comes back to the calling method.
I don't want this. I want the control to execute each and every condition
whether true or false and maintain a record of passed/failed conditions.
Something like this :
rule "name"
when
condition1
log the test result --- This statement should get executed
even if condition 1 fails and control should go to condition 2
condition2
log the test result
condition3
log the test result
condition4
log the test result
then
consequence
end
Is this possible in Drools ?
--
View this message in context: http://www.nabble.com/Can-drools-comtinue-testing-even-if-one-of-the-cond...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 4 months
Mvel autoboxing math
by Joe White
The drl test case below illustrates a problem with math inside of drools
when using the mvel dialect. When using autoboxing the order of
operations (and parens) are not respected. This is using drools 5.0M1
and mvel-2.0-dp4.jar. The correct answer is 80 and the answer provided
with autoboxing in the mvel dialect is 100.
I'm uncertain of how to create a viable test case in pure mvel to add it
to their jira. Any help is appreciated,
Thanks,
Joe
package test;
dialect "mvel"
rule "TestRule"
when
then
double value=(2*new Double("50"))-10-10;
System.out.println(value);
double valueTwo=(2*50)-10-10;
System.out.println(valueTwo);
End
RESULTS
Wrong = 100.0
Right = 80.0
16 years, 4 months
Writing rules using terminology based expressions.
by Shahim Essaid
Hi all,
I would appreciate some advice on how to best use Drools and how to
write rules in my situation. I am new to Drools so my following
descriptions might not be very accurate or clear.
I will be writing rules that compare SNOMED terminology expressions
against similar expressions in the working memory. SNOMED is a medical
terminology and it defines medical concepts by using attributes
(relationships) and values. Both the attributes and the values are also
concepts in the terminology. The concepts are hierarchical and they
frequently have multiple inheritance as part of their definition. SNOMED
expressions are basically one or more concepts (including nested
concepts) composed together and they might have their properties refined
and they might also have optional attributes set. There is an object
model for these expressions and concepts. See the example below.
Basically, using a SNOMED expression (the query expression), it is
possible to query a set of other expressions to see if one of them will
satisfy the query criteria. There is an algorithm for applying this
query to an expression and this algorithm can indicate if the query
expression matches another expression or subsumes it. The other option
is to send both expressions to a terminology service to perform this
algorithm and get back a boolean result.
My question is about where I should implement this algorithm? How can I
hook this algorithm into Drools so that Drools will treat these
expressions in a special way? The usual type and value checks are not
useful in this condition because the two expressions have to be first
normalized and then compared. This normalization and comparison is done
according to the SNOMED algorithms. Each attribute and value from both
expressions will have to be tested to see if they have a parent-child
relationship in the terminology’s semantic network.
The few options I thought of include treating expressions as strings.
This will allow me to retrieve the expression string from each object in
the working memory and then send it, along with the expression string in
the rule, to the matching algorithm. The other option is to send the
rule string to the memory object using an eval(). From what I know, I
think that this will not be an efficient method because all the rules
will fall under a single Java type.
The other option is to represent the expressions in their object form
and have the objects implement the needed algorithms. In this case, how
do I create an instance of this expression in a rule so that I can have
it work with the expression objects in the memory?
A sample expression is shown below using a textual form. The terms could
be removed and have the same expression represented using only the codes.
284196006|Burn of skin|:
246112005|Severity|=24484000|severe,
363698007|Finding Site|=
(113185004|Structure of skin between fourth and fifth
toes|:272741003|Laterality|=7771000|left)
I am expecting that there will be a large number of rules and the
working memory might have between 10 to 100 expressions.
Any ideas for how to approach this problem are greatly appreciated. I am
interested in both a simple short term approach that I could use quickly
and a more efficient long term approach.
Thank you,
Shahim
16 years, 4 months
Max packages
by Joe White
Can someone help me understand the relationship between the number of
Packages in a single RuleBase and PermGen memory consumption? I have a
test that generates 200 rules and then adds those rules as different
packages to a single rule base. PermGen consumption grows near linearly
with the addition of Packages to the rule base and on a default PermGen
setting the JVM runs out of PermGen after about 120 packages.
Is every new Package and RuleBase backed by a set of generated Classes?
Is there a way to get around the amount of class generation that is
taking place?
The test has been run against Drools 5.
Thank you for your help,
Joe
16 years, 4 months
RE: [rules-users] Java code Vs Drools
by Hehl, Thomas
Right, including optimization controls over garbage collection.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Corneil du Plessis
Sent: Wednesday, August 13, 2008 8:50 AM
To: 'Rules Users List'
Subject: RE: [rules-users] Java code Vs Drools
No HotSpot refers to the portion of the JVM that compiles java bytecode to
native code and applies various optimisations over time depending on the
frequency with which code is executed.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Hehl, Thomas
Sent: 13 August 2008 13:47
To: 'Rules Users List'
Subject: RE: [rules-users] Java code Vs Drools
What does this mean? Because of garbage collection?
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Corneil du Plessis
Sent: Wednesday, August 13, 2008 5:42 AM
To: 'Rules Users List'
Subject: RE: [rules-users] Java code Vs Drools
Make sure when you do performance testing that you run through enough
iterations so that the engine code benefits from HotSpot.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Harsh Jetly
Sent: 13 August 2008 11:03
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Java code Vs Drools
I have been evaluating the rule engine (ie Drools 4.0.4). I have created an
application which has about 20 rules . I insert about 500 arraylists into
the working memory and each arraylist contains about 4 objects. The rule
engine picks the object that is the best match from the arraylist and stores
it .
This processing takes about 0.953 secs .
Now this very same scenario I have implemented in using java code (if
..else)...it takes about 0.016secs .
I was expecting the rule engine to give a better performance. Considering
the use of alpha node caching and other factors of the rete algorithm.
This is how one of the rules look in the rule file :
rule "P1 110"
salience 1
activation-group "1"
when
PriorityType( pricetype == "10,20,30,40,110" )
list :ArrayList( )
t:TlbObjectAttributeData( lngAttrTypeId == 110 ) from list
then
result.add(t);
end
Am I doing something wrong or this application is not harnessing the pluses
of the rule engine .
If so can you please tell me which kind of application should I build to
highlight the performance of a rule engine .
Appreciate it
Regards
Harsh Jetly
SOA
Center of Excellence
______________________________________________________________________
_______________________________________________
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
_______________________________________________
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
16 years, 4 months
RE: [rules-users] Java code Vs Drools
by Hehl, Thomas
What does this mean? Because of garbage collection?
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Corneil du Plessis
Sent: Wednesday, August 13, 2008 5:42 AM
To: 'Rules Users List'
Subject: RE: [rules-users] Java code Vs Drools
Make sure when you do performance testing that you run through enough
iterations so that the engine code benefits from HotSpot.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Harsh Jetly
Sent: 13 August 2008 11:03
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Java code Vs Drools
I have been evaluating the rule engine (ie Drools 4.0.4). I have created an
application which has about 20 rules . I insert about 500 arraylists into
the working memory and each arraylist contains about 4 objects. The rule
engine picks the object that is the best match from the arraylist and stores
it .
This processing takes about 0.953 secs .
Now this very same scenario I have implemented in using java code (if
..else)...it takes about 0.016secs .
I was expecting the rule engine to give a better performance. Considering
the use of alpha node caching and other factors of the rete algorithm.
This is how one of the rules look in the rule file :
rule "P1 110"
salience 1
activation-group "1"
when
PriorityType( pricetype == "10,20,30,40,110" )
list :ArrayList( )
t:TlbObjectAttributeData( lngAttrTypeId == 110 ) from list
then
result.add(t);
end
Am I doing something wrong or this application is not harnessing the pluses
of the rule engine .
If so can you please tell me which kind of application should I build to
highlight the performance of a rule engine .
Appreciate it
Regards
Harsh Jetly
SOA
Center of Excellence
______________________________________________________________________
_______________________________________________
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
16 years, 4 months
RE: [rules-users] Java code Vs Drools
by Hehl, Thomas
Sorry, I should have said for business software. Systems software requires a
lot more performance tuning.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Hehl, Thomas
Sent: Wednesday, August 13, 2008 7:46 AM
To: 'Rules Users List'
Subject: RE: [rules-users] Java code Vs Drools
While it's always important to keep an eye on performance while writing
code, the things that really cost money are stability and maintainability.
You write your software so it's easy to maintain and reliable and next week
someone will build a faster processor to run it on.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: Wednesday, August 13, 2008 6:18 AM
To: Rules Users List
Subject: Re: [rules-users] Java code Vs Drools
Corneil du Plessis wrote:
> Make sure when you do performance testing that you run through enough
> iterations so that the engine code benefits from HotSpot.
>
Something to be aware of is that there are still many optimsation we can
do to Drools. One of them is to take our interpretted Rete network and
compile it down to bytecode, so that it would resemble something closer
to hand written java. For tight looped stuff, that should give a nice
perf increase. However mostly drools is "fast enough" so we are focusing
on building out the platform and features, but we'll continue to improve
performance slowly overtime - there is still so much more we can do.
Mark
> -----Original Message-----
> From: rules-users-bounces(a)lists.jboss.org
> [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Harsh Jetly
> Sent: 13 August 2008 11:03
> To: rules-users(a)lists.jboss.org
> Subject: [rules-users] Java code Vs Drools
>
>
> I have been evaluating the rule engine (ie Drools 4.0.4). I have created
an
> application which has about 20 rules . I insert about 500 arraylists into
> the working memory and each arraylist contains about 4 objects. The rule
> engine picks the object that is the best match from the arraylist and
stores
> it .
> This processing takes about 0.953 secs .
>
> Now this very same scenario I have implemented in using java code (if
> ..else)...it takes about 0.016secs .
>
> I was expecting the rule engine to give a better performance. Considering
> the use of alpha node caching and other factors of the rete algorithm.
>
> This is how one of the rules look in the rule file :
>
> rule "P1 110"
>
> salience 1
> activation-group "1"
>
> when
> PriorityType( pricetype == "10,20,30,40,110" )
> list :ArrayList( )
> t:TlbObjectAttributeData( lngAttrTypeId == 110 ) from list
> then
> result.add(t);
>
> end
>
>
> Am I doing something wrong or this application is not harnessing the
pluses
> of the rule engine .
>
> If so can you please tell me which kind of application should I build to
> highlight the performance of a rule engine .
>
> Appreciate it
>
>
> Regards
> Harsh Jetly
> SOA
> Center of Excellence
>
>
>
> ______________________________________________________________________
> _______________________________________________
> 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
>
>
_______________________________________________
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
16 years, 4 months
RE: [rules-users] Java code Vs Drools
by Hehl, Thomas
While it's always important to keep an eye on performance while writing
code, the things that really cost money are stability and maintainability.
You write your software so it's easy to maintain and reliable and next week
someone will build a faster processor to run it on.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: Wednesday, August 13, 2008 6:18 AM
To: Rules Users List
Subject: Re: [rules-users] Java code Vs Drools
Corneil du Plessis wrote:
> Make sure when you do performance testing that you run through enough
> iterations so that the engine code benefits from HotSpot.
>
Something to be aware of is that there are still many optimsation we can
do to Drools. One of them is to take our interpretted Rete network and
compile it down to bytecode, so that it would resemble something closer
to hand written java. For tight looped stuff, that should give a nice
perf increase. However mostly drools is "fast enough" so we are focusing
on building out the platform and features, but we'll continue to improve
performance slowly overtime - there is still so much more we can do.
Mark
> -----Original Message-----
> From: rules-users-bounces(a)lists.jboss.org
> [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Harsh Jetly
> Sent: 13 August 2008 11:03
> To: rules-users(a)lists.jboss.org
> Subject: [rules-users] Java code Vs Drools
>
>
> I have been evaluating the rule engine (ie Drools 4.0.4). I have created
an
> application which has about 20 rules . I insert about 500 arraylists into
> the working memory and each arraylist contains about 4 objects. The rule
> engine picks the object that is the best match from the arraylist and
stores
> it .
> This processing takes about 0.953 secs .
>
> Now this very same scenario I have implemented in using java code (if
> ..else)...it takes about 0.016secs .
>
> I was expecting the rule engine to give a better performance. Considering
> the use of alpha node caching and other factors of the rete algorithm.
>
> This is how one of the rules look in the rule file :
>
> rule "P1 110"
>
> salience 1
> activation-group "1"
>
> when
> PriorityType( pricetype == "10,20,30,40,110" )
> list :ArrayList( )
> t:TlbObjectAttributeData( lngAttrTypeId == 110 ) from list
> then
> result.add(t);
>
> end
>
>
> Am I doing something wrong or this application is not harnessing the
pluses
> of the rule engine .
>
> If so can you please tell me which kind of application should I build to
> highlight the performance of a rule engine .
>
> Appreciate it
>
>
> Regards
> Harsh Jetly
> SOA
> Center of Excellence
>
>
>
> ______________________________________________________________________
> _______________________________________________
> 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
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
16 years, 4 months
Java code Vs Drools
by Harsh Jetly
I have been evaluating the rule engine (ie Drools 4.0.4). I have created an
application which has about 20 rules . I insert about 500 arraylists into
the working memory and each arraylist contains about 4 objects. The rule
engine picks the object that is the best match from the arraylist and
stores it .
This processing takes about 0.953 secs .
Now this very same scenario I have implemented in using java code (if
..else)...it takes about 0.016secs .
I was expecting the rule engine to give a better performance. Considering
the use of alpha node caching and other factors of the rete algorithm.
This is how one of the rules look in the rule file :
rule "P1 110"
salience 1
activation-group "1"
when
PriorityType( pricetype == "10,20,30,40,110" )
list :ArrayList( )
t:TlbObjectAttributeData( lngAttrTypeId == 110 ) from list
then
result.add(t);
end
Am I doing something wrong or this application is not harnessing the pluses
of the rule engine .
If so can you please tell me which kind of application should I build to
highlight the performance of a rule engine .
Appreciate it
Regards
Harsh Jetly
SOA
Center of Excellence
______________________________________________________________________
16 years, 4 months