Re: [rules-users] [rules-dev] DRL - Local objects

2011-03-23 Thread Felipe Piccolini
Adhir,
   Im facing the same challenge using rules in a ETL process where
performance is a main concern (some millisecs do the different when you have
millions of executions), so I'm using Globals to keep data in the session.
You can add a global object as a global variable in the session scope and
all
the rules will have access to it in conditions and actions.

MyHelperClass helper = new MyHelperClass();
StatelessKnowledgeSession statelessSession  =
kb.newStatelessKnowledgeSession();
if (statelessSession == null){
log.error("Session was not created.");
return;
}
statelessSession.setGlobal("myHelper", helper);

In the DRL you import the class and define the global. You can also define
some static (or not) methods in the helper class to assit you and use them
as functions in your rules (if used as functions, methods needs to be
static, if no static, then they can be used as methods of the global
instance in
the consequence block)

 import com.mycompany.rules.helpers.MyHelperClass;
 import function
com.mycompany.helpers.MyHelperClass.SOME_FUNCTION;

 global com.emycompany.helpers.MyHelperClass helper;

This solution is not ideal, because you relay on java classes (code outside
of the rules and RETE) to perform evaluations (functions with evals in
conditions) and
the consequence hide some code in java classes, which is not so good because
one of the main features of a rule engine is the separation of the logic
from the
static code... but it works and it helps sometimes.

Good luck.


On Wed, Mar 23, 2011 at 7:55 AM, Adhir Mehta  wrote:

> Thanks for the reply.
>
> I think I was not up to the point. Modifying facts re-executes the rules to
> maintain the truth. In my case, I want to pass the data between the rules
> and also do not want rules to execute again. I know if no-loop option is
> specified, it will not be re-executed however I do not want rule engine to
> even go & check for no-loop option (which is additional work).
>
> I may be wrong as I am new to drools.
>
> Thanks,
> Adhir
>
>
> On Wed, Mar 23, 2011 at 11:48 AM, Mark Proctor wrote:
>
>>  On 23/03/2011 05:46, Adhir Mehta wrote:
>>
>> Hi,
>>
>>  I have written the rule DRL file having around 30 rules in it. Some of
>> the rules do intermediate calculation and those calculation result is
>> expected in the other rules in same DRL file. I can do this by modifying the
>> facts objects in one rule and get the value in other rule. However,
>> modifying the facts object rebuild the RETE tree and affects the
>> performance. Is there any way by which I can pass the data across the rules
>> in same DRL file without rebuilding the RETE tree. (I am more concerned
>> about the performance)
>>
>> Please continue this conversation on the USER mailing list
>> http://www.jboss.org/drools/lists.html
>>
>> Modifying facts does not rebuild the rete. Adding/Removing rules causes
>> changes to Rete tree.
>>
>>
>>  Thanks,
>> Adhir
>>
>>
>> ___
>> rules-dev mailing 
>> listrules-dev@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-dev
>>
>>
>>
>> ___
>> rules-dev mailing list
>> rules-...@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>>
>
> ___
> rules-dev mailing list
> rules-...@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>


-- 
-
Felipe Piccolini
felipe.piccol...@gmail.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Question about the FROM feature in RETE

2010-12-02 Thread Felipe Piccolini
Hi all,
Has been so long since the last time I posted something in this email
list is nice to write again here, even if is a silly question.

Please if this question has being answered before don't be angry, and just
say so to make a better search, because looking for it in
the group gave me no results.

About the "from": If I have 2 rules containing a "from a list" sentence in
the LHS, and happens that the from is from the same list, will
RETE share that in the same node? I mean, will drools go through the list
once or twice? I wanna optimize the access to the list.
My first impression is that you guys made a great job and the "from ..."
should be treated as any other conditional item and share nodes...
but I just wanna be sure, because if not, then the best approach is to
extract all the elements in one rule and make the other rules
to just check for each element.

Thanks.

-- 
-----
Felipe Piccolini
felipe.piccol...@gmail.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] template 101

2010-04-27 Thread Felipe Piccolini
Im not sure if you can find a complete standalone example for this, but I
think your problem now is with eval().

Can you copy your stackTrace here?

I think you can not do eval( literal == literal),
but you could make a function to test that if you wanna use eval and give
the function the value of @{symbol}


2010/4/27 Stefan Marconi 

> Hi Felipe,
>
> thank you for your reply. I have now added the extra quotes but to no
> avail. I still get the same errors.
>
> Is there somewhere a stand-alone example with the compile instructions to
> check that everything works? I have the impression that I'm having troubles
> with the whole eclipse config and plugin.
>
> Thanks! Stefan
>
>
> 2010/4/26 Felipe Piccolini 
>
> Using template you will see that the @{} is replaced "just as is" from the
>> data (for example from a spreadsheet), so
>> if you have a value in the example will be replaced as text in the rule
>> and you will have something like this:
>>
>> if @{symbol} == "THE_SYMBOL"
>>
>> ==>
>>
>> rule "A stand alone rule THE_SYMBOL"
>> dialect "mvel"
>> when
>>  eval(THE_SYMBOL == "AAA")
>> then
>> System.out.println("this symbol is" + THE_SYMBOL)
>> end
>> --
>>
>> So as you can see, the variable is no more a variable in the generated
>> rule, just text, so if you wanna use it as a string, you should add
>> double-quote
>> (")
>>
>> your rule template should be something like this:
>>
>>
>> rule "A stand alone rule @{symbol}"
>> dialect "mvel"
>> when
>>  eval("@{symbol}" == "AAA")
>> then
>> System.out.println("this symbol is" + "@{symbol}")
>> end
>>
>>
>>
>>
>> 2010/4/22 Stefan Marconi 
>>
>>>  Hi,
>>>
>>> just starting using drools and need to use templates but having error
>>> messages (described in comments in the code below).
>>> I checked the meaning of the error messages but still can't figure it
>>> out.
>>> I modified an simple rule according to the template section of the drools
>>> manual: btw I use the eclipse with the drools-core plugin.
>>>
>>> Thanks for your help. Stefan
>>>
>>> template header
>>> symbol
>>>
>>> package com.test.processor; # [ERR 102] Line 4:26 mismatched input ';'
>>> expecting 'identifier' in template header
>>> template "test"
>>> rule "A stand alone rule @{symbol}"
>>> dialect "mvel"
>>> when
>>>  eval(@{symbol} == "AAA")
>>> then
>>> System.out.println("this symbol is" + @{symbol})
>>> end
>>> end template # Multiple markers at this line
>>> # - [ERR 103] Line 13:0 rule 'rule_key' failed predicate:
>>> {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
>>> # - [ERR 101] Line 13:4 no viable alternative at input 'template' in rule
>>> end
>>>
>>>
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>>
>> --
>> -
>> Felipe Piccolini
>> felipe.piccol...@gmail.com
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
-
Felipe Piccolini
felipe.piccol...@gmail.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] template 101

2010-04-25 Thread Felipe Piccolini
Using template you will see that the @{} is replaced "just as is" from the
data (for example from a spreadsheet), so
if you have a value in the example will be replaced as text in the rule and
you will have something like this:

if @{symbol} == "THE_SYMBOL"

==>

rule "A stand alone rule THE_SYMBOL"
dialect "mvel"
when
 eval(THE_SYMBOL == "AAA")
then
System.out.println("this symbol is" + THE_SYMBOL)
end
--

So as you can see, the variable is no more a variable in the generated rule,
just text, so if you wanna use it as a string, you should add double-quote
(")

your rule template should be something like this:

rule "A stand alone rule @{symbol}"
dialect "mvel"
when
 eval("@{symbol}" == "AAA")
then
System.out.println("this symbol is" + "@{symbol}")
end




2010/4/22 Stefan Marconi 

> Hi,
>
> just starting using drools and need to use templates but having error
> messages (described in comments in the code below).
> I checked the meaning of the error messages but still can't figure it out.
> I modified an simple rule according to the template section of the drools
> manual: btw I use the eclipse with the drools-core plugin.
>
> Thanks for your help. Stefan
>
> template header
> symbol
>
> package com.test.processor; # [ERR 102] Line 4:26 mismatched input ';'
> expecting 'identifier' in template header
> template "test"
> rule "A stand alone rule @{symbol}"
> dialect "mvel"
> when
>  eval(@{symbol} == "AAA")
> then
> System.out.println("this symbol is" + @{symbol})
> end
> end template # Multiple markers at this line
> # - [ERR 103] Line 13:0 rule 'rule_key' failed predicate:
> {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
> # - [ERR 101] Line 13:4 no viable alternative at input 'template' in rule
> end
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
-
Felipe Piccolini
felipe.piccol...@gmail.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Reading DRL file with large number of rules

2010-02-08 Thread Felipe Piccolini
> > FieldConstraintDescr("message");
> > LiteralRestrictionDescr restr = new
> > LiteralRestrictionDescr("==",String.valueOf( i ));
> > constr.addRestriction( restr );
> > pat.addConstraint( constr );
> > lhs.addDescr( pat );
> > rule.addAttribute( dialect );
> > rule.setLhs( lhs );
> > rule.setConsequence( "System.out.println("+i+");\n" );
> > result.addRule( rule );
> > }
> > return result;
> > }
> >
> > public static class Message {
> >
> > public static final int HELLO = 0;
> > public static final int GOODBYE = 1;
> >
> > private String message;
> >
> > private int status;
> >
> > public String getMessage() {
> > return this.message;
> > }
> >
> > public void setMessage(String message) {
> > this.message = message;
> > }
> >
> > public int getStatus() {
> > return this.status;
> > }
> >
> > public void setStatus(int status) {
> > this.status = status;
> > }
> >
> > }
> >
> > }
> >
> >
> >
> > 2010/2/6 Wolfgang Laun 
> >>
> >> Have you tried increasing the heap size for the JVM?
> >>
> >> "20K rules [of the same] simple form" sounds as if you are
> >> trying to use a hammer where a screwdriver would be appropriate.
> >> If your description is correct, these 20K rules would be nothing
> >> but 20K if statements, in disguised form. There is nothing
> >> in that which would gain from Drools' Rete algorithm with
> >> its superior "many-patterns-many-object" matching capabilities.
> >>
> >> -W
> >>
> >> On Sat, Feb 6, 2010 at 12:42 PM, kpowerinfinity
> >>  wrote:
> >> > Hello,
> >> >
> >> > We are trying to run a DRL file that has more than 20K rules, all of
> >> > which have the simple form:
> >> >
> >> >
> >> >
> >> > rule "testpeoplenumber"
> >> >salience 100
> >> >dialect "mvel"
> >> >when
> >> >LineItem( inventoryItemCode == "8903210392090")
> >> > then
> >> >InventoryItem fact0 = new InventoryItem();
> >> >fact0.setCategoryCode( "ONPROMO" );
> >> >insert(fact0 );
> >> > end
> >> >
> >> > However, the rule file is not getting parsed by the builder, and
> >> > either takes a very long time (well over half an hour), or gives a
> >> > Heap Overflow exception. We tried with a smaller file (about 1K rules,
> >> > and the situation is the same).
> >> >
> >> > The parsing code is:
> >> > org.drools.KnowledgeBaseConfiguration kbc =
> >> > org.drools.KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,
> >> > cl);
> >> >org.drools.KnowledgeBase kbase =
> >> > org.drools.KnowledgeBaseFactory.newKnowledgeBase(kbc);
> >> >org.drools.builder.KnowledgeBuilderConfiguration
> >> > knowledgeBuilderConfig =
> >> >
> >> >
> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,
> >> > cl);
> >> >org.drools.builder.KnowledgeBuilder builder =
> >> > org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(kbase,
> >> > knowledgeBuilderConfig);
> >> >org.drools.builder.impl.KnowledgeBuilderImpl builderImpl =
> >> > builder as org.drools.builder.impl.KnowledgeBuilderImpl;
> >> >
> >> >
> >> >  builder.add(org.drools.io.ResourceFactory.newFileResource(filename),
> >> >org.drools.builder.ResourceType.DRL);
> >> >
> >> > We are using Drools v5. We've tried both with the java jar as well as
> >> > in .NET (using IKVM to compile it).
> >> >
> >> > Any help in understanding why this is happening and how it can be
> >> > avoided will be appreciated.
> >> >
> >> > Warm Regards
> >> > Krishna.
> >> >
> >> > --
> >> > http://kpowerinfinity.wordpress.com
> >> > http://www.linkedin.com/in/kpowerinfinity
> >> > ___
> >> > rules-users mailing list
> >> > rules-users@lists.jboss.org
> >> > https://lists.jboss.org/mailman/listinfo/rules-users
> >> >
> >>
> >> ___
> >> rules-users mailing list
> >> rules-users@lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> >
> > --
> >  Edson Tirelli
> >  JBoss Drools Core Development
> >  JBoss by Red Hat @ www.jboss.com
> >
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
-
Felipe Piccolini
felipe.piccol...@gmail.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] MVEL VariableResolverFactory problem on eclipse

2007-10-05 Thread Felipe Piccolini

ekke,

thanks for the tip... ill try that. anyways, the error appears in the  
"problems" tab, the rules compile with no problems...

thats odd...

about the emails...please tell me if Im sending double emails by  
mistake. Thanks again.


On 04-10-2007, at 11:12, ekke wrote:



felipe,
perhaps something went wrong ?
I really got mails from you twice, but have deleted them in the  
meantime,

I'll watch it and if it happens again I'll tell you.

back to your problem: -clean helps in many cases after upgrading  
plugins,

but you have done it.
so perhaps there are anywhere incompatible MVEL jars on your  
classpath ?

what if you try it with a fresh eclipse install ? same happens ?

ekke


Felipe Piccolini wrote:


wow sorry, but I detect some aggresivity in the air...

I didnt sent any private massage AND to the list. (except for the one
trying to clarify something with mark)

what r u talking about?... and of course I did -clean.

I thought this list was meant to let users interact providing
feedback and ask for problems about drools..
and thats exactly what I did.

If u cant help me with this, then just dont.

Some people has sent me emails asking me about problems I report on
the list and noone answers.

I hope the good community frienship dont be broke for this kind of
missunderstanding. :)

On 03-10-2007, at 16:02, ekke wrote:



felipe,
please DON'T send your messages to the list AND to private mail-
accounts !
.have you started eclipse with -clean ?
ekke

Felipe Piccolini wrote:


updated to 4.0.1 and creating a new drools project. Any .drl file
(and also rule flows) shows errors with this info on problems tab
on eclipse:
org/mvel/integration/VariableResolverFactory

no more info, actualy I can run the rules (from the Sample.drl) but
it shows the problem.

I tried changing libraries and jdt dependencies, but not succes...
what can it be?...anyone has this problem too?

Thanks.

Felipe Piccolini M.
[EMAIL PROTECTED]





___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
View this message in context: http://www.nabble.com/MVEL-
VariableResolverFactory-problem-on-eclipse-tf4563677.html#a13026772
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]





___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
View this message in context: http://www.nabble.com/MVEL- 
VariableResolverFactory-problem-on-eclipse-tf4563677.html#a13042068

Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] BRMS - how to use variables on Action part?

2007-10-04 Thread Felipe Piccolini

Shahad,

   Thanks for the complete guide, but I already did all that, the  
problem is in the text box on the set/update action part... I cant  
enter any text there, just numbers or 1.2
and I assume is a restriction because the field was declared as  
Number type (Long or Double). If i declare the field as String the  
text box let me enter any text, but it
sorrounds it with "" so the text is converted to a String when I see  
the code (view source).


Thanks anyways. Trying to define a formula on the LHS (where it can  
be defined) didnt help me because I dont know how to use it.


On 04-10-2007, at 11:17, Shahad Ahmed wrote:


Hi Felipe,

When you define your LHS in the BRMS, there is an option to assign  
a variable to the expression. In the When part, there should be a  
little green triangle beside Person. Click on this to get a dialog  
called "Modify constraints for Person". At the bottom of this  
dialog is an option to set a variable name to bind to Person. Type  
p, or whatever you want into the text box and then click the Set  
button beside the text box. You should now have a LHS constraint of  
the form p:Person(...). Now create a Then action by clicking the +  
at the RHS of the Then part. A dialog will appear called "Add a new  
action". The first two option allows you to pick the variable p you  
just created - you probably want the second option of "modify a  
fact" as you want to call update(p) after modifying p. You should  
now see something like Set [p] in the Then part. Click on the Green  
triangle above Set [p] and you will get a dialog called "Add a  
field" with a list of the fields in the Person class. Choose the  
one you want to set (approvedMount?). What this does is actually  
call the method called setApprovedMount (Press View Source button  
to see). The Set action should now have a text box where you can  
enter the parameter $income * 1.2.


I've had a look at the source code for this functionality and it  
only allows Setter methods to be called - unfortunately you cannot  
call any other methods on Person.


Regards
Shahad



On 10/3/07, Felipe Piccolini <[EMAIL PROTECTED]> wrote:
Ok, so to fit on the "not ignored emails" from the list Mark  
posted, I changed the title. However I following in the list

anyways beacuse Im resending this email in less than 3 days.


Note: Im not desperate, nor this is for today. This just came out  
today yesterday and well... its important to me, but I

think I can get a work around for now.


So here is the real on-topic question.
-
Anyone knows how to use variables (from fields) setted on LHS, to  
modify a field on the RHS using the GUI editor

from BRMS?


What I need is to write this rule on BRMS.


rule "Set approvedMount for a women"
no-loop true
when
$p: Person($sex: sex == "F", $income: incomeMount)
then
$p.setApprovedMount($income * 1.2);
update ($p);
end


I know I can use formulas, but I only know how to set those on LHS,  
I dont know how to put a formula on RHS (setter of the field to  
modify).



Thanks.


Felipe Piccolini M.
[EMAIL PROTECTED]








___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] MVEL VariableResolverFactory problem on eclipse

2007-10-04 Thread Felipe Piccolini

wow sorry, but I detect some aggresivity in the air...

I didnt sent any private massage AND to the list. (except for the one  
trying to clarify something with mark)


what r u talking about?... and of course I did -clean.

I thought this list was meant to let users interact providing  
feedback and ask for problems about drools..

and thats exactly what I did.

If u cant help me with this, then just dont.

Some people has sent me emails asking me about problems I report on  
the list and noone answers.


I hope the good community frienship dont be broke for this kind of  
missunderstanding. :)


On 03-10-2007, at 16:02, ekke wrote:



felipe,
please DON'T send your messages to the list AND to private mail- 
accounts !

.have you started eclipse with -clean ?
ekke

Felipe Piccolini wrote:


updated to 4.0.1 and creating a new drools project. Any .drl file
(and also rule flows) shows errors with this info on problems tab
on eclipse:
org/mvel/integration/VariableResolverFactory

no more info, actualy I can run the rules (from the Sample.drl) but
it shows the problem.

I tried changing libraries and jdt dependencies, but not succes...
what can it be?...anyone has this problem too?

Thanks.

Felipe Piccolini M.
[EMAIL PROTECTED]





___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
View this message in context: http://www.nabble.com/MVEL- 
VariableResolverFactory-problem-on-eclipse-tf4563677.html#a13026772

Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] BRMS - how to use variables on Action part?

2007-10-03 Thread Felipe Piccolini
Ok, so to fit on the "not ignored emails" from the list Mark posted,  
I changed the title. However I following in the list

anyways beacuse Im resending this email in less than 3 days.

Note: Im not desperate, nor this is for today. This just came out  
today yesterday and well... its important to me, but I

think I can get a work around for now.

So here is the real on-topic question.
-
Anyone knows how to use variables (from fields) setted on LHS, to  
modify a field on the RHS using the GUI editor

from BRMS?

What I need is to write this rule on BRMS.

rule "Set approvedMount for a women"
no-loop true
when
$p: Person($sex: sex == "F", $income: incomeMount)
then
$p.setApprovedMount($income * 1.2);
update($p);
end

I know I can use formulas, but I only know how to set those on LHS, I  
dont know how to put a formula on RHS (setter of the field to modify).


Thanks.


Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] MVEL VariableResolverFactory problem on eclipse

2007-10-03 Thread Felipe Piccolini
updated to 4.0.1 and creating a new drools project. Any .drl file  
(and also rule flows) shows errors with this info on problems tab

on eclipse:
org/mvel/integration/VariableResolverFactory

no more info, actualy I can run the rules (from the Sample.drl) but  
it shows the problem.


I tried changing libraries and jdt dependencies, but not succes...  
what can it be?...anyone has this problem too?


Thanks.

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] URGENT: BRMS - how to use variables on Action part?

2007-10-03 Thread Felipe Piccolini
Anyone knows how to use variables (from fields) setted on LHS, to  
modify a field on the RHS using the GUI editor

from BRMS?

What I need is to write this rule on BRMS.

rule "Set approvedMount for a women"
no-loop true
when
$p: Person($sex: sex == "F", $income: incomeMount)
then
$p.setApprovedMount($income * 1.2);
update($p);
end

I know I can use formulas, but I only know how to set those on LHS, I  
dont know how to put a formula on RHS (setter of the field to modify).


Thanks.


Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] update Fact on BRMS bad restriction. Please change.

2007-10-03 Thread Felipe Piccolini

Mark,

  Im sorry, I never try to say the work u did is useless. I think  
the work is great and I thank u guys for doing this.


The problem I have is that I need to use the GUI the way the business  
guy write the logic and I cant find the easy way to
do this. Maybe is my fault because I dont know how to use the tool,  
but if you could help me to do this (you say using formulas)

I'll be very thankful.


On 02-10-2007, at 18:49, Mark Proctor wrote:


Felipe Piccolini wrote:
Using the GUI editor for rules is a nice way to make rules,  
however the editor put restrictions on what u can fill on the  
textfields
for a type of attribute, ie. if I have a Double attribute  
(approvedMount) in a bean (Person) I cant make the update of this  
field based on

another field ... what I wanna do (and cant on BRMS GUI) is:

rule "Set approvedMount for a women"
 no-loop true
 when
  $p: Person($sex: sex == "F", $income: incomeMount)
 then
  $p.setApprovedMount($income * 1.2);
  update($p);
end

Where my Person class has incomeMount and approvedMount as Double.

BRMS GUI only let me put 1.2 but no words to refer the $income  
variable.


What can I do?... where will be this possible?... it is quite  
useless if I cant do what I want, because it force me to rebuild  
the bean
Yes all the work we do is totally useless. did you try specifying a  
formula?
to have fields names like "approvedMountIncresedBasedOnIncome" and  
make a formula inside the setter, which is exactly the code

I wanna put on rules, because is the bussines logic.

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] update Fact on BRMS bad restriction. Please change.

2007-10-02 Thread Felipe Piccolini
Using the GUI editor for rules is a nice way to make rules, however  
the editor put restrictions on what u can fill on the textfields
for a type of attribute, ie. if I have a Double attribute  
(approvedMount) in a bean (Person) I cant make the update of this  
field based on

another field ... what I wanna do (and cant on BRMS GUI) is:

rule "Set approvedMount for a women"
no-loop true
when
$p: Person($sex: sex == "F", $income: incomeMount)
then
$p.setApprovedMount($income * 1.2);
update($p);
end

Where my Person class has incomeMount and approvedMount as Double.

BRMS GUI only let me put 1.2 but no words to refer the $income variable.

What can I do?... where will be this possible?... it is quite useless  
if I cant do what I want, because it force me to rebuild the bean
to have fields names like "approvedMountIncresedBasedOnIncome" and  
make a formula inside the setter, which is exactly the code

I wanna put on rules, because is the bussines logic.

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] BRMS Business rules Editor - RHS using variables and functions

2007-08-23 Thread Felipe Piccolini
How can I use variables from LHS to modify an attribute in RHS using  
business rules editor GUI??


Also I added a new function trying to work around but didnt work

I need to get this using business rules editor (GUI):

rule "my rule"
no-loop true
when
$f: Fact(number >= 10, $s: score)
then
$f.setScore($s + 5);
update($f);
end

Thanks.


Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Problem with BRMS (null and modify with variable)

2007-08-23 Thread Felipe Piccolini
Hi,   When I try to compare an attribute against a null I got a "null" instead... the field is an Object. (Date).  When I try to modify an attribute using the last value captured on LHS, I cant use the variable name in the textfield.  The field type is numeric, but I need to use a formula ($var + 1) to modify the value in the BRMS.rule "Age uninformed"	no-loop true	ruleflow-group "age"	when		$p: Person(birthDate == null, $score: score)	then		$p.setScore($score + 5);		update($p);endDo I have to open a Jira for this?Also: I didnt see a Jira, but Is it possible in the business rules editor to add new multiple comparators in new lines???Like this:$p: Person(codProfession == 103 ||	== 201 || 	== 203 || 	== 204 || 	== 211 || 	== 218 || 	== 220 || 	== 403 )Because actually this is aranged in the right side making it dificult to manage when you have several comparatos...

Picture 1.png
Description: application/applefile
<>Thanks.                                                                        Felipe Piccolini M.[EMAIL PROTECTED] ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Minor Issue in writing DSL

2007-08-21 Thread Felipe Piccolini

Edson,

 What about sugar to be able to write DSLs dor this:
   DLS:
   A Person
  - having age equals to 10
  - or equals to 15
  - or greather than 20

  DRL:
 p: Person( age == 10
|| == 15
|| > 20)

Right now, the " - "  put a 'comma' at the end of the  
line making this:

 p: Person( age == 10, || == 15, || > 20)

What throws errors...

  Is it possible to do that? I love the || ==  thing in each  
line...


Thanks.

On 21-08-2007, at 16:14, Saleem Lakhani wrote:

Thanks Edson. That helped. One more thing, can’t we execute  
something simple like: ObjectA(units != families)


When both units & families are defined as int in ObjectA with their  
public get and set methods. This is the exception I am receiving.



org.drools.rule.InvalidRulePackage: Unable to return Declaration  
for identifier 'families' : [Rule name=Rule6, agendaGroup=Rating,  
salience=0, no-loop=false] Its even showing correctly in drl  
editor. If I swap the positions of units & families then the same  
exception is thrown for ‘units’.



regards,

saleem

-Original Message-
From: [EMAIL PROTECTED] [mailto:rules-users- 
[EMAIL PROTECTED] On Behalf Of Edson Tirelli

Sent: Tuesday, August 21, 2007 1:56 PM
To: Rules Users List
Subject: Re: [rules-users] Minor Issue in writing DSL



   Saleem,

   For sure, your mapping must have some typo or mistake. A rule  
like this works and is correct:


rule XYZ
when
ObjectA( application==true || banker==true || officer==true )
then
  // do something
end

Drools does NOT inspect object fields... only public methods.

If you are using a DSL, make sure your "drl" file is named  
"dslr" (this is new in 4.0), so when you open it in eclipse, you  
have a tab that shows you the result of the DSL template  
processing. This way you will be able to see any eventual mapping  
mistake.


[]s
Edson


2007/8/21, Saleem Lakhani < [EMAIL PROTECTED]>:

When I use the syntax below and write like:


[when]ABC=ObjectA(application==true || banker==true || officer==true)


on drl it gives me the following error:


Multiple markers at this line:

-unknown:116:39 Unexpected token '=='

-unknown:116:25 Unexpected token '||'

-unknown:116:64 Unexpected token '=='


Again, there are NO attributes in ObjectA named application, banker  
or officer.



Thanks




-Original Message-
From: [EMAIL PROTECTED] [mailto: rules-users- 
[EMAIL PROTECTED] On Behalf Of Edson Tirelli

Sent: Tuesday, August 21, 2007 9:49 AM
To: Rules Users List
Subject: Re: [rules-users] Minor Issue in writing DSL



   Drools respects encapsulation, so it works with javabean method  
name conventions. If you have a method isApplication() that returns  
a boolean, does not matter how your class calculates the return  
value. Same for any other method. In 4.0, you can write:


ObjectA( application == true || banker == true )

   To map that as a DSL, just follow your usual procedure and syntax.

   []s
   Edson

2007/8/21, Saleem Lakhani < [EMAIL PROTECTED]>:

Hi,


If I had a rule written in DSL using Drools 3.0 like;


1.  [when] when1=r : ObjectA( )

2.  [when] when2=eval(r.isApplication() || r.isBanker())


There are no attributes in class Object with name application and  
banker but there are methods in ObjectA with names isApplication()  
& isBanker() which does some work and return Boolean based on some  
facts.



What is the correct way of writing the same rule using Drools 4.0 ?


Also, if the above attributes were present in ObjectA what would  
have been the best way to write it in DSL using Drools 4.0



Thanks,




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Problems using Packages from BRMS (urls, serialization, enums..)

2007-08-21 Thread Felipe Piccolini
(ObjectInputStream.java:348)
at org.drools.rule.Package.readExternal(Package.java:184)
	at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java: 
1755)
	at java.io.ObjectInputStream.readOrdinaryObject 
(ObjectInputStream.java:1717)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
	at org.drools.util.BinaryRuleBaseLoader.addPackage 
(BinaryRuleBaseLoader.java:82)

... 3 more

Thanks for help... I really need to use enums in my model...  :)



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problems with BRMS

2007-08-14 Thread Felipe Piccolini
I still have the problem in stand alone version trying to save an  
uploaded jar with model classes...


This works fine in brms.war version in jbossAS 4.0.5.

What am I doing wrong?...What can I do to solve this?... I like the  
way extra constrains are added down side (not

in the right side) of the constraint, like this:

$p: Person(code == 101 ||
== 102 ||
== 104 ||
== 105 ||
== 106 ||
== 107 ||

because in the actual BRMS GUI this is added aside...making the  
window larger to the right. and that is awful.


Thanks



Im having problems using the BRMS 4.0GA and BRMS 4.0 stand alone  
(v 1.0).


Things just crash without reason... importing models crash  
sometimes, and trying to create LHS in business rules

got stall... not showing any option to add fact or whatever...

In standalone version I have this error trying to load a model jar:
ERROR 13-08 18:14:32,552 (ApplicationContext.java:log:675)
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:  
java.lang.ClassNotFoundException:  
org.drools.brms.client.rpc.RuleAsset
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.d 
eserialize(ServerSerializationStreamReader.java:156)
at  
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader 
.readObject(AbstractSerializationStreamReader.java:61)
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.d 
eserializeValue(ServerSerializationStreamReader.java:70)
at  
org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.processCall 
(GWTRemoteServiceServlet.java:285)
at  
org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.doPost 
(GWTRemoteServiceServlet.java:181)
at javax.servlet.http.HttpServlet.service(HttpServlet.java: 
709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java: 
802)
at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:173)
at org.jboss.seam.web.ContextFilter.doFilter 
(ContextFilter.java:56)
at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke 
(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke 
(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke 
(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke 
(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke 
(StandardEngineValve.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke 
(AccessLogValve.java:541)
at org.apache.catalina.connector.CoyoteAdapter.service 
(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process 
(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol 
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java: 
664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket 
(PoolTcpEndpoint.java:527)
at  
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt 
(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool 
$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ClassNotFoundException:  
org.drools.brms.client.rpc.RuleAsset

at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal 
(ClassLoader.java:319)

at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.d 
eserialize(ServerSerializationStreamReader.java:135)

... 24 more

PD: I checked the classes/enums in my model jar and all of them  
are Serializable...


PD2: Also have this error trying to show rule source from a  
business rule in the insurance example which is included with the  
stand alone

brms.

Thanks

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman

Re: [rules-users] Problems with BRMS

2007-08-14 Thread Felipe Piccolini
Its me again I have to apologize...it seems it was my fault... as  
far as I can get, the problem
was some classes not having right libraries or imports... jodatime  
for example...  but the halt

on modal window and the lack of good error report had me on limbo...

Thanks anyway.


On 13-08-2007, at 19:03, Felipe Piccolini wrote:

Using the last brms from snapshot repo (http:// 
cruisecontrol.jboss.com/cc/artifacts/jboss-rules) I can load a  
model jar but it
never show me the options to create LHS or RHS ... this is a  
picture of how it stay for ever and ever...


I really need to use the brms, we like it very much but still can  
use it right...




Thanks.

On 13-08-2007, at 18:17, Felipe Piccolini wrote:

Im having problems using the BRMS 4.0GA and BRMS 4.0 stand alone  
(v 1.0).


Things just crash without reason... importing models crash  
sometimes, and trying to create LHS in business rules

got stall... not showing any option to add fact or whatever...

In standalone version I have this error trying to load a model jar:
ERROR 13-08 18:14:32,552 (ApplicationContext.java:log:675)
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:  
java.lang.ClassNotFoundException:  
org.drools.brms.client.rpc.RuleAsset
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.d 
eserialize(ServerSerializationStreamReader.java:156)
at  
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader 
.readObject(AbstractSerializationStreamReader.java:61)
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.d 
eserializeValue(ServerSerializationStreamReader.java:70)
at  
org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.processCall 
(GWTRemoteServiceServlet.java:285)
at  
org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.doPost 
(GWTRemoteServiceServlet.java:181)
at javax.servlet.http.HttpServlet.service(HttpServlet.java: 
709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java: 
802)
at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:173)
at org.jboss.seam.web.ContextFilter.doFilter 
(ContextFilter.java:56)
at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke 
(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke 
(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke 
(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke 
(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke 
(StandardEngineValve.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke 
(AccessLogValve.java:541)
at org.apache.catalina.connector.CoyoteAdapter.service 
(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process 
(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol 
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java: 
664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket 
(PoolTcpEndpoint.java:527)
at  
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt 
(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool 
$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ClassNotFoundException:  
org.drools.brms.client.rpc.RuleAsset

at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal 
(ClassLoader.java:319)

at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.d 
eserialize(ServerSerializationStreamReader.java:135)

... 24 more

PD: I checked the classes/enums in my model jar and all of them  
are Serializable...


PD2: Also have this error trying to show rule source from a  
business rule in the insurance example which is included with the  
stand alone

brms.

Thanks

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo

[rules-users] Problems with BRMS

2007-08-13 Thread Felipe Piccolini
Im having problems using the BRMS 4.0GA and BRMS 4.0 stand alone (v  
1.0).


Things just crash without reason... importing models crash sometimes,  
and trying to create LHS in business rules

got stall... not showing any option to add fact or whatever...

In standalone version I have this error trying to load a model jar:
ERROR 13-08 18:14:32,552 (ApplicationContext.java:log:675)
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:  
java.lang.ClassNotFoundException: org.drools.brms.client.rpc.RuleAsset
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese 
rialize(ServerSerializationStreamReader.java:156)
at  
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.re 
adObject(AbstractSerializationStreamReader.java:61)
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese 
rializeValue(ServerSerializationStreamReader.java:70)
at  
org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.processCall 
(GWTRemoteServiceServlet.java:285)
at org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.doPost 
(GWTRemoteServiceServlet.java:181)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:173)
at org.jboss.seam.web.ContextFilter.doFilter 
(ContextFilter.java:56)
at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke 
(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke 
(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke 
(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke 
(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke 
(StandardEngineValve.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke 
(AccessLogValve.java:541)
at org.apache.catalina.connector.CoyoteAdapter.service 
(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process 
(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol 
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket 
(PoolTcpEndpoint.java:527)
at  
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt 
(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool 
$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ClassNotFoundException:  
org.drools.brms.client.rpc.RuleAsset

at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java: 
319)

at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at  
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese 
rialize(ServerSerializationStreamReader.java:135)

... 24 more

PD: I checked the classes/enums in my model jar and all of them are  
Serializable...


PD2: Also have this error trying to show rule source from a business  
rule in the insurance example which is included with the stand alone

brms.

Thanks

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] no-loop using PropertyChangeListeners instead of update() in rules...doesnt work

2007-08-08 Thread Felipe Piccolini

Hi,

I have a problem with no-loop, I run the integration test for no- 
loop and it works fine because

it uses "update" and the fact dont use propertychangelisteners...

But if I run the same test but the rule doesnt have update(cheese)  
and Chesse has propertyChangeListeners to

notify when an attribute change/is-updated then no-loop doesnt work...

Is this a bug or do i have to look another way to write my rules?

I really likes the way beans can control property changes using  
listeners and dont have to force business ppl to write

update in rules :)

Thanks.

PD: I copied this email because used a reply for an old email (and I  
dont wanna be lost in time) :)


On 26-04-2006, at 8:30, Mark Proctor wrote:
no-loop is in the integration tests and works fine. think it has for  
a while. We will be releasing RC3 any day now, try it then and if its  
still a problem let us know.


Mark
Unknown wrote:
I try to use the rule attribute no-loop but it seems not to function...
I set it to true but each rule is evaluated two or several times.
Is it OK with the RC2??
Thank you


Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] RuleFlow group as default or MAIN?

2007-08-08 Thread Felipe Piccolini
Well I guess I got it wrong... startProcess is not about what  
ruleflow-group start the process, is about what ruleflow definition
start firing all rules... but this leads me to the point that this is  
useful if you have several ruleflows (definitions and files) in the same
ruleBase... why somebody would like to have that?... to control flow?  
or to try to fire a specific rule and then fire subsequent rules

in a flow?...

My problem is that I dont wanna have many ruleflows definitions for 1  
ruleBase, if I would, then I'll use sub-flows...
If I have just 1 ruleflow file, then I dont wanna do startProcess()  
and I still wanna put rules without ruleflow-group defined so they all

belong to the MAIN/DEFAULT group.

Thanks.

On 08-08-2007, at 12:33, Felipe Piccolini wrote:

Is there anyway to set a default ruleflow-group or a MAIN one so I  
can put rules without
ruleflow-group in the same drl as those with ruleflow-group defined  
and use a .rf where I define
a flow in the way that all rules without ruleflow-group (MAIN/ 
DEFAULT) are fired and then a

specific ruleflow-group?

In this way could be not necessary to use session.startProcess 
("my_ruleflowgroup") in java, just
call fireAllRules() and design the process creating a RuleFlowGroup  
called/id as "MAIN".


Actually I can do this programatic, but I'm forced to put ruleflow- 
group in every rule... if I dont wanna to
group some rules in a specific ruleflow-group I have to call them  
as ruleflow-group "MAIN"... and I dont
wanna the business people to worry about flows when they write  
rules if they dont need to...


Thanks.

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RuleFlow group as default or MAIN?

2007-08-08 Thread Felipe Piccolini
Is there anyway to set a default ruleflow-group or a MAIN one so I  
can put rules without
ruleflow-group in the same drl as those with ruleflow-group defined  
and use a .rf where I define
a flow in the way that all rules without ruleflow-group (MAIN/ 
DEFAULT) are fired and then a

specific ruleflow-group?

In this way could be not necessary to use session.startProcess 
("my_ruleflowgroup") in java, just
call fireAllRules() and design the process creating a RuleFlowGroup  
called/id as "MAIN".


Actually I can do this programatic, but I'm forced to put ruleflow- 
group in every rule... if I dont wanna to
group some rules in a specific ruleflow-group I have to call them as  
ruleflow-group "MAIN"... and I dont
wanna the business people to worry about flows when they write rules  
if they dont need to...


Thanks.

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] How to accumulate from objects in a collection?

2007-08-02 Thread Felipe Piccolini

Hi,

   this is just a dumb question for drools-languaje gurus... like  
Edson :)


How ca I write a rule (CE in LHS) for accumulate atributes inside an  
object, but this objects are not facts,
they are inside a collection which is an attribute from a fact...  
pretty messy right?...lol..


well, the business problem is this.

I need to count (accumulate) vacation days used on previous vacation  
requests.
I have an User (which is one fact) having a collection of  
oldVacationRequests

and an actual VacationRequest (the another fact).
So the rules is like this: discount to the available days for  
vacation those used in previous
vacation request, and those days are the days between initDate and  
endDate in each
old vacation request with isAproved seted true and having endDate  
before the actual

vacation request initDate.

did I explain myself?...



so I need to know if this is possible I was trying to do something  
like this...but is obviously wrong...:)

rule "remove used vacation days"
no-loop
when
vr: VacationRequestVO($days: availableDays , $iniDate: initDate 
)
$u: UserVO( $vacReqList: vacationRequestList )
		$usedDays: Number (intValue > 1) from accumulate ( $ovr:  
VacationRequestVO( isAproved == true, endDate < $iniDate, $uDays:  
usedDays),


from $vacReqList, count($uDays))
then
vr.setAvailableDays($days - $usedDays);
end

Thanks...

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Quick syntax question

2007-07-26 Thread Felipe Piccolini

This works:

if your fact is:
cl = Class.forName("java.lang.String");

And the rule is:

rule "Test Class type"
when
$cl: Class(this == (String.class))
then
System.out.println("Test Class: OK");
end



On 26-07-2007, at 12:11, Eric Miles wrote:

Eh, I need a marker fact that identifies if a certain rule needs to  
be run.  So I'm inserting a java.lang.Class object into the  
session.  The T determines if a rule is activated.  Does that make  
sense?


On Thu, 2007-07-26 at 16:06 +0100, Anstis, Michael (M.) wrote:

Surely this LHS is matched by the pattern

$sc : SomeClass()

???

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Eric Miles
Sent: 26 July 2007 15:19
To: rules-users@lists.jboss.org
Subject: [rules-users] Quick syntax question

Is there an easier way to write this LHS?

Class(name == 'com.mycompany.SomeClass')

It would be nice to do something like this:

Class(name == SomeClass.class.getName())

Suggestions?

Thanks all!

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] JBoss Drools 4.0 Released

2007-07-25 Thread Felipe Piccolini
Congratz to all the team!!! Amazing work, really fast and hard work  
done in last months :)



On 25-07-2007, at 5:04, Mark Proctor wrote:

JBoss Drools 4.0 has just been released :) We are really proud of  
what we have done here. We believe that we now have the best and  
most powerful declarative rule language, bar none; commercial or  
open source. The Rule Flow is excellent and I really enjoyed  
updating the Conway's Game of Life to Rule Flow; sub Rule Flows and  
milestone support will be coming in a point release soon. The BRMS  
has long been requested and we put a lot of effort into the ajax  
based design. The Eclipse improvements for the  debug points and  
guided editor should help reduce learning curves, opening us to new  
audiences. Of course performance is now much better, especially for  
complex rules and the new Sequential Mode should be very popular  
with decision services.


Boss Drools 4.0 can be summarised as:
* More expressiveness.
* More powerful declarative keywords.
* Hibernate ready, with 'from' keyword for evaluating external data.
* Pluggable dialects, with new MVEL dialect.
* New Rule Flow and Eclipse modeller.
* Better Performance.
* IDE Improvements.
* Enterprise Ready with Web 2.0 Business Rules Management Studio.

Resources:
* Presentation from Skills Matter http://wiki.jboss.org/wiki/attach? 
page=JBossRules%2FSkillsMatter20070711.pdf
* What's new in JBoss Rules 4.0 http://wiki.jboss.org/wiki/attach? 
page=JBossRules%2Fwhats_new_in_jbossrules_4.0.pdf


Enjoy :)
The Drools Team
Mark Proctor, Michael Neale, Edson Tirelli, Kris Verlaenen,  
Fernando Meyer

http://blog.athico.com

Here is a more detailed enhancements list:
Language Expressiveness Enhancements
* New Conditional Elements: from(hibernate ready), collect,  
accumulate and forall
* New Field Constraint operators: not matches, not contains, in,  
not in, memberOf, not memberOf

* New Implicit Self Reference field: this
* Full support to Conditional Elements nesting, for First Order  
Logic completeness.

* Support to multi-restrictions and constraint connectives && and ||
* Parser improvements to remove previous language limitations, like  
character escaping and keyword conflicts

* Support to pluggable dialects and built-in support to Java and MVEL
* Complete rewrite of DSL engine, allowing for full l10n
* Fact attributes auto-vivification for return value restrictions  
and inline-eval constraints
* Support to nested accessors, property navigation and simplified  
collection, arrays and maps syntax

* Improved support to XML rules
* Experimental Clips parser support

Core Engine Enhancements
* Native support to primitive types, avoiding constant autoboxing
* Transparent optional Shadow Facts
* Rete Network performance improvements for complex rules
* Rule-Flow
* Stateful and Stateless working memories (rule engine sessions)
* Support for Asynchronous Working Memory actions
* Rules Engine Agent for hot deployment and BRMS integration
* Pluggeable dialects and and full support to MVEL scripting language
* Dynamic salience for rules conflict resolution
* Parameterized Queries
* halt command
* Sequential execution mode, faster performance and uses less memory
* Pluggable global variable resolver

IDE Enhancements
* Support for rule break-points on debugging
* WYSIWYG support to rule-flows
* New guided editor for rules authoring
* Upgrade to support all new engine features

Business Rules Management System - BRMS
* User friendly web interface with nice WEB 2.0 ajax features (GWT)
* Package configuration
* Rule Authoring easy to edit rules both with guided editor ( drop- 
down menus ) and text editor

* Package compilation and deployment
* Easy deployment with Rule Agent
* Easy to organize with categories and search assets
* Versioning enabled, you can easily replace yours assets with  
previously saved

* JCR compliant rule assets repository

Miscellaneous Enhancements
* Slimmed down dependencies and smaller memory footprint

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to write constraint about a Map inside a Map?

2007-07-25 Thread Felipe Piccolini

Edson,

Im so sorry, stupid me I dont know what happened but this  
doesnt worked yesterday...
dont remember the error, but now is working... must be murphy and his  
dominating laws :)


Thanks for reply :)

Confirm:  $mf: MyFact( map['mapKey']['innerKey'] == "InnerValue" ) //  
DOes work !! :)


On 25-07-2007, at 8:53, Edson Tirelli wrote:



What error are you getting?

I just tested this in MVELSH and it works:

mvel$ map["outerKey"]["innerKey"]
OUT: innerValue

[]s
Edson


2007/7/24, Felipe Piccolini <[EMAIL PROTECTED]>:
Suppouse I have a Map attribute and one of the values is another  
Map...how can I check a member of the inner Map?


class MyFact{
 Map map;
 public MyFact(){
   this.map = new HashMap();
 }

 setter and getter...

}

-- test --
MyFact myFact = new MyFact();

Map innerMap = new HashMap();
innerMap.put("innerKey", new String("InnerValue"));

Map map = new HashMap();
map.put("mapKey", innerMap);

myFact.setMap(map);

 set the RuleBase and insert myFact as a fact for the  
WorkingMemory...


---

Now... how should I write the rule to check the innerKey ??

rule "test InnerMap"
 when
   $mf: MyFact( map['mapKey']['innerKey'] ==  
"InnerValue" ) // doesnt work...



   $mf: MyFact( map['mapKey'].this['innerKey'] ==  
"InnerValue" ) // doesnt work...
	   $mf: MyFact( map['mapKey'].['innerKey'] == "InnerValue" ) //  
doesnt work...
	   $mf: MyFact( $innerMap: map['mapKey'], $innerMap['innerKey'] ==  
"InnerValue" ) // doesnt work...
   $mf: MyFact( $innerMap: map['mapKey'] -> ($innerMap 
['innerKey'] == "InnerValue" )) // doesnt work...



Thanks.

Felipe Piccolini M.
[EMAIL PROTECTED]





___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] How to write constraint about a Map inside a Map?

2007-07-24 Thread Felipe Piccolini
Suppouse I have a Map attribute and one of the values is another  
Map...how can I check a member of the inner Map?


class MyFact{
 Map map;
 public MyFact(){
   this.map = new HashMap();
 }

 setter and getter...

}

-- test --
MyFact myFact = new MyFact();

Map innerMap = new HashMap();
innerMap.put("innerKey", new String("InnerValue"));

Map map = new HashMap();
map.put("mapKey", innerMap);

myFact.setMap(map);

 set the RuleBase and insert myFact as a fact for the  
WorkingMemory...


---

Now... how should I write the rule to check the innerKey ??

rule "test InnerMap"
 when
   $mf: MyFact( map['mapKey']['innerKey'] ==  
"InnerValue" ) // doesnt work...



   $mf: MyFact( map['mapKey'].this['innerKey'] ==  
"InnerValue" ) // doesnt work...
	   $mf: MyFact( map['mapKey'].['innerKey'] == "InnerValue" ) //  
doesnt work...
	   $mf: MyFact( $innerMap: map['mapKey'], $innerMap['innerKey'] ==  
"InnerValue" ) // doesnt work...
   $mf: MyFact( $innerMap: map['mapKey'] -> ($innerMap 
['innerKey'] == "InnerValue" )) // doesnt work...



Thanks.

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] How to compare to Class type in LHS??

2007-07-24 Thread Felipe Piccolini

Hi,

   Im trying to compare a field to a Class type but when parsing I  
get NPE and when I debug,
the constraint is a ReturnValueConstraint but the  
restriction.getRequiredDeclarations()
return a Declaration[] array initializated, but empty, so I can't get  
the declaration evaluated...
I needed because I'm working on a kind of parser for the rules for  
analisys and testing... but using

the already parsed package.

Here is a pseudo rule for test...

rule "Test A"
when
$mf: MyFact(clazz == (SomeClass.class))
then
System.out.println("Test A: OK");
end

Actualy, the rule compiles (with the NPE output, not stackTrace, just  
the java.lang.NullPointerException,
and it works fine.. I mean I get "Test A: OK" as output, but cant get  
the SomeClass.class reference when I

look into the debugger.

Is this the right way to compare clases? if not, whats the right way?  
(Im trying to not do == "SomeClass")


Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-dev] Re: [rules-users] Problem with update(fact)

2007-07-04 Thread Felipe Piccolini

...Always change the huge signature... sorry...

Edson,

   I tried what you said, but it is not the same... cant get the  
expected result.


With agenda-group the can control de flow, but outside the rules  
(auto-focus didnt work well),

and before that I prefer to use rule-flow-group (and use the GUI).

What Im trying to get is a set of rules that dont depend on flows or  
sequences to work together, because
this set of rules can be large and I dont want the business user have  
to check all rules to know how to write
the next rule... they must be writen in an independent way, but work  
together...


lock-on-active didnt work either to get that result, because when I  
use it stops activations, so the update(fact) actually
has no effect on other rules... I need to put wm.setFocus 
("group1");wm.setFocus("group2");..etc. at the java code...

I dont want to do that...

Maybe you can help me...

an example will be this...(pseudo code)

rule "base vacation days"
when
e: Employee( yearsInCompany > 1)
then
e.setVacationDays(10);
update(e);
end

rule "seniors extra vacation days"
when
e: Employee( yearsInCompany > 4, vd: vacationDays)
then
e.setVacationDays(vd+2);
update(e);
end

rule "old-employee extra vacation days"
when
e: Employee( yearsInCompany > 10, vd: vacationDays)
then
e.setVacationDays(vd+4);
update(e);
end

and so on

So I need the business ppl write this rules without knowing the rest  
of the rules... I think this is

the idea of having a rule-system...

Thanks. 


On 03-07-2007, at 16:40, Edson Tirelli wrote:



   Felipe,

   Thanks. I'm working on it.

   BTW, I forgot to mention, what you are doing to control rules is  
a not a good way to do it. You should try agenda-group+lock-on- 
active rule attributes instead.
   Look at the conway's game of life as an example, and maybe help  
us document the feature... :)


   []s
   Edson

2007/7/3, Felipe Piccolini < [EMAIL PROTECTED]>:
Edson,

Thanks for the reply... it is nasty...

Jira created...
http://jira.jboss.com/jira/browse/JBRULES-966

Thanks

PD: duplicated email because I forgot to cut the huge-company- 
signature... :)


On 03-07-2007, at 14:18, Edson Tirelli wrote:



   Felipe,

   Ok, this is a nasty damn bug. :(

   I'm working on a solution for it right now. May I ask you  
please to open a JIRA for it and attach your code bellow?


   Thank you,
Edson

2007/7/3, Felipe Piccolini < [EMAIL PROTECTED]>:
I know I already asked this in a previous email, but no answer and  
diferent subject... so I'll ask again


I have an issue using update in 2 rules that update the same  
object... a loop is created even when I try to
avoid the loop adding an extra condition to each rule... Im  
inserting an ArrayList as a fact too, so I can check

the extra condition...

Can anyone tell me how to fix this?

Consider this:
//---RULES-
package cl.bluesoft.test

#list any import classes here.
import java.util.List
import java.util.ArrayList

import cl.bluesoft.test.rules.Fact

#declare any global variables here

rule "test update A"
salience 699
no-loop
 when
 $f : Fact($n: number > 0)
$list: ArrayList( this excludes "key1" )
 then
		 System.out.println( "A-fact number1:"+$f.getNumber()+ " list  
1:"+$list);

$list.add( "key1" );
 $f.setNumber($n + 1);
 update ($f);
 update ($list);
 	 	System.out.println("A-fact number2:" +$f.getNumber()+" list  
2:" +$list);

end


rule "test update B"
salience 699
no-loop
when
$f : Fact($n: number > 1)
 $list: ArrayList( this excludes "key2" )
then
 		System.out.println( "B-fact number1:" +$f.getNumber()+" list  
1:" +$list);

 $list.add("key2" );
$f.setNumber($n + 1);
update ($f);
 update ($list);
		 System.out.println("B-fact number2:" +$f.getNumber()+ " list  
2:"+$list);

end

//---FACT-
public class Fact implements Serializable {
private static final long serialVersionUID = 331627137981862975L;

private int number;

public Fact(int number){
this.number = number;
}

public Fact(){
this(0);
}

/**
 * @return the number
 */
public int getNumber() {
return number;
}

/**
 * @param number the num

Re: [rules-users] Problem with update(fact)

2007-07-03 Thread Felipe Piccolini

Edson,

Thanks for the reply... it is nasty...

Jira created...
http://jira.jboss.com/jira/browse/JBRULES-966

Thanks

PD: duplicated email because I forgot to cut the huge-company- 
signature... :)


On 03-07-2007, at 14:18, Edson Tirelli wrote:



   Felipe,

   Ok, this is a nasty damn bug. :(

   I'm working on a solution for it right now. May I ask you please  
to open a JIRA for it and attach your code bellow?


   Thank you,
Edson

2007/7/3, Felipe Piccolini <[EMAIL PROTECTED]>:
I know I already asked this in a previous email, but no answer and  
diferent subject... so I'll ask again


I have an issue using update in 2 rules that update the same  
object... a loop is created even when I try to
avoid the loop adding an extra condition to each rule... Im  
inserting an ArrayList as a fact too, so I can check

the extra condition...

Can anyone tell me how to fix this?

Consider this:
//---RULES-
package cl.bluesoft.test

#list any import classes here.
import java.util.List
import java.util.ArrayList

import cl.bluesoft.test.rules.Fact

#declare any global variables here

rule "test update A"
salience 699
no-loop
 when
 $f : Fact($n: number > 0)
$list: ArrayList( this excludes "key1")
 then
		 System.out.println("A-fact number1:"+$f.getNumber()+ " list 1:"+ 
$list);

$list.add( "key1");
 $f.setNumber($n + 1);
 update ($f);
update ($list);
 		System.out.println("A-fact number2:" +$f.getNumber()+" list 2:" + 
$list);

end


rule "test update B"
salience 699
no-loop
when
$f : Fact($n: number > 1)
$list: ArrayList( this excludes "key2" )
then
		System.out.println( "B-fact number1:"+$f.getNumber()+" list 1:" + 
$list);

 $list.add("key2" );
$f.setNumber($n + 1);
update ($f);
 update ($list);
		 System.out.println("B-fact number2:" +$f.getNumber()+" list 2:"+ 
$list);

end

//---FACT-
public class Fact implements Serializable {
private static final long serialVersionUID = 331627137981862975L;

private int number;

public Fact(int number){
this.number = number;
}

public Fact(){
this(0);
}

/**
 * @return the number
 */
public int getNumber() {
return number;
}

/**
 * @param number the number to set
 */
public void setNumber(int number) {
this.number = number;
}

}

//--TEST-
public class TestUpdateFact implements Serializable {

private static final long serialVersionUID = -574789596641083743L;

/**
 * @param args
 */
public static void main(String[] args) {
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
Package pkg = builder.getPackage();

WorkingMemory session = ruleBase.getStatefulSession();
...etc etc...

List list = new ArrayList();

Fact fact1 = new Fact(1);

session.fireAllRules();

etc, etc...

}

}

//OUTPUT
A-fact number1:1 list 1:[]
A-fact number2:2 list 2:[key1]
B-fact number1:2 list 1:[key1]
B-fact number2:3 list 2:[key1, key2]
A-fact number1:3 list 1:[key1, key2]
A-fact number2:4 list 2:[key1, key2, key1]
B-fact number1:4 list 1:[key1, key2, key1]
B-fact number2:5 list 2:[key1, key2, key1, key2]
A-fact number1:5 list 1:[key1, key2, key1, key2]
A-fact number2:6 list 2:[key1, key2, key1, key2, key1]
B-fact number1:6 list 1:[key1, key2, key1, key2, key1]
B-fact number2:7 list 2:[key1, key2, key1, key2, key1, key2]
A-fact number1:7 list 1:[key1, key2, key1, key2, key1, key2]
A-fact number2:8 list 2:[key1, key2, key1, key2, key1, key2, key1]
B-fact number1:8 list 1:[key1, key2, key1, key2, key1, key2, key1]

 for ever.

So I have a loop... only when I use update and both rules...   
condition about the
list not containing "key1" and "key2" seems not properly chequed...  
I dont know...


Can somebody help me? Am I missing something here?

Thanks.


Felipe Piccolini M.
[EMAIL PROTECTED]





___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
_

[rules-users] Problem with update(fact)

2007-07-03 Thread Felipe Piccolini
I know I already asked this in a previous email, but no answer and  
diferent subject... so I'll ask again


I have an issue using update in 2 rules that update the same  
object... a loop is created even when I try to
avoid the loop adding an extra condition to each rule... Im inserting  
an ArrayList as a fact too, so I can check

the extra condition...

Can anyone tell me how to fix this?

Consider this:
//---RULES-
package cl.bluesoft.test

#list any import classes here.
import java.util.List
import java.util.ArrayList

import cl.bluesoft.test.rules.Fact

#declare any global variables here

rule "test update A"
salience 699
no-loop
when
$f : Fact($n: number > 0)
$list: ArrayList( this excludes "key1")
then
System.out.println("A-fact number1:"+$f.getNumber()+" list 
1:"+$list);
$list.add("key1");
$f.setNumber($n + 1);
update ($f);
update ($list);
System.out.println("A-fact number2:"+$f.getNumber()+" list 
2:"+$list);
end


rule "test update B"
salience 699
no-loop
when
$f : Fact($n: number > 1)
$list: ArrayList( this excludes "key2")
then
System.out.println("B-fact number1:"+$f.getNumber()+" list 
1:"+$list);
$list.add("key2");
$f.setNumber($n + 1);
update ($f);
update ($list);
System.out.println("B-fact number2:"+$f.getNumber()+" list 
2:"+$list);
end

//---FACT-
public class Fact implements Serializable {
private static final long serialVersionUID = 331627137981862975L;

private int number;

public Fact(int number){
this.number = number;
}

public Fact(){
this(0);
}

/**
 * @return the number
 */
public int getNumber() {
return number;
}

/**
 * @param number the number to set
 */
public void setNumber(int number) {
this.number = number;
}

}

//--TEST-
public class TestUpdateFact implements Serializable {

private static final long serialVersionUID = -574789596641083743L;

/**
 * @param args
 */
public static void main(String[] args) {
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
Package pkg = builder.getPackage();

WorkingMemory session = ruleBase.getStatefulSession();
...etc etc...

List list = new ArrayList();

Fact fact1 = new Fact(1);

session.fireAllRules();

etc, etc...

}

}

//OUTPUT
A-fact number1:1 list 1:[]
A-fact number2:2 list 2:[key1]
B-fact number1:2 list 1:[key1]
B-fact number2:3 list 2:[key1, key2]
A-fact number1:3 list 1:[key1, key2]
A-fact number2:4 list 2:[key1, key2, key1]
B-fact number1:4 list 1:[key1, key2, key1]
B-fact number2:5 list 2:[key1, key2, key1, key2]
A-fact number1:5 list 1:[key1, key2, key1, key2]
A-fact number2:6 list 2:[key1, key2, key1, key2, key1]
B-fact number1:6 list 1:[key1, key2, key1, key2, key1]
B-fact number2:7 list 2:[key1, key2, key1, key2, key1, key2]
A-fact number1:7 list 1:[key1, key2, key1, key2, key1, key2]
A-fact number2:8 list 2:[key1, key2, key1, key2, key1, key2, key1]
B-fact number1:8 list 1:[key1, key2, key1, key2, key1, key2, key1]

 for ever.

So I have a loop... only when I use update and both rules...   
condition about the
list not containing "key1" and "key2" seems not properly chequed... I  
dont know...


Can somebody help me? Am I missing something here?

Thanks.


Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Dynamic JavaBeans

2007-06-29 Thread Felipe Piccolini


Mark,

   I'v been trying to get the way to patch that, but I must confess  
that is way too complex for me now.. My best
guess is that when the update(retract/insert) is done, it just take  
the factHandle modified to rebuild the ReteRuleBase
so when the activations are setted in place this doesnt care about  
another fact update to fill the AgendaGroupImpl.


  I dont really know the best way to modify the code... I bow before  
u guys...


 Also tried your suggestion using something like : modify ( cheese )  
{ price = 25, quality = premium }


 But I get compilation erros saying that "modify(myFact) is not  
defined"... so I dont really know how to use
this MVEL functionality... got ur "what is new in drools 4.0", search  
at examples and mailing-list, but cant get the right way

to make that work.

  If you could help me with any working example, or maybe a work- 
around... I sont wanna use a set of rules that must be writen in a
sequence mode using salience I need to write a lot of rules in an  
independent way.


Sorry for my english, and thank you very much.


On 28-06-2007, at 16:43, Mark Proctor wrote:

feel free to work on a patch for us and let us know what you come  
up with.


Mark
Felipe Piccolini wrote:

Mark,

   What about my previous mail where I report an issue with update  
using dynamic JavaBeans (using propertyListeners)?


The problem is that when the engine is fired again from an  
propertyListener the evaluations on conditions (seems to me)
dont take the new state of the Facts changed in the set  
call.


I will try using MVEL modify, but thats not the better solution,  
because the feature of propertyListerners inside javaBeans let

me write my rules in a cleaner way from BRMS/bussines editor.

Thanks.


On 28-06-2007, at 8:28, Mark Proctor wrote:

If it can be done cleanly I'm not averse to it. however there is  
something else...
In the new MVEL dialect you no longer need  
propertychangelisteners if you don't want to call update()


modify ( cheese ) { price = 25, quality = premium }

This will modify all the setters and notify the engine at the end  
of the block setter. Is that good enough for you?


Mark
Yuri de Wit wrote:

Mark,

btw, If this is a feature that makes sense from Drools pov I  
wouldnt

mind giving a shot at implementing it and contributing it back to
Drools.

-- yuri

On 6/28/07, Yuri de Wit <[EMAIL PROTECTED]> wrote:

Sure. The solution I am taking right now is dont use dynamic
properties, which is not optimal (depending on the problem  
property

changes not being batched defeats the purpose of dynamic beans).

The bottom line is that I was hoping that this feature would (1)
either already be taken care of in 4.0 or (2) become a feature  
request

for future releases.

-- yuri

On 6/28/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
> No we don't do anything to batch property change listener  
results. But

> maybe you can do this yourself.
> instead of calling modify, add it to a transaction list (that  
you make
> available in the current context). Then at the end of the  
consequence

> you can iterate that list and call modify on each object. Or
> alternatively don't use dynamic properties.
>
> Mark
> Yuri de Wit wrote:
> > I am not talking about assert, but modify. I have a dynamic  
fact
> > already asserted but now I need to perform N changes on N  
different
> > properties on the same object on the same consequence.  
Drools is going

> > to traverse the RETE network N times once for each time the
> > PropertiesListener is called (each setProperty called).
> >
> > -- yuri
> >
> > On 6/28/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
> >> Why would doing the assert work at the end of the  
consequence be any

> >> quicker than doing it during the consequence?
> >>
> >> Mark
> >> Yuri de Wit wrote:
> >> > I noticed that changes performed on facts asserted  
dynamically causes
> >> > the fact to be modified right away and therefore  
triggering a RETE

> >> > network traversal and rule schedulings.
> >> >
> >> > For apps with a large number of facts this could be a  
significant
> >> > scalability problem. At least in my case, I would like  
to be able to
> >> > use dynamic facts and perform any number of updates and  
have those
> >> > updates commited to working memory only when the rule  
consequence is

> >> > completed.
> >> >
> >> > Looking at the code, it seems that it would not be a  
major effort to
> >> > collect the facts received by the  
ReteooWorkingMemory.propertyChange
> >> > and perform the actual modifyObject() only when the  
consequence

> >> > evaluation is actually completed.
&g

Re: [rules-users] Dynamic JavaBeans

2007-06-28 Thread Felipe Piccolini

Mark,

   What about my previous mail where I report an issue with update  
using dynamic JavaBeans (using propertyListeners)?


The problem is that when the engine is fired again from an  
propertyListener the evaluations on conditions (seems to me)

dont take the new state of the Facts changed in the set call.

I will try using MVEL modify, but thats not the better solution,  
because the feature of propertyListerners inside javaBeans let

me write my rules in a cleaner way from BRMS/bussines editor.

Thanks.


On 28-06-2007, at 8:28, Mark Proctor wrote:

If it can be done cleanly I'm not averse to it. however there is  
something else...
In the new MVEL dialect you no longer need propertychangelisteners  
if you don't want to call update()


modify ( cheese ) { price = 25, quality = premium }

This will modify all the setters and notify the engine at the end  
of the block setter. Is that good enough for you?


Mark
Yuri de Wit wrote:

Mark,

btw, If this is a feature that makes sense from Drools pov I wouldnt
mind giving a shot at implementing it and contributing it back to
Drools.

-- yuri

On 6/28/07, Yuri de Wit <[EMAIL PROTECTED]> wrote:

Sure. The solution I am taking right now is dont use dynamic
properties, which is not optimal (depending on the problem property
changes not being batched defeats the purpose of dynamic beans).

The bottom line is that I was hoping that this feature would (1)
either already be taken care of in 4.0 or (2) become a feature  
request

for future releases.

-- yuri

On 6/28/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
> No we don't do anything to batch property change listener  
results. But

> maybe you can do this yourself.
> instead of calling modify, add it to a transaction list (that  
you make
> available in the current context). Then at the end of the  
consequence

> you can iterate that list and call modify on each object. Or
> alternatively don't use dynamic properties.
>
> Mark
> Yuri de Wit wrote:
> > I am not talking about assert, but modify. I have a dynamic fact
> > already asserted but now I need to perform N changes on N  
different
> > properties on the same object on the same consequence. Drools  
is going

> > to traverse the RETE network N times once for each time the
> > PropertiesListener is called (each setProperty called).
> >
> > -- yuri
> >
> > On 6/28/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
> >> Why would doing the assert work at the end of the  
consequence be any

> >> quicker than doing it during the consequence?
> >>
> >> Mark
> >> Yuri de Wit wrote:
> >> > I noticed that changes performed on facts asserted  
dynamically causes
> >> > the fact to be modified right away and therefore  
triggering a RETE

> >> > network traversal and rule schedulings.
> >> >
> >> > For apps with a large number of facts this could be a  
significant
> >> > scalability problem. At least in my case, I would like to  
be able to
> >> > use dynamic facts and perform any number of updates and  
have those
> >> > updates commited to working memory only when the rule  
consequence is

> >> > completed.
> >> >
> >> > Looking at the code, it seems that it would not be a major  
effort to
> >> > collect the facts received by the  
ReteooWorkingMemory.propertyChange
> >> > and perform the actual modifyObject() only when the  
consequence

> >> > evaluation is actually completed.
> >> >
> >> > Does that makes sense? Or are there side effects I am not  
seeing? Is

> >> > this a problem that 4.0 already resolves?
> >> >
> >> > thanks in advance,
> >> >
> >> > -- yuri
> >> > ___
> >> > rules-users mailing list
> >> > rules-users@lists.jboss.org
> >> > https://lists.jboss.org/mailman/listinfo/rules-users
> >> >
> >>
> >> ___
> >> rules-users mailing list
> >> rules-users@lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Dynamic JavaBeans evaluate again, and again...

2007-06-27 Thread Felipe Piccolini

Hi, I dont know if this is reported or maybe its just my mistake... but
when I use dynamic JavaBeans and PropertyListeners the re-evaluation  
of the rules
seems to skip the condition evaluation, so they fire again.. and  
again, and again..


I have a couple of rules where the conditions are true then I change  
the value of an attribute
and the rules re-evaluate again... and so on. I putted a special  
constraint in the conditions
of that rule so when it is fired, it modify an atribute of another  
fact (tested with the another
attribute of the same fact but it happens anyway), so I try to be  
sure that rule will not fire again...
but it does ignoring the constraints... checked with the logger and  
the debugger...


Is this a bug or it is supposed to be so, and I need to think another  
way to write my rules?...
I want to use the dynamic JavaBeans, so no need to write inserts/ 
updates...  When I set the insert(Object, FALSE)

the problem dissapears.

Thanks.

Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] RuleFlow Constraint Editor and Code Completion (includes screenshots)

2007-06-22 Thread Felipe Piccolini

Thanks Mark, I'll be waiting for it :)



On 22-06-2007, at 11:41, Mark Proctor wrote:


Yes trunk, you can get the last successful build from here:
http://dev45.qa.atl.jboss.com:8585/hudson/job/jboss-rules/

I'll be doing MR3 over the weekend.

Mark
Felipe Piccolini wrote:
Is this (constraint editor) just available on SVN trunk? because I  
downloaded the 4.0.0.11754MR2 from the web and the editor of ruleflow

doesnt show the constraint thing on the Properties View (eclipse).
On 21-06-2007, at 23:07, Mark Proctor wrote:

http://markproctor.blogspot.com/2007/06/ruleflow-constraint- 
editor-and-code.html


 
-

To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email




Felipe Piccolini M.
[EMAIL PROTECTED]






___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] BRMS - How to access rules packages driectly from the repository - Rule Base Deployment

2007-06-08 Thread Felipe Piccolini
But this is not the answer for his question. He is asking a way to  
get the package deployen in the REPOSITORY

not as a file.

Your code gets the .pkg FILE and compile it into a rulebase (which  
can be serializated into JNDI or something else)
But the question is: How (API, example) can I access to a package  
defined using the BRMS gui and located in the
repository???... becase if anyone is going to design and develope a  
kind of rules server or something like that, you

need a way to access rules (packages or rulebases) automaticaly.

Thx.

PD: This is a repeated reply because the older cant get it to the  
list because I forgot to change the extremly-large-work-signature


On 07-06-2007, at 14:24, Fernando Meyer wrote:

You MUST use the org.drools.util.BinaryRuleBaseLoader to load a  
precompiled binary package into your RE classes.


public void testLoadAndExecBinary() throws Exception {
Person p = new Person();
BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader();
loader.addPackage( this.getClass().getResourceAsStream( "/ 
RepoBinPackage.pkg" ) );

RuleBase rb = loader.getRuleBase();
StatelessSession sess = rb.newStatelessSession();
sess.execute( p );
assertEquals(42, p.getAge());
}

ps: im going to create a wiki entry for this.

Fernando Meyer
[EMAIL PROTECTED]
GPG: 5A6D 3374 B055 A513 9A02  A03B 3DB3 7485 D804 DDFB


On Jun 7, 2007, at 2:48 PM, philokratis wrote:





We need to load rule packages (snapshots) directly from the  
repository, preferably from a jmx service in order

build a rulebase and cache the rulebase in JNDI.

How can we access a package snapshot directly from the repository ?
Is there another way besides downloading the package through http  
request?



Michael, regarding the rulebase caching is the use of JNDI the  
reccomended approach

What are the plans for BRMS regarding this part?


Thank you





___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Problems with int and Integer inside Return Value and Predicate Expression

2007-04-11 Thread Felipe Piccolini
The Solicitud object has sumaMontoLCG and sumaMontoGarantia atts as  
int (primitives).


Im using 3.0.6 and java 1.5

I have this simple rule:

rule "montos maximos y minimos"
salience 888
when
		a: Actor(tipo :tipoActor == Actor.JefeOficina, max: limiteMaximo,  
min: limiteMinimo)
		s: Solicitud( sumaLCG: sumaMontoLCG < max, sumaGTIA:  
sumaMontoGarantia -> ( (sumaLCG.intValue() - sumaGTIA.intValue()) <  
min.intValue()) )

then
System.out.println("Suma LCG:"+sumaLCG);
System.out.println("Actor lim max:"+max);
System.out.println("Actor tipo:"+tipo);
end

Fire the rule shows me this error:
org.drools.RuntimeDroolsException:  
java.lang.ArrayIndexOutOfBoundsException: 1

at org.drools.rule.PredicateConstraint.isAllowed(Unknown Source)
at org.drools.common.BetaNodeBinder.isAllowed(Unknown Source)
at org.drools.reteoo.TupleSource.attemptJoin(Unknown Source)
at org.drools.reteoo.JoinNode.assertTuple(Unknown Source)
	at org.drools.reteoo.LeftInputAdapterNode.createAndAssertTuple 
(Unknown Source)

at org.drools.reteoo.LeftInputAdapterNode.assertObject(Unknown Source)
at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source)
at org.drools.reteoo.AlphaNode.assertObject(Unknown Source)
at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source)
at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source)
at org.drools.reteoo.Rete.assertObject(Unknown Source)
at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source)
at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown Source)
at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)
at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)
	at  
cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.fireRulesSOLCRED 
(SolcredRulesPoC.java:85)
	at cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.main 
(SolcredRulesPoC.java:40)

Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.drools.reteoo.FactHandleList.get(Unknown Source)
at org.drools.reteoo.TupleKey.get(Unknown Source)
at org.drools.reteoo.ReteTuple.get(Unknown Source)
at org.drools.reteoo.ReteTuple.get(Unknown Source)
	at  
cl.bluesoft.jbrules.rules.solcred.Rule_montos_maximos_y_minimos_0Predica 
te0Invoker.evaluate 
(Rule_montos_maximos_y_minimos_0Predicate0Invoker.java:14)

... 17 more


When I change the column to:
	s: Solicitud( sumaLCG: sumaMontoLCG < max, sumaGTIA:  
sumaMontoGarantia -> ( (sumaLCG - sumaGTIA) < min) )


its shows this error:
org.drools.rule.InvalidRulePackage: Rule Compilation error The  
operator - is undefined for the argument type(s) java.lang.Integer,  
java.lang.Integer


at org.drools.rule.Package.checkValidity(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
	at cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.readRule 
(SolcredRulesPoC.java:60)
	at cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.main 
(SolcredRulesPoC.java:36)


This happens in a predicate or in a value expression, so I cant use  
this formula... What is wrong?


Thx.



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] DSL not working on 3.1 M1

2007-04-10 Thread 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.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] (no subject)

2007-04-10 Thread 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.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help writing LHS

2007-04-10 Thread 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.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Changing rules at runtime

2007-03-21 Thread Felipe Piccolini
We are working on a solution using Topic JMS with spring, so we build  
a RuleBase and
publish it as a 'post' with one topic, while the 'client' which is a  
WorkingMemoryFactory is
listening on the topic all the time (configurable) so when the topic  
is refreshed, the client
automagicaly refresh his own -singleton- RuleBase and (as is a  
Factory) is able to returns
a newWorkingMemory from that RuleBase. We will send the code with  
examples in few

weeks, I think.

Good Luck.

On 21-03-2007, at 9:01, jdepaul wrote:



I don't have an application in PROD yet, I'm just working on a  
Proof of
Concept with Drools 3.1.0M1 and Spring 1.2.8 but I have a similar  
situation
as you in that I'll need to periodically reload Rules without  
restarting the
App.  This is what I've discover will work for us - not sure in  
your case,

but here it is:

I have objects called EventRuleBase objects which basically wrap  
RuleBase
objects.  Each instance of EventRuleBase object is tied to a  
resource (*.drl
file on the file system for now, but in the future it may come from  
a DB).

I then have a notion of RuleBaseManager object which is in charge of
managing the collection of EventRuleBase objects.  I use Spring to
initialize and load all EventRuleBase objects individually and then  
register
themselves with the RuleBaseManager object which records their  
instances in

HashMap.  The RuleBaseManager implements several methods:
getWorkingMemory(...) and ruleChange(newEventRuleBase).  The  
RuleBaseManager

is a Singleton and the EventRuleBase objects are NOT singletons

In my testing, I've discovered that when it's time to reload rules  
(some
type of triggering mechanism must invoke this), I can ask Spring  
for a new

instance of the EventRuleBase object by name (i.e.
appContext.getBean(LOAD_rulebase) - it will fetch a brand new  
object which

it will automatically reload from the underlying Resource (on the
filesystem) - note that "singleton=false" bean configuration in Spring
config is key for this.   I can then hand the new instance of the new
EventRuleBase object to the ruleChange(newEventRuleBase) method  
which it

will then synchronize and 'swap-in' the new object into the HashMap it
maintains.  The clients that invoke subsequent getNewWorkingMemory 
() methods
on the new EventRuleBase object will then start getting references  
to new
object with NEW rules.  I figured I'll need to protect the  
integrity of the
hashmap using the JDK 1.5 implementation of ConcurrentHashMap which  
is very

much possible using Spring 2.x - check out the documentation.

Hope this helps.
Regards -
James'


Carlos Henriquez wrote:



We want to change rules at runtime without redeploying the whole
application.


--
View this message in context: http://www.nabble.com/Changing-rules- 
at-runtime-tf3392187.html#a9593359

Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Question on data safety and threading...

2007-03-21 Thread Felipe Piccolini

jdepaul,

   We are implementing a diferent solution for that. We are using a  
Topic JMS using spring, so we have build diferent RuleBases and  
publish them
in this topicJMS as a post, then a WorkingMemoryFactory has a  
listener for changes on the topics, and when that happens the factory  
refresh the
singleton reference to the RuleBase (sincronyzed) and provides a  
newWorkingMemory... no maps, one factory for each rulebase (we have  
them identified)
and the diferent ruleBases are managed by diferent topic-beans-names  
in the spring configuration. I guess it can be managed by maps too.

We will send the code in 3 weeks when we have it tested and operative.

Good luck!.

On 13-03-2007, at 19:32, Michael Neale wrote:

in your case - as you are swapping out the RuleBase - I woudl  
suggest locking or syncing things when swapping - not sure how to  
do that given that spring is in control.


Also, i would suggest you use RuleBase#newWorkingMemory(false) so  
that it doesn't keep a weakhashmap around pointint back to the  
working memories, as you don't need it (it will mean less big GC  
pauses under heavy load in your case).


Michael.

On 3/13/07, jdepaul <[EMAIL PROTECTED]> wrote:

I know the threading topic has been discussed quite extensively,  
but I still

need some guidance in the following case:

My application has a RuleManager object that maintains references  
to many
RuleBase objects in a HashMap. I'm using Spring Framework to wire  
the bean

relationships together.

The RulesManager is typically busy servicing client requests for  
instances

of WorkingMemory objects which it fetches from the individual RuleBase
objects it maintains in its Hash ( wm.newWorkingMemory() ).

>From time to time, I'll need RulesManager to reaload the rules  
that are
associated with the individual RuleBase object - for that, I'm  
going to
create a new instance of the RuleBase object and then I need an  
efficient
and safe way to 'swap' this new RuleBase object for the old object  
reference

in the RulesManager's map.

My question is: should I synchronize the getWorkingMemory(..)  
method inside
my RulesManager object that uses the hashmap, AND also synchronize  
the code
that does the object swap - would that be sufficient?! How would I  
do it
using Collections.synchronizedMap() - remember that I don't have  
that much
control over the creation of the Map since Spring controls that  
part of

populating hashmap at startup.

The critical factors for me are speed and efficiency in servicing  
regular
client requests for WorkingMemory - ideally, I'd synchronize only  
the method

that does the object swap, but I'm sure that may have some bad
consequences... though as long as I can avoid the race condition I  
could

probably live with it.

Thanks in advance for ideas -
--
View this message in context: http://www.nabble.com/Question-on- 
data-safety-and-threading...-tf3396050.html#a9454823

Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Detecting partial matches

2007-01-12 Thread Felipe Piccolini
 You can use EventListener to check Facts asserted. maybe that is  
not what your
looking for, but its good to know that you can check events inside  
the rule engine

execution...

On 11-01-2007, at 13:08, Kevin J. Schmidt wrote:


I'm using JBoss Rules 3.0.5 and want to know if there is a way to
detect when a rule partially matches. For example, let's say I have
the following rule:

rule "My Rule"
   no-loop true
when
   myo1: MyObject(id==12)
   myo2: MyObject(id==45)
then
   // do something with myo1 and myo2
end

This rule is looking for one MyObject with an id of 12 and another
MyObject with an id of 45. A MyObject with id 12 may come into working
memory before the one with an id of 45. Is there a way, either in Java
code or in the rules file itself, to know when the rule is partially
matched?

Thanks,

--
Kevin J. Schmidt
<[EMAIL PROTECTED]>

A wise and frugal government, which shall leave men free to regulate
their own pursuits of industry and improvement, and shall not take
from the mouth of labor and bread it has earned - this is the sum of
good government.
--Thomas Jefferson
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: [drools-user] Is the maling list active?

2007-01-05 Thread Felipe Piccolini

Yes... I can here you... omg I felt myself so lonely... :(

Im glad to here u guys :)

On 05-01-2007, at 17:52, Michael Neale wrote:


Echooo.

this list should be active. Can you hear me ?? ;)

On 1/5/07, Felipe Piccolini <[EMAIL PROTECTED] > wrote:
I have been notified about unsubscription to the mailing list and I  
didnt make it...


Also received a subscription email to the rules-users/ 
[EMAIL PROTECTED] list all cool until now...
but I havent received any mail from anybody today (almost) so I  
presume that the list is inactive?


Anyone can say something?... I cant hear you guys :)


Felipe Piccolini M.
[EMAIL PROTECTED]





___
rules-users mailing list
[EMAIL PROTECTED]
https://lists.jboss.org/mailman/listinfo/rules-users



Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
[EMAIL PROTECTED]
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Is the maling list active?

2007-01-05 Thread Felipe Piccolini
I have been notified about unsubscription to the mailing list and I  
didnt make it...


Also received a subscription email to the rules-users/ 
[EMAIL PROTECTED] list all cool until now...
but I havent received any mail from anybody today (almost) so I  
presume that the list is inactive?


Anyone can say something?... I cant hear you guys :)


Felipe Piccolini M.
[EMAIL PROTECTED]




___
rules-users mailing list
[EMAIL PROTECTED]
https://lists.jboss.org/mailman/listinfo/rules-users