Re: [rules-users] programmatic manipulation of 4.0 salience?

2007-08-16 Thread Manjax23

Salience salience = new SalienceInteger( Integer.parseInt( salienceText ) );
rule.setSalience( salience );

Cheers,
manjax23


Scott Reed-4 wrote:
> 
> My 3.1 app has a mechanism that allowed the user to change the salience of
> some rules before running 
> them, before loading up WorkingMemory. This was quite simple,
> rule.getSalience() returned a rule's 
> int salience value and rule.setSalience(int) set it. Now in 4.0 I see
> salience is no longer just an 
> int, but a Salience object with a simple constructor and complicated
> getValue(Tuple,WorkingMemory) 
> method to access the int value.
> 
> It appears to be still easy to set the salience of a rule:
> rule.setSalience( new 
> SalienceInteger(int)) but getting the int salience from a Salience object
> seems to have been removed 
> from joe-blow coder's reach.
> 
> I would be very grateful if someone would provide me with an example that
> gets the int salience 
> associated with a rule. I have no idea where or why I need to get the
> Tuple and WorkingMemory. Can I 
> just pass nulls in for those two arguments?
> 
> Thanks,
>Scott
> ___
> 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/programmatic-manipulation-of-4.0-salience--tf4283735.html#a12194345
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] programmatic manipulation of 4.0 salience?

2007-08-16 Thread Scott Reed
My 3.1 app has a mechanism that allowed the user to change the salience of some rules before running 
them, before loading up WorkingMemory. This was quite simple, rule.getSalience() returned a rule's 
int salience value and rule.setSalience(int) set it. Now in 4.0 I see salience is no longer just an 
int, but a Salience object with a simple constructor and complicated getValue(Tuple,WorkingMemory) 
method to access the int value.


It appears to be still easy to set the salience of a rule: rule.setSalience( new 
SalienceInteger(int)) but getting the int salience from a Salience object seems to have been removed 
from joe-blow coder's reach.


I would be very grateful if someone would provide me with an example that gets the int salience 
associated with a rule. I have no idea where or why I need to get the Tuple and WorkingMemory. Can I 
just pass nulls in for those two arguments?


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


[rules-users] Drools Puzzles round 1 result

2007-08-16 Thread Drools Puzzle
Hi all,

many thanks to all the participators in the round 1 and congratulations to
the winner Dr. Starke. I'll post a detailed report with current scores of
all participators and comments to each solution to Drools wiki tomorrow. Now
it's Dr. Starke's turn to post the next puzzle.


Happy drooling!
Drools Puzzle
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] bug in "accumulate"

2007-08-16 Thread Edson Tirelli
Sorry, this message just came to my attention.

A variable bound in the source pattern can only be used in the action()
and reverse() blocks. This makes sense because the init() and result()
blocks are executed only once for all matches, while the action() and
reverse() blocks are executed once FOR EACH match. So, in your example:

Number( ) from accumulate(
  Parent( $h : height ),
  init(),
  action(),
  reverse(),
  result())

Pretend you have more than one matching Parent, if it was allowed to use $h
in init() or result() blocks, what Parent height would $h correspond to?

   Not sure if it is clear, but maybe someone can help explaining that...

   []s
   Edson


2007/8/9, Manukyan, Sergey <[EMAIL PROTECTED]>:
>
>  Actually there is a $h in the code… sorry for the omission in the email.
>
>
>
> Just checked it again today – it gives me same result as yesterday :
>
>
>
> rule …
>
> when
>
> o : Date from accumulate (
>
> Parent( $h : height  ) ,
>
> init(;),
>
> action(;),
>
> reverse(),
>
> result( $h )
>
> )
>
> then …
>
> end
>
>
>
>
>
> -Sergey
>
>
>
>
>  --
>
> *From:* [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Mark Proctor
> *Sent:* Wednesday, August 08, 2007 4:51 PM
> *To:* Rules Users List
> *Subject:* Re: [rules-users] bug in "accumulate"
>
>
>
> you didn't have a dollar on the field binding:
> Parent( h : height  )
>
> $ is optional, but you must use the same in all places.
>
> Mark
> Manukyan, Sergey wrote:
>
> Folks,
>
>
>
> Using 4.0. Think I found a bug in accumulate. The variables defined inside
> ** cannot be recognized inside of other parts of
> accumulate (action, result)
>
>
>
> f.e.
>
>
>
> rule …
>
> when
>
> o : Date from accumulate (
>
> Parent( h : height  ) ,
>
> init(;),
>
> action(;),
>
> reverse(),
>
> result( $h )
>
> )
>
> then …
>
> end
>
>
>
>
>
> Produces : $h cannot be resolved
>
>
>
>
>
> Stack trace:
>
>
>
>
>
>   at org.drools.rule.Package.checkValidity(*Package.java:408*)
>
>   at org.drools.common.AbstractRuleBase.addPackage(*
> AbstractRuleBase.java:288*)
>
>   at com.lear.rules.RuleBaseFacade.getRuleBase(*RuleBaseFacade.java:46
> *)
>
>
>
>
>
>
>
> -Sergey
>
>
>
>
>
>
>
> **
> ** LEGAL DISCLAIMER **
> **
>
> This E-mail message and any attachments may contain
> legally privileged, confidential or proprietary
> information. If you are not the intended recipient(s),
> or the employee or agent responsible for delivery of
> this message to the intended recipient(s), you are
> hereby notified that any dissemination, distribution
> or copying of this E-mail message is strictly
> prohibited. If you have received this message in
> error, please immediately notify the sender and
> delete this E-mail message from your computer.
>
>
>
>
> --
>
>
>
> ___
>
> 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
  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


[rules-users] Drools 4.0 Migrating

2007-08-16 Thread Saleem Lakhani
Hi,

 

I am very new to Drools. I need to know from where I can get some
resources on DSL Syntax in 4.0. Examples etc. I am working on a project
which used Drools 3 and my job is to upgrade it to 4.0. I am able to get
everything compiled but getting stuck at loading DSLs. For example: I am
getting an exception like: 

 

 An exception occurred while attempting to parse a Validation rule in
ABC



Failed to add the compiled rule package to the RuleBase cause by: Unable
to resolve ObjectType 'orRiskTO' : [Rule name=Certificate]

Unable to resolve ObjectType 'orRiskTO' : [Rule name=Certificate,
agendaGroup=Rating, salience=0, no-loop=false]

Rule Compilation error : [Rule name=Dwellings, agendaGroup=Rating,
salience=0, no-loop=false]

rating/Rule_Dwellings_0.java (36:39) : A method named
"intValue" is not declared in any enclosing class nor any supertype, nor
through a static import

 

at org.drools.rule.Package.checkValidity(Package.java:409)

at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:262)

at
com.citizens.ratebook.RatebookRuleBaseFactory.buildValidationsRulebase(R
atebookRuleBaseFactory.java:168)

... 29 more

 

 

thanks

Saleem Lakhani

 

 

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


[rules-users] Guided DRL editor

2007-08-16 Thread kissro
Hello,

I am new to JBoss rules and was wondering if someone could explain how
to get started with the new Guided DRL Editor.  I'm using Drools 4.0 and
the Eclipse IDE.  I've clicked on 'New Guided DRL editor' in Eclipse and
it's created the rules.brxml file.  The editor is on the screen showing
'If', 'Then', and 'Options' but it's blank.  I've selected the 'If' and
clicked on little screen with the '+' on the right side of the editor.
A dialog box opens with 'Add a New Condition' and a drop down box for
'Fact' but the only option in the drop down box is 'Choose a Fact'.
I've also selected 'Then' and clicked on little screen with the '+' on
the right side of the editor.  A dialog box opens with 'Add a New
Action' and several drop down boxes.  The only option in all of the
drop down boxes is 'Choose'.

How do I get these boxes populated?  I've already got several existing
rules coded and I thought they would show up in the editor but they
don't.  Do I have to code the rules in Java before I can use the editor?
According to what I've read, this is supposed to be a point-and-click
way of creating rules but so far I haven't seen that.  I was hoping to
be able to use the editor as sort of a gui for creating or modifying my
rules but haven't been able to figure out how to do that.  Any help
would be appreciated.

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


RE: [rules-users] RE: RE: trivial case in xls

2007-08-16 Thread Bin Shen (BA/EDD)

yr suggestion is working. but u have to augment domain objects :(

finally i tried another workaround:

---rule "otherwise"
|  CONDITION when
--- $p : Person(hashCode != 0)
object type/| $p : Personthen
--- //
snippet/condition   | hashCode !=  end
---
explaination text   |  x  
---
cell/data   | 0
---
 
it works too, as far as no domain objects have a hashcode of zero :)

hope Mark and Co. can give DTs more expresiveness in the coming releases!


/ Ben


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
Sent: Donnerstag, 16. August 2007 16:45
To: rules-users@lists.jboss.org
Subject: [rules-users] RE: RE: trivial case in xls



you can keep a flag to check if it isNew or isEmpty flag inside the Object and 
check this flag inside your rule. Or add a method checkNull() to the object and 
check this method in the rule file.

rule "otherwise"
when 
 $p : Person( isNew == true )
then retract ($p)
end

Hope this works !!! :)


Bin Shen (BA/EDD) wrote:
> 
> 
> but, u haven't answered my question. 
> 
> i see the grouped hidden lines in the example.
> 
> i use yr terms. the condition ("snippet" in my term) can not be empty, 
> and the action ("cell" in my term) can be empty. in my case how should 
> i put the condition, when no field constraint is there? how should i 
> put in the action? an empty makes the condition not applicable!
> 
> the case i raised seems trivial. actually it finds many applications 
> as follows.
> 
> rule "main"
>   salience 10
>   when
>   $p : Person(age > 35)
>   then
>   // do something with persons older than 35
>   System.out.println("hello, " + $p + "!");
> end   
> 
> rule "otherwise"
>   when
>   $p : Person()
>   then
>   // ignore other persons, i.e. retract them to avoid memory leaks
>   retract($p);
> end
> 
> 
> / Ben
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
> Sent: Donnerstag, 16. August 2007 15:53
> To: rules-users@lists.jboss.org
> Subject: [rules-users] RE: trivial case in xls
> 
> 
> http://downloads.jboss.com/drools/docs/4.0.0.13773GA/html_single/index
> .html#d0e1805
> 
> Condition and action cell should not be null and should contain valid 
> data.
> If you could see a small plus sign, expand it.you should be able to 
> see the parameters that are passed to the rule, and both the condition 
> and action snippets.
> 
> And the data set you are comparing against can be empty.
> 
> Hope this works for you :)
> 
> Thanks,
> Manjax23
> 
> 
> Bin Shen (BA/EDD) wrote:
>> 
>> hi, Manjax,
>> 
>> have studied the example that u mentioned.
>> 
>> take the schema as follows:
>> object type  $p : Person
>> snippet  ? 
>> cell ?
>> 
>> i mean a special case when there is no field constraint at all. if i 
>> leave out the snippet. some runtime error said that the script is 
>> null :((
>> 
>> can u tell me what should i put in snippet and cell respectively. thanx! 
>> 
>> 
>> / Ben
>>  
>> 
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
>> Sent: Donnerstag, 16. August 2007 14:53
>> To: rules-users@lists.jboss.org
>> Subject: Re: [rules-users] trivial case in xls
>> 
>> 
>> Download the example.zip and there is a sample "ExamplePolicyPricing.xls"
>> and PricingRuleDTExample.java.
>> 
>> :) pls read documentation :)
>> 
>> 
>> Bin Shen (BA/EDD) wrote:
>>> 
>>> Hi, all,
>>> 
>>> use 4.0.0 GA.
>>> 
>>> want to have an xls rule file. i am not sure of how to define the 
>>> following trivial case in xls.
>>> 
>>> can anybody help? thanx! 
>>> 
>>> when
>>> $p : Person()
>>> then
>>> // do something with any person
>>> end
>>> 
>>> 
>>> / Ben
>>> 
>>> ___
>>> 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/trivial-case-in-xls-tf4279398.html#a12180689
>> 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
>> 
>> 
> 
> --
> View t

[rules-users] Decision tables with cutoff time

2007-08-16 Thread Hehl, Thomas
I'm trying to create a decision table. One of the rules is that an event
must occur a certain number of days before another event. This number of
days before cutoff currently means that anytime before the cutoff date is
allowed, but anything on or after the cutoff date is not. I'm trying to
modify this to allow things that are actually on the cutoff date are allowed
if they happen before a certain time in the day, to allow for customers that
want cutoff to be until close of business or some such.

 

Can I put this into a decision table?

 

Thanks.

 

Thom Hehl
Sr. eJuror Architect

* Office (859) 277-8800 x 144

* [EMAIL PROTECTED]   
ACS, Inc.

Government Solutions

1733 Harrodsburg Road
Lexington, KY 40504-3617

This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message and notify
sender via e-mail at [EMAIL PROTECTED]
  or by telephone at 859-277-8800 ext. 144.
Thank you.

 

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


[rules-users] RE: RE: trivial case in xls

2007-08-16 Thread Manjax23


you can keep a flag to check if it isNew or isEmpty flag inside the Object
and check this flag inside your rule. Or add a method checkNull() to the
object and check this method in the rule file.

rule "otherwise"
when 
 $p : Person( isNew == true )
then retract ($p)
end

Hope this works !!! :)


Bin Shen (BA/EDD) wrote:
> 
> 
> but, u haven't answered my question. 
> 
> i see the grouped hidden lines in the example.
> 
> i use yr terms. the condition ("snippet" in my term) can not be empty, and
> the action ("cell" in my term) can be empty. in my case how should i put
> the condition, when no field constraint is there? how should i put in the
> action? an empty makes the condition not applicable! 
> 
> the case i raised seems trivial. actually it finds many applications as
> follows.  
> 
> rule "main"
>   salience 10
>   when
>   $p : Person(age > 35)
>   then
>   // do something with persons older than 35
>   System.out.println("hello, " + $p + "!");
> end   
> 
> rule "otherwise"
>   when
>   $p : Person()
>   then
>   // ignore other persons, i.e. retract them to avoid memory leaks
>   retract($p);
> end
> 
> 
> / Ben
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
> Sent: Donnerstag, 16. August 2007 15:53
> To: rules-users@lists.jboss.org
> Subject: [rules-users] RE: trivial case in xls
> 
> 
> http://downloads.jboss.com/drools/docs/4.0.0.13773GA/html_single/index.html#d0e1805
> 
> Condition and action cell should not be null and should contain valid
> data.
> If you could see a small plus sign, expand it.you should be able to see
> the parameters that are passed to the rule, and both the condition and
> action snippets. 
> 
> And the data set you are comparing against can be empty.
> 
> Hope this works for you :)
> 
> Thanks,
> Manjax23
> 
> 
> Bin Shen (BA/EDD) wrote:
>> 
>> hi, Manjax,
>> 
>> have studied the example that u mentioned.
>> 
>> take the schema as follows:
>> object type  $p : Person
>> snippet  ? 
>> cell ?
>> 
>> i mean a special case when there is no field constraint at all. if i 
>> leave out the snippet. some runtime error said that the script is null 
>> :((
>> 
>> can u tell me what should i put in snippet and cell respectively. thanx! 
>> 
>> 
>> / Ben
>>  
>> 
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
>> Sent: Donnerstag, 16. August 2007 14:53
>> To: rules-users@lists.jboss.org
>> Subject: Re: [rules-users] trivial case in xls
>> 
>> 
>> Download the example.zip and there is a sample "ExamplePolicyPricing.xls"
>> and PricingRuleDTExample.java.
>> 
>> :) pls read documentation :)
>> 
>> 
>> Bin Shen (BA/EDD) wrote:
>>> 
>>> Hi, all,
>>> 
>>> use 4.0.0 GA.
>>> 
>>> want to have an xls rule file. i am not sure of how to define the 
>>> following trivial case in xls.
>>> 
>>> can anybody help? thanx! 
>>> 
>>> when
>>> $p : Person()
>>> then
>>> // do something with any person
>>> end
>>> 
>>> 
>>> / Ben
>>> 
>>> ___
>>> 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/trivial-case-in-xls-tf4279398.html#a12180689
>> 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
>> 
>> 
> 
> --
> View this message in context:
> http://www.nabble.com/trivial-case-in-xls-tf4279398.html#a12181827
> 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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/trivial-case-in-xls-tf4279398.html#a12182696
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] RE: trivial case in xls

2007-08-16 Thread Bin Shen (BA/EDD)
sorry, i used the wrong word "action", instead of "data".

take the schema once more to avoid misunderstanding (assume no grouped rows).

---
|  CONDITION
---
object type/| $p : Person
---
snippet/condition   | ? 
---
explaination text   |  x  
---
cell/data   | ?
---

it's clear: the condition ("snippet" in my term) can not be empty, and the data 
("cell" in my term) can be empty. 

in my case how should i put the condition, when no field constraint is there? 
how should i put in the data? an empty invalidates the condition! 

the case i raised seems trivial. actually it finds many applications as 
follows. in question comes the rule "otherwise":  

rule "main"
salience 10
when
$p : Person(age > 35)
then
// do something with persons older than 35
System.out.println("hello, " + $p + "!");
end 

rule "otherwise"
when
$p : Person()
then
// ignore other persons, i.e. retract them to avoid memory leaks
retract($p);
end


/ Ben


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


RE: [rules-users] RE: trivial case in xls

2007-08-16 Thread Bin Shen (BA/EDD)

but, u haven't answered my question. 

i see the grouped hidden lines in the example.

i use yr terms. the condition ("snippet" in my term) can not be empty, and the 
action ("cell" in my term) can be empty. in my case how should i put the 
condition, when no field constraint is there? how should i put in the action? 
an empty makes the condition not applicable! 

the case i raised seems trivial. actually it finds many applications as 
follows.  

rule "main"
salience 10
when
$p : Person(age > 35)
then
// do something with persons older than 35
System.out.println("hello, " + $p + "!");
end 

rule "otherwise"
when
$p : Person()
then
// ignore other persons, i.e. retract them to avoid memory leaks
retract($p);
end


/ Ben

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
Sent: Donnerstag, 16. August 2007 15:53
To: rules-users@lists.jboss.org
Subject: [rules-users] RE: trivial case in xls


http://downloads.jboss.com/drools/docs/4.0.0.13773GA/html_single/index.html#d0e1805

Condition and action cell should not be null and should contain valid data.
If you could see a small plus sign, expand it.you should be able to see the 
parameters that are passed to the rule, and both the condition and action 
snippets. 

And the data set you are comparing against can be empty.

Hope this works for you :)

Thanks,
Manjax23


Bin Shen (BA/EDD) wrote:
> 
> hi, Manjax,
> 
> have studied the example that u mentioned.
> 
> take the schema as follows:
> object type   $p : Person
> snippet   ? 
> cell  ?
> 
> i mean a special case when there is no field constraint at all. if i 
> leave out the snippet. some runtime error said that the script is null 
> :((
> 
> can u tell me what should i put in snippet and cell respectively. thanx! 
> 
> 
> / Ben
>  
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
> Sent: Donnerstag, 16. August 2007 14:53
> To: rules-users@lists.jboss.org
> Subject: Re: [rules-users] trivial case in xls
> 
> 
> Download the example.zip and there is a sample "ExamplePolicyPricing.xls"
> and PricingRuleDTExample.java.
> 
> :) pls read documentation :)
> 
> 
> Bin Shen (BA/EDD) wrote:
>> 
>> Hi, all,
>> 
>> use 4.0.0 GA.
>> 
>> want to have an xls rule file. i am not sure of how to define the 
>> following trivial case in xls.
>> 
>> can anybody help? thanx! 
>> 
>>  when
>>  $p : Person()
>>  then
>>  // do something with any person
>>  end
>> 
>> 
>> / Ben
>> 
>> ___
>> 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/trivial-case-in-xls-tf4279398.html#a12180689
> 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
> 
> 

--
View this message in context: 
http://www.nabble.com/trivial-case-in-xls-tf4279398.html#a12181827
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


[rules-users] Re: Drools 4.0 problem: insert (drl) not reflected StatefulSession.

2007-08-16 Thread Michael Waluk
The log file also shows that the BenefitsProgramEvent was inserted
properly.  So why wouldn't it appear in the working memory?  Do I need to do
something special or is somehow inserted in another working memory?

Thanks for any suggestions,
Michael


  

  RecognizeBenefitsProgramEvent [1]
  RecognizeBenefitsProgramEvent
  $edit=
[EMAIL PROTECTED]
(1)
  6


  84
  
[EMAIL PROTECTED]
[]
  1


  RecognizeBenefitsProgramEvent [1]
  RecognizeBenefitsProgramEvent
  $edit=
[EMAIL PROTECTED]
(1)
  7

  





On 8/15/07, Michael Waluk <[EMAIL PROTECTED]> wrote:
>
> I just upgraded to Drools 4.0 and changed my assertObject calls to
> insert.  I also switched from WorkingMemory to StatefulSession.  The rules
> seem to be fine, but I am not able to retrieve any inserted objects from the
> working memory for some reason.  Here is what I'm doing.  I'd appreciate any
> suggestions...
>
> StatefulSession *workingMemory* = getActiveWorkingMemories(id);
> *workingMemory*.fireAllRules();
>
> // Here is the rule that fires:
> *
>
> rule
> *"RecognizeBenefitsProgramEvent" *
> **  when* $edit: BenefitsProgramModelEdit()
> *  then*
> *insert* (*new* *BenefitsProgramEvent*("BenefitsProgramEvent",
> $edit.getValidFrom(), "AnnualEnrollmentEvent")); *
> **System*.out.println("Rule RecognizeBenefitsProgramEvent fired " ); *
> **end*
>
> I see the print statement in the console but the inserted object is not
> actually in the working memory.  I look using this:
>
> Iterator events = *workingMemory*.iterateObjects(new ClassObjectFilter(
> BenefitsProgramEvent.class));
>
> This iterator is empty.  I also debug and look at the assetMap inside
> workingMemory and it never changes.
>
> Thanks,
>
> Michael
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RE: trivial case in xls

2007-08-16 Thread Manjax23

http://downloads.jboss.com/drools/docs/4.0.0.13773GA/html_single/index.html#d0e1805

Condition and action cell should not be null and should contain valid data.
If you could see a small plus sign, expand it.you should be able to see the
parameters that are passed to the rule, and both the condition and action
snippets. 

And the data set you are comparing against can be empty.

Hope this works for you :)

Thanks,
Manjax23


Bin Shen (BA/EDD) wrote:
> 
> hi, Manjax,
> 
> have studied the example that u mentioned.
> 
> take the schema as follows:
> object type   $p : Person
> snippet   ? 
> cell  ?
> 
> i mean a special case when there is no field constraint at all. if i leave
> out the snippet. some runtime error said that the script is null :((
> 
> can u tell me what should i put in snippet and cell respectively. thanx! 
> 
> 
> / Ben
>  
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
> Sent: Donnerstag, 16. August 2007 14:53
> To: rules-users@lists.jboss.org
> Subject: Re: [rules-users] trivial case in xls
> 
> 
> Download the example.zip and there is a sample "ExamplePolicyPricing.xls"
> and PricingRuleDTExample.java.
> 
> :) pls read documentation :)
> 
> 
> Bin Shen (BA/EDD) wrote:
>> 
>> Hi, all,
>> 
>> use 4.0.0 GA.
>> 
>> want to have an xls rule file. i am not sure of how to define the 
>> following trivial case in xls.
>> 
>> can anybody help? thanx! 
>> 
>>  when
>>  $p : Person()
>>  then
>>  // do something with any person
>>  end
>> 
>> 
>> / Ben
>> 
>> ___
>> 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/trivial-case-in-xls-tf4279398.html#a12180689
> 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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/trivial-case-in-xls-tf4279398.html#a12181827
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


Re: [rules-users] Drools - is dynamic change possible ?

2007-08-16 Thread Mark Proctor
Yes this can be done at runtime. The RuleBase has a reference to each of 
the created StatefulSessions that has not called dispose() yet and will 
push those rule changes out to each running session.



Mark
pns77 wrote:

Thanks for the response.

Just to confirm when you say "...but you can remove a rule and add another
in its place..." - can this be done at runtime - i.e server is running, i go
add a new rule/change the output of an existing rule. If so, can  i have the
new rule take effect ?

Also, do i need to include any specific jar file for this dynamic feature ?

Am not looking at performance here - more from a maintenance/changeability
point of view.


Mark Proctor wrote:
  
you cannot change an individual rule, but you can remove a rule and add 
another in its place.


Mark
pns77 wrote:


Have been able to execute/run a sample Drools file

import com.sample.Message;
 
rule "Hello World"

when
m : Message( status == Message.HELLO, message : message,
testStringExternal : testStringExternal )
then
System.out.println( message );
m.setMessage( "Goodbye cruel world" );
System.out.println( testStringExternal + "Message.HELLO" );
m.setStatus( Message.GOODBYE );
update( m );
end

Now, is it possible to change the logic dynamically at runtime ? Or is
the
drl file used only to externalize the business logic? I tried changing
the
message in drl file and it didnt get reflected

Environment - RAD 6.0/jdk 1.4

Used the following set of jar files
C:\Drools\libraries\drools-core.jar;
C:\Drools\libraries\drools-compiler.jar;
C:\Drools\libraries\mvel14.jar;
C:\Drools\libraries\antlr-runtime.jar;
C:\Drools\libraries\xstream.jar;
C:\Drools\lib\core-3.2.3.v_686_R32x.jar; 
  
  

___
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


Re: [rules-users] RuntimeDroolsException

2007-08-16 Thread Kris Verlaenen
This exception is thrown when it cannot find (one of) the necessary libraries 
for loading the Java Dialect.  In this case probably the eclipse jdt compiler.  
Make sure all the necessary dependencies are in your classpath.  If you are 
using a Drools project, the Drools classpath container should automatically do 
that for you.

However, note that the eclipse plugin currently only works with eclipse 3.2.x, 
it will be upgraded to 3.3 for the next major release.  If I remember 
correctly, I believe this exception is thrown if you try to use the plugin in 
eclipse 3.3.

Kris

  - Original Message - 
  From: Raffaele Viola 
  To: rules-users@lists.jboss.org 
  Sent: Thursday, August 16, 2007 12:52 PM
  Subject: [rules-users] RuntimeDroolsException


  Hi,

  I'm starting to use eclipse plug.in for JRules. I created the example JRules 
project in eclipse and I tried to start it as Java Application but I got this 
exception

  org.drools.RuntimeDroolsException: Unable to load dialect 
'org.drools.rule.builder.dialect.java.JavaDialect:java'
  at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry 
(PackageBuilderConfiguration.java:156)
  at org.drools.compiler.PackageBuilder.( PackageBuilder.java:131)
  at org.drools.compiler.PackageBuilder .(PackageBuilder.java:84)
  at com.sample.DroolsTest.readRule(DroolsTest.java:50) 
  at com.sample.DroolsTest.main(DroolsTest.java:21)

  Can someone help me?
  Thanks
  Raffo



--


  ___
  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


RE: [rules-users] trivial case in xls

2007-08-16 Thread Bin Shen (BA/EDD)
hi, Manjax,

have studied the example that u mentioned.

take the schema as follows:
object type $p : Person
snippet ? 
cell?

i mean a special case when there is no field constraint at all. if i leave out 
the snippet. some runtime error said that the script is null :((

can u tell me what should i put in snippet and cell respectively. thanx! 


/ Ben
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manjax23
Sent: Donnerstag, 16. August 2007 14:53
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] trivial case in xls


Download the example.zip and there is a sample "ExamplePolicyPricing.xls" and 
PricingRuleDTExample.java.

:) pls read documentation :)


Bin Shen (BA/EDD) wrote:
> 
> Hi, all,
> 
> use 4.0.0 GA.
> 
> want to have an xls rule file. i am not sure of how to define the 
> following trivial case in xls.
> 
> can anybody help? thanx! 
> 
>   when
>   $p : Person()
>   then
>   // do something with any person
>   end
> 
> 
> / Ben
> 
> ___
> 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/trivial-case-in-xls-tf4279398.html#a12180689
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


Re: [rules-users] Please help - losing hair

2007-08-16 Thread Richard Hoberman
That did the trick.  Thank you!  The "insert" keyword also feels a lot
more natural (although I get that "assert" went with "fact") :-)

Manjax23 wrote:
> I had same problem with 4M2 release. Please upgrade it to either 4.0.0 GA or
> 4M3 release.
> You can also find a sample example ShoppingExample.java and Shopping.drl,
> which is self-explanatory.
> However, I was not able to test few MVEL features like projections, which i
> think if added would make drools even more dynamic.
>
> Thanks,
> manjax23
>
>
> Richard Hoberman wrote:
>   
>> 1. I can't find any mention of dialects anywhere in the Drools 4
>> manual.  Am I missing something?
>>
>> 2. I've tried the following after finding a snippet in the archives for
>> this list:
>>
>> package mvanamibia.claim;
>>
>> import java.lang.Object;
>> import java.lang.String;
>> import java.lang.Double;
>> import java.util.Date;
>> import java.util.List;
>> import java.util.ArrayList;
>> import com.sadalbari.mvanamibia.beans.Claim;
>> import com.sadalbari.mvanamibia.beans.Mandate;
>> import com.sadalbari.mvanamibia.beans.SubmissionInfo;
>> import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
>>
>> global ClaimEvaluation evaluation;
>>
>> rule "hasDateReceived"
>> dialect "mvel"
>> when
>> Claim( submissionInfo == null )
>> then
>> evaluation.getViolations().add("missing: date received");
>> end
>>
>>
>> but it gives the following exception:
>>
>> java.lang.NullPointerException
>> at
>>
>> org.drools.rule.builder.RuleBuildContext.(RuleBuildContext.java:115)
>> at
>> org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:350)
>> at
>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:233)
>> at
>>
>> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:157)
>> at
>>
>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:29)
>> at
>>
>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
>> ... Removed 22 stack frames
>>
>>
>> Thanks
>>
>> Richard
>>
>>
>> Mark Proctor wrote:
>> 
>>> in theory for nested accessors it should switch to the MVEL dialect
>>> automatically. You only need to specify the MVEL dialect explicitely
>>> for eval, return value and consequences.
>>>
>>> Mark
>>> Manjax23 wrote:
>>>   
 I think you should use dialect "mvel" when accessing the nested
 accessors.
 and I had some trouble with "mvel" dialect in 4M2 release.

 Please let me know if it works for you..

 Thanks,
 Manjax23


 Richard Hoberman wrote:
   
 
> I'm using Drools 4 (M2), which is supposed to support nested accessors*
>
> This works: when Claim( submissionInfo == null), but not this: when
> Claim( submissionInfo.date == null)
>
> Rule file, SubmissionInfo.java and exception are below.
>
> What am I missing?
>
> Richard
>
>
>
>
> * See
> http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
> which states "Support to nested accessors, property navigation and
> simplified collection, arrays and maps syntax"
>
> Rule File
>
> ---
> package mvanamibia.claim;
>
> import java.lang.Object;
> import java.lang.String;
> import java.lang.Double;
> import java.util.Date;
> import java.util.List;
> import java.util.ArrayList;
> import com.sadalbari.mvanamibia.beans.Claim;
> import com.sadalbari.mvanamibia.beans.Mandate;
> import com.sadalbari.mvanamibia.beans.SubmissionInfo;
> import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
>
> global ClaimEvaluation evaluation;
>
> rule "hasDateReceived"
>
> when
> Claim( submissionInfo.date == null )
> then
> evaluation.getFailures().add("missing: date received");
> end
>
> ---
>
> Exception
> ---
> org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
> token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type 
> RIGHT_PAREN
> at org.drools.rule.Package.checkValidity(Package.java:368)
> at
> org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
> at
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
> at
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationT

Re: [rules-users] Please help - losing hair

2007-08-16 Thread Richard Hoberman
Will bear that in mind.  Thanks.

Mark Proctor wrote:
> These days trunk snapshot is the best place, as it has all the latest
> fixes, this is what will make up 4.0.1 when its releases.
> http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules
>
> Mark
>
>
> Manjax23 wrote:
>> I had same problem with 4M2 release. Please upgrade it to either 4.0.0 GA or
>> 4M3 release.
>> You can also find a sample example ShoppingExample.java and Shopping.drl,
>> which is self-explanatory.
>> However, I was not able to test few MVEL features like projections, which i
>> think if added would make drools even more dynamic.
>>
>> Thanks,
>> manjax23
>>
>>
>> Richard Hoberman wrote:
>>   
>>> 1. I can't find any mention of dialects anywhere in the Drools 4
>>> manual.  Am I missing something?
>>>
>>> 2. I've tried the following after finding a snippet in the archives for
>>> this list:
>>>
>>> package mvanamibia.claim;
>>>
>>> import java.lang.Object;
>>> import java.lang.String;
>>> import java.lang.Double;
>>> import java.util.Date;
>>> import java.util.List;
>>> import java.util.ArrayList;
>>> import com.sadalbari.mvanamibia.beans.Claim;
>>> import com.sadalbari.mvanamibia.beans.Mandate;
>>> import com.sadalbari.mvanamibia.beans.SubmissionInfo;
>>> import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
>>>
>>> global ClaimEvaluation evaluation;
>>>
>>> rule "hasDateReceived"
>>> dialect "mvel"
>>> when
>>> Claim( submissionInfo == null )
>>> then
>>> evaluation.getViolations().add("missing: date received");
>>> end
>>>
>>>
>>> but it gives the following exception:
>>>
>>> java.lang.NullPointerException
>>> at
>>>
>>> org.drools.rule.builder.RuleBuildContext.(RuleBuildContext.java:115)
>>> at
>>> org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:350)
>>> at
>>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:233)
>>> at
>>>
>>> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:157)
>>> at
>>>
>>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:29)
>>> at
>>>
>>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
>>> ... Removed 22 stack frames
>>>
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>> Mark Proctor wrote:
>>> 
 in theory for nested accessors it should switch to the MVEL dialect
 automatically. You only need to specify the MVEL dialect explicitely
 for eval, return value and consequences.

 Mark
 Manjax23 wrote:
   
> I think you should use dialect "mvel" when accessing the nested
> accessors.
> and I had some trouble with "mvel" dialect in 4M2 release.
>
> Please let me know if it works for you..
>
> Thanks,
> Manjax23
>
>
> Richard Hoberman wrote:
>   
> 
>> I'm using Drools 4 (M2), which is supposed to support nested accessors*
>>
>> This works: when Claim( submissionInfo == null), but not this: when
>> Claim( submissionInfo.date == null)
>>
>> Rule file, SubmissionInfo.java and exception are below.
>>
>> What am I missing?
>>
>> Richard
>>
>>
>>
>>
>> * See
>> http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
>> which states "Support to nested accessors, property navigation and
>> simplified collection, arrays and maps syntax"
>>
>> Rule File
>>
>> ---
>> package mvanamibia.claim;
>>
>> import java.lang.Object;
>> import java.lang.String;
>> import java.lang.Double;
>> import java.util.Date;
>> import java.util.List;
>> import java.util.ArrayList;
>> import com.sadalbari.mvanamibia.beans.Claim;
>> import com.sadalbari.mvanamibia.beans.Mandate;
>> import com.sadalbari.mvanamibia.beans.SubmissionInfo;
>> import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
>>
>> global ClaimEvaluation evaluation;
>>
>> rule "hasDateReceived"
>>
>> when
>> Claim( submissionInfo.date == null )
>> then
>> evaluation.getFailures().add("missing: date received");
>> end
>>
>> ---
>>
>> Exception
>> ---
>> org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
>> token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type 
>> RIGHT_PAREN
>> at org.drools.rule.Package.checkValidity(Package.java:368)
>> at
>> org.drools.common.Abstra

Re: [rules-users] Drools - is dynamic change possible ?

2007-08-16 Thread pns77


Thanks for the response.

Just to confirm when you say "...but you can remove a rule and add another
in its place..." - can this be done at runtime - i.e server is running, i go
add a new rule/change the output of an existing rule. If so, can  i have the
new rule take effect ?

Also, do i need to include any specific jar file for this dynamic feature ?

Am not looking at performance here - more from a maintenance/changeability
point of view.


Mark Proctor wrote:
> 
> you cannot change an individual rule, but you can remove a rule and add 
> another in its place.
> 
> Mark
> pns77 wrote:
>> Have been able to execute/run a sample Drools file
>>
>> import com.sample.Message;
>>  
>> rule "Hello World"
>> when
>> m : Message( status == Message.HELLO, message : message,
>> testStringExternal : testStringExternal )
>> then
>> System.out.println( message );
>> m.setMessage( "Goodbye cruel world" );
>> System.out.println( testStringExternal + "Message.HELLO" );
>> m.setStatus( Message.GOODBYE );
>> update( m );
>> end
>>
>> Now, is it possible to change the logic dynamically at runtime ? Or is
>> the
>> drl file used only to externalize the business logic? I tried changing
>> the
>> message in drl file and it didnt get reflected
>>
>> Environment - RAD 6.0/jdk 1.4
>>
>> Used the following set of jar files
>> C:\Drools\libraries\drools-core.jar;
>> C:\Drools\libraries\drools-compiler.jar;
>> C:\Drools\libraries\mvel14.jar;
>> C:\Drools\libraries\antlr-runtime.jar;
>> C:\Drools\libraries\xstream.jar;
>> C:\Drools\lib\core-3.2.3.v_686_R32x.jar; 
>>   
> 
> ___
> 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/Drools---is-dynamic-change-possible---tf4277622.html#a12180915
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


Re: [rules-users] RuntimeDroolsException

2007-08-16 Thread Geoffrey Wiseman
On 8/16/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
>
>  I'll probably want to speak to ILog about help with JRules.
>
> Mark
>

:)

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


Re: [rules-users] trivial case in xls

2007-08-16 Thread Manjax23

Download the example.zip and there is a sample "ExamplePolicyPricing.xls" and
PricingRuleDTExample.java.

:) pls read documentation :)


Bin Shen (BA/EDD) wrote:
> 
> Hi, all,
> 
> use 4.0.0 GA.
> 
> want to have an xls rule file. i am not sure of how to define the
> following trivial case in xls.
> 
> can anybody help? thanx! 
> 
>   when
>   $p : Person()
>   then
>   // do something with any person
>   end
> 
> 
> / Ben
> 
> ___
> 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/trivial-case-in-xls-tf4279398.html#a12180689
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


Re: [rules-users] Please help - losing hair

2007-08-16 Thread Mark Proctor
These days trunk snapshot is the best place, as it has all the latest 
fixes, this is what will make up 4.0.1 when its releases.

http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules

Mark


Manjax23 wrote:

I had same problem with 4M2 release. Please upgrade it to either 4.0.0 GA or
4M3 release.
You can also find a sample example ShoppingExample.java and Shopping.drl,
which is self-explanatory.
However, I was not able to test few MVEL features like projections, which i
think if added would make drools even more dynamic.

Thanks,
manjax23


Richard Hoberman wrote:
  

1. I can't find any mention of dialects anywhere in the Drools 4
manual.  Am I missing something?

2. I've tried the following after finding a snippet in the archives for
this list:

package mvanamibia.claim;

import java.lang.Object;
import java.lang.String;
import java.lang.Double;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.sadalbari.mvanamibia.beans.Claim;
import com.sadalbari.mvanamibia.beans.Mandate;
import com.sadalbari.mvanamibia.beans.SubmissionInfo;
import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;

global ClaimEvaluation evaluation;

rule "hasDateReceived"
dialect "mvel"
when
Claim( submissionInfo == null )
then
evaluation.getViolations().add("missing: date received");
end


but it gives the following exception:

java.lang.NullPointerException
at
   
org.drools.rule.builder.RuleBuildContext.(RuleBuildContext.java:115)

at
org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:350)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:233)
at
   
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:157)

at
   
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:29)

at
   
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)

... Removed 22 stack frames


Thanks

Richard


Mark Proctor wrote:


in theory for nested accessors it should switch to the MVEL dialect
automatically. You only need to specify the MVEL dialect explicitely
for eval, return value and consequences.

Mark
Manjax23 wrote:
  

I think you should use dialect "mvel" when accessing the nested
accessors.
and I had some trouble with "mvel" dialect in 4M2 release.

Please let me know if it works for you..

Thanks,
Manjax23


Richard Hoberman wrote:
  


I'm using Drools 4 (M2), which is supposed to support nested accessors*

This works: when Claim( submissionInfo == null), but not this: when
Claim( submissionInfo.date == null)

Rule file, SubmissionInfo.java and exception are below.

What am I missing?

Richard




* See
http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
which states "Support to nested accessors, property navigation and
simplified collection, arrays and maps syntax"

Rule File

---
package mvanamibia.claim;

import java.lang.Object;
import java.lang.String;
import java.lang.Double;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.sadalbari.mvanamibia.beans.Claim;
import com.sadalbari.mvanamibia.beans.Mandate;
import com.sadalbari.mvanamibia.beans.SubmissionInfo;
import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;

global ClaimEvaluation evaluation;

rule "hasDateReceived"

when
Claim( submissionInfo.date == null )
then
evaluation.getFailures().add("missing: date received");
end

---

Exception
---
org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:368)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testMandateClaim(UnregisteredClaimValidationTest.java:56)
... Removed 22 stack frames
FAILED: testEmptyClaim
org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:368)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
at
com.sada

Re: [rules-users] Drools - is dynamic change possible ?

2007-08-16 Thread Geoffrey Wiseman
On 8/16/07, pns77 <[EMAIL PROTECTED]> wrote:
>
> Now, is it possible to change the logic dynamically at runtime ? Or is the
> drl file used only to externalize the business logic? I tried changing the
> message in drl file and it didnt get reflected
>

Unless things have changed radically since the last version I spent any real
time with, this would depend almost entirely on the code you wrote; the
process of selecting a set of rules to run and how you cache it is usually
within your control.  Now, I don't know how things have changed with the
introduction of the BRMS and 4.0, but "when I was a boy", you explicitly
loaded your rules into a ruleset, and then, usually, for performance
reasons, would hang on to that ruleset.  In so doing, you cache the rules
that you loaded.  If you want to periodically check the  filesystem for an
update and decide if and when to invalidate your cached ruleset, that's
entirely your decision to make.

Someone else can let you know how applicable what I just said is to 4.0.  ;)

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


[rules-users] trivial case in xls

2007-08-16 Thread Bin Shen (BA/EDD)
Hi, all,

use 4.0.0 GA.

want to have an xls rule file. i am not sure of how to define the following 
trivial case in xls.

can anybody help? thanx! 

when
$p : Person()
then
// do something with any person
end


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


Re: [rules-users] Drools - is dynamic change possible ?

2007-08-16 Thread Mark Proctor
you cannot change an individual rule, but you can remove a rule and add 
another in its place.


Mark
pns77 wrote:

Have been able to execute/run a sample Drools file

import com.sample.Message;
 
rule "Hello World"

when
m : Message( status == Message.HELLO, message : message,
testStringExternal : testStringExternal )
then
System.out.println( message );
m.setMessage( "Goodbye cruel world" );
System.out.println( testStringExternal + "Message.HELLO" );
m.setStatus( Message.GOODBYE );
update( m );
end

Now, is it possible to change the logic dynamically at runtime ? Or is the
drl file used only to externalize the business logic? I tried changing the
message in drl file and it didnt get reflected

Environment - RAD 6.0/jdk 1.4

Used the following set of jar files
C:\Drools\libraries\drools-core.jar;
C:\Drools\libraries\drools-compiler.jar;
C:\Drools\libraries\mvel14.jar;
C:\Drools\libraries\antlr-runtime.jar;
C:\Drools\libraries\xstream.jar;
C:\Drools\lib\core-3.2.3.v_686_R32x.jar; 
  


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


Re: [rules-users] Please help - losing hair

2007-08-16 Thread Manjax23

I had same problem with 4M2 release. Please upgrade it to either 4.0.0 GA or
4M3 release.
You can also find a sample example ShoppingExample.java and Shopping.drl,
which is self-explanatory.
However, I was not able to test few MVEL features like projections, which i
think if added would make drools even more dynamic.

Thanks,
manjax23


Richard Hoberman wrote:
> 
> 1. I can't find any mention of dialects anywhere in the Drools 4
> manual.  Am I missing something?
> 
> 2. I've tried the following after finding a snippet in the archives for
> this list:
> 
> package mvanamibia.claim;
> 
> import java.lang.Object;
> import java.lang.String;
> import java.lang.Double;
> import java.util.Date;
> import java.util.List;
> import java.util.ArrayList;
> import com.sadalbari.mvanamibia.beans.Claim;
> import com.sadalbari.mvanamibia.beans.Mandate;
> import com.sadalbari.mvanamibia.beans.SubmissionInfo;
> import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
> 
> global ClaimEvaluation evaluation;
> 
> rule "hasDateReceived"
> dialect "mvel"
> when
> Claim( submissionInfo == null )
> then
> evaluation.getViolations().add("missing: date received");
> end
> 
> 
> but it gives the following exception:
> 
> java.lang.NullPointerException
> at
>
> org.drools.rule.builder.RuleBuildContext.(RuleBuildContext.java:115)
> at
> org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:350)
> at
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:233)
> at
>
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:157)
> at
>
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:29)
> at
>
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
> ... Removed 22 stack frames
> 
> 
> Thanks
> 
> Richard
> 
> 
> Mark Proctor wrote:
>> in theory for nested accessors it should switch to the MVEL dialect
>> automatically. You only need to specify the MVEL dialect explicitely
>> for eval, return value and consequences.
>>
>> Mark
>> Manjax23 wrote:
>>> I think you should use dialect "mvel" when accessing the nested
>>> accessors.
>>> and I had some trouble with "mvel" dialect in 4M2 release.
>>>
>>> Please let me know if it works for you..
>>>
>>> Thanks,
>>> Manjax23
>>>
>>>
>>> Richard Hoberman wrote:
>>>   
 I'm using Drools 4 (M2), which is supposed to support nested accessors*

 This works: when Claim( submissionInfo == null), but not this: when
 Claim( submissionInfo.date == null)

 Rule file, SubmissionInfo.java and exception are below.

 What am I missing?

 Richard




 * See
 http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
 which states "Support to nested accessors, property navigation and
 simplified collection, arrays and maps syntax"

 Rule File

 ---
 package mvanamibia.claim;

 import java.lang.Object;
 import java.lang.String;
 import java.lang.Double;
 import java.util.Date;
 import java.util.List;
 import java.util.ArrayList;
 import com.sadalbari.mvanamibia.beans.Claim;
 import com.sadalbari.mvanamibia.beans.Mandate;
 import com.sadalbari.mvanamibia.beans.SubmissionInfo;
 import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;

 global ClaimEvaluation evaluation;

 rule "hasDateReceived"

 when
 Claim( submissionInfo.date == null )
 then
 evaluation.getFailures().add("missing: date received");
 end

 ---

 Exception
 ---
 org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
 token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type 
 RIGHT_PAREN
 at org.drools.rule.Package.checkValidity(Package.java:368)
 at
 org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
 at
 com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
 at
 com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testMandateClaim(UnregisteredClaimValidationTest.java:56)
 ... Removed 22 stack frames
 FAILED: testEmptyClaim
 org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
 token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type 
 RIGHT_PAREN
 at org.drools.rule.Package.checkVal

[rules-users] Drools - is dynamic change possible ?

2007-08-16 Thread pns77

Have been able to execute/run a sample Drools file

import com.sample.Message;
 
rule "Hello World"
when
m : Message( status == Message.HELLO, message : message,
testStringExternal : testStringExternal )
then
System.out.println( message );
m.setMessage( "Goodbye cruel world" );
System.out.println( testStringExternal + "Message.HELLO" );
m.setStatus( Message.GOODBYE );
update( m );
end

Now, is it possible to change the logic dynamically at runtime ? Or is the
drl file used only to externalize the business logic? I tried changing the
message in drl file and it didnt get reflected

Environment - RAD 6.0/jdk 1.4

Used the following set of jar files
C:\Drools\libraries\drools-core.jar;
C:\Drools\libraries\drools-compiler.jar;
C:\Drools\libraries\mvel14.jar;
C:\Drools\libraries\antlr-runtime.jar;
C:\Drools\libraries\xstream.jar;
C:\Drools\lib\core-3.2.3.v_686_R32x.jar; 
-- 
View this message in context: 
http://www.nabble.com/Drools---is-dynamic-change-possible---tf4277622.html#a12175583
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


Re: [rules-users] Please help - losing hair

2007-08-16 Thread Richard Hoberman
1. I can't find any mention of dialects anywhere in the Drools 4
manual.  Am I missing something?

2. I've tried the following after finding a snippet in the archives for
this list:

package mvanamibia.claim;

import java.lang.Object;
import java.lang.String;
import java.lang.Double;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.sadalbari.mvanamibia.beans.Claim;
import com.sadalbari.mvanamibia.beans.Mandate;
import com.sadalbari.mvanamibia.beans.SubmissionInfo;
import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;

global ClaimEvaluation evaluation;

rule "hasDateReceived"
dialect "mvel"
when
Claim( submissionInfo == null )
then
evaluation.getViolations().add("missing: date received");
end


but it gives the following exception:

java.lang.NullPointerException
at
org.drools.rule.builder.RuleBuildContext.(RuleBuildContext.java:115)
at
org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:350)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:233)
at

org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:157)
at

com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:29)
at

com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
... Removed 22 stack frames


Thanks

Richard


Mark Proctor wrote:
> in theory for nested accessors it should switch to the MVEL dialect
> automatically. You only need to specify the MVEL dialect explicitely
> for eval, return value and consequences.
>
> Mark
> Manjax23 wrote:
>> I think you should use dialect "mvel" when accessing the nested accessors.
>> and I had some trouble with "mvel" dialect in 4M2 release.
>>
>> Please let me know if it works for you..
>>
>> Thanks,
>> Manjax23
>>
>>
>> Richard Hoberman wrote:
>>   
>>> I'm using Drools 4 (M2), which is supposed to support nested accessors*
>>>
>>> This works: when Claim( submissionInfo == null), but not this: when
>>> Claim( submissionInfo.date == null)
>>>
>>> Rule file, SubmissionInfo.java and exception are below.
>>>
>>> What am I missing?
>>>
>>> Richard
>>>
>>>
>>>
>>>
>>> * See
>>> http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
>>> which states "Support to nested accessors, property navigation and
>>> simplified collection, arrays and maps syntax"
>>>
>>> Rule File
>>>
>>> ---
>>> package mvanamibia.claim;
>>>
>>> import java.lang.Object;
>>> import java.lang.String;
>>> import java.lang.Double;
>>> import java.util.Date;
>>> import java.util.List;
>>> import java.util.ArrayList;
>>> import com.sadalbari.mvanamibia.beans.Claim;
>>> import com.sadalbari.mvanamibia.beans.Mandate;
>>> import com.sadalbari.mvanamibia.beans.SubmissionInfo;
>>> import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
>>>
>>> global ClaimEvaluation evaluation;
>>>
>>> rule "hasDateReceived"
>>>
>>> when
>>> Claim( submissionInfo.date == null )
>>> then
>>> evaluation.getFailures().add("missing: date received");
>>> end
>>>
>>> ---
>>>
>>> Exception
>>> ---
>>> org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
>>> token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
>>> at org.drools.rule.Package.checkValidity(Package.java:368)
>>> at
>>> org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
>>> at
>>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
>>> at
>>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testMandateClaim(UnregisteredClaimValidationTest.java:56)
>>> ... Removed 22 stack frames
>>> FAILED: testEmptyClaim
>>> org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
>>> token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
>>> at org.drools.rule.Package.checkValidity(Package.java:368)
>>> at
>>> org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
>>> at
>>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
>>> at
>>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
>>> ... Removed 22 stack frames
>>>
>>>
>>> --
>>> SubmissionInfo (relevant bits)
>>>
>>> public class SubmissionInfo implements Serializabl

RE: [rules-users] RuntimeDroolsException

2007-08-16 Thread Anstis, Michael \(M.\)
More importantly why ILOG are using org.drools.* classes! ;-)
 
Of course there could be another explanation.




From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Proctor
Sent: 16 August 2007 12:20
To: Rules Users List
Cc: Pierre Fricke
Subject: Re: [rules-users] RuntimeDroolsException


I'll probably want to speak to ILog about help with JRules. 

Mark
Raffaele Viola wrote: 

Hi,

I'm starting to use eclipse plug.in for JRules. I
created the example JRules project in eclipse and I tried to start it as
Java Application but I got this exception

org.drools.RuntimeDroolsException: Unable to load
dialect 'org.drools.rule.builder.dialect.java.JavaDialect:java'
at
org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry
(PackageBuilderConfiguration.java:156)
at org.drools.compiler.PackageBuilder.(
PackageBuilder.java:131)
at org.drools.compiler.PackageBuilder
.(PackageBuilder.java:84)
at
com.sample.DroolsTest.readRule(DroolsTest.java:50) 
at com.sample.DroolsTest.main(DroolsTest.java:21)

Can someone help me?
Thanks
Raffo





___
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


Re: [rules-users] Please help - losing hair

2007-08-16 Thread Mark Proctor
in theory for nested accessors it should switch to the MVEL dialect 
automatically. You only need to specify the MVEL dialect explicitely for 
eval, return value and consequences.


Mark
Manjax23 wrote:

I think you should use dialect "mvel" when accessing the nested accessors.
and I had some trouble with "mvel" dialect in 4M2 release.

Please let me know if it works for you..

Thanks,
Manjax23


Richard Hoberman wrote:
  

I'm using Drools 4 (M2), which is supposed to support nested accessors*

This works: when Claim( submissionInfo == null), but not this: when
Claim( submissionInfo.date == null)

Rule file, SubmissionInfo.java and exception are below.

What am I missing?

Richard




* See
http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
which states "Support to nested accessors, property navigation and
simplified collection, arrays and maps syntax"

Rule File

---
package mvanamibia.claim;

import java.lang.Object;
import java.lang.String;
import java.lang.Double;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.sadalbari.mvanamibia.beans.Claim;
import com.sadalbari.mvanamibia.beans.Mandate;
import com.sadalbari.mvanamibia.beans.SubmissionInfo;
import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;

global ClaimEvaluation evaluation;

rule "hasDateReceived"

when
Claim( submissionInfo.date == null )
then
evaluation.getFailures().add("missing: date received");
end

---

Exception
---
org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:368)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testMandateClaim(UnregisteredClaimValidationTest.java:56)
... Removed 22 stack frames
FAILED: testEmptyClaim
org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:368)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
... Removed 22 stack frames


--
SubmissionInfo (relevant bits)

public class SubmissionInfo implements Serializable {

private Date date;

public Date getDate() {
return date;
}

public void setDate(Date date) {
this.date = date;
}


___
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


Re: [rules-users] RuntimeDroolsException

2007-08-16 Thread Mark Proctor

I'll probably want to speak to ILog about help with JRules.

Mark
Raffaele Viola wrote:

Hi,

I'm starting to use eclipse plug.in  for JRules. I 
created the example JRules project in eclipse and I tried to start it 
as Java Application but I got this exception


org.drools.RuntimeDroolsException: Unable to load dialect 
'org.drools.rule.builder.dialect.java.JavaDialect:java'
at 
org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry 
(PackageBuilderConfiguration.java:156)

at org.drools.compiler.PackageBuilder.( PackageBuilder.java:131)
at org.drools.compiler.PackageBuilder .(PackageBuilder.java:84)
at com.sample.DroolsTest.readRule(DroolsTest.java:50)
at com.sample.DroolsTest.main(DroolsTest.java:21)

Can someone help me?
Thanks
Raffo


___
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] RuntimeDroolsException

2007-08-16 Thread Raffaele Viola
Hi,

I'm starting to use eclipse plug.in for JRules. I created the example JRules
project in eclipse and I tried to start it as Java Application but I got
this exception

org.drools.RuntimeDroolsException: Unable to load dialect '
org.drools.rule.builder.dialect.java.JavaDialect:java'
at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(
PackageBuilderConfiguration.java:156)
at org.drools.compiler.PackageBuilder.(PackageBuilder.java:131)
at org.drools.compiler.PackageBuilder.(PackageBuilder.java:84)
at com.sample.DroolsTest.readRule(DroolsTest.java:50)
at com.sample.DroolsTest.main(DroolsTest.java:21)

Can someone help me?
Thanks
Raffo
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Please help - losing hair

2007-08-16 Thread Manjax23


I think you should use dialect "mvel" when accessing the nested accessors.
and I had some trouble with "mvel" dialect in 4M2 release.

Please let me know if it works for you..

Thanks,
Manjax23


Richard Hoberman wrote:
> 
> I'm using Drools 4 (M2), which is supposed to support nested accessors*
> 
> This works: when Claim( submissionInfo == null), but not this: when
> Claim( submissionInfo.date == null)
> 
> Rule file, SubmissionInfo.java and exception are below.
> 
> What am I missing?
> 
> Richard
> 
> 
> 
> 
> * See
> http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
> which states "Support to nested accessors, property navigation and
> simplified collection, arrays and maps syntax"
> 
> Rule File
> 
> ---
> package mvanamibia.claim;
> 
> import java.lang.Object;
> import java.lang.String;
> import java.lang.Double;
> import java.util.Date;
> import java.util.List;
> import java.util.ArrayList;
> import com.sadalbari.mvanamibia.beans.Claim;
> import com.sadalbari.mvanamibia.beans.Mandate;
> import com.sadalbari.mvanamibia.beans.SubmissionInfo;
> import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
> 
> global ClaimEvaluation evaluation;
> 
> rule "hasDateReceived"
> 
> when
> Claim( submissionInfo.date == null )
> then
> evaluation.getFailures().add("missing: date received");
> end
> 
> ---
> 
> Exception
> ---
> org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
> token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
> at org.drools.rule.Package.checkValidity(Package.java:368)
> at
> org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
> at
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
> at
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testMandateClaim(UnregisteredClaimValidationTest.java:56)
> ... Removed 22 stack frames
> FAILED: testEmptyClaim
> org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
> token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
> at org.drools.rule.Package.checkValidity(Package.java:368)
> at
> org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
> at
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
> at
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
> ... Removed 22 stack frames
> 
> 
> --
> SubmissionInfo (relevant bits)
> 
> public class SubmissionInfo implements Serializable {
> 
> private Date date;
> 
> public Date getDate() {
> return date;
> }
> 
> public void setDate(Date date) {
> this.date = date;
> }
> 
> 
> ___
> 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/Please-help---losing-hair-tf4278339.html#a12179132
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


Re: [rules-users] Problems Extending the Golfer example - Cartesian joins ??

2007-08-16 Thread Mark Proctor

not yet.

Mark
Simon French wrote:

Hi Mark,
Any news on this one? I know its just a puzzle, but I would have hoped 
drools would cope with it.
I was hoping to use the golfer example as a training aid to people in 
work.


Regards

Simon

On 09/08/07, *Simon French* <[EMAIL PROTECTED] 
> wrote:


Hi Mark,
I gave the latest version a go but still having the same problem.
It appears Drools doesn't like it when the last name is asserted
into working memory.
The memory usage at this stage is just under 900meg.
After that drools gradually eats up all the available memory but
no more assertions are made.

Regards

Simon



On 03/08/07, *Mark Proctor * <[EMAIL PROTECTED]
> wrote:

I must admit I didn't check against this example. But we did
find a memory leak. Each activation remembers its parent
activation, this chain was never getting nulled, which meant
for recursive algorithms it went out of memory very quickly -
this is now fixed. Maybe you can check trunk and make sure
that fixes our problem? Trunk is broken at the moment, while
we do MVEL updates, but should be fixed in a few hours. I'll
message the list when it is - you won't need to build anything
yourself as you will then be able to get the latest snapshot
to try from here
http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules.


Mark
Simon French wrote:

Hi Mark,
After all the hard work you guys have put into drools
recently I hope you had a good holiday.
Has anybody had a chance to look at this?

Simon

On 20/07/07, * Mark Proctor* <[EMAIL PROTECTED]
> wrote:

we'll look into this to see where the memory is going.
but won't be for another week or so - I'm currently on
holiday.

Mark
Simon French wrote:

Hi,
After attending a session with Mark Proctor in London I
was inspired to play around with Drools in a slightly
different way than we use it for in the workplace, and
try and solve a puzzle.
Unfortunately I couldn't get Drools to solve it as I
kept getting memory problems (I believe are cartesian
joins being the problem),
so I decided to extend the golfer example to see if I
got the same problem
I added two new names and a new integer property, club

// create all possible Golfer objects
String[] names = new String[] { "Fred",
"Joe", "Bob", "Tom", "Des", "Terry" };
String[] colors = new String[] { "red",
"blue", "plaid", "orange","black", "white" };
int[] positions = new int[] { 1, 2, 3,
4, 5, 6 };
int[] clubs = new int[] {9,8,7,4,5,5};
   
for ( int n = 0; n < names.length; n++ ) {

   for ( int c = 0; c < colors.length;
c++ ) {
  for ( int p = 0; p <
positions.length; p++ ) {
  for ( int q = 0; q <
clubs.length; q++ ) {
  session.insert(new
Golfer( names[n], colors[c], positions[p], clubs[q]) );




Then changed the golder.drl to:

package com.sample

import com.sample.Golfer;


rule "Golfer Riddle"
when
// A golfer named Fred,
   
Golfer( name == "Fred",

$fredsPosition : position, $fredsColor :
color, $fredsClub : club   )

// Der Golfer hinter Fred trägt blau
Golfer( $unknownsName : name != "Fred",
$unknownsPosition :  position == (
$fredsPosition + 1 ),
$unknownsColor : color == "blue", color
!= $fredsColor,
$unknownsClub : club == 5 )

// Joe steht an zweiter Stelle   
Golfer( name == "Joe", $joesPosition : position

== 2,
position != $fredsPosition,
$joesColor : color != $fredsColor,
$joesClub : club == 5 )

// Bob traegt Karo   
Golfer( name == "Bob",

name != $unknownsName,
$bobsPosition : position != $fredsPosition,
position != $unknownsPosition, position
!=
  

Re: [rules-users] Problems Extending the Golfer example - Cartesian joins ??

2007-08-16 Thread Simon French
Hi Mark,
Any news on this one? I know its just a puzzle, but I would have hoped
drools would cope with it.
I was hoping to use the golfer example as a training aid to people in work.

Regards

Simon

On 09/08/07, Simon French <[EMAIL PROTECTED]> wrote:
>
> Hi Mark,
> I gave the latest version a go but still having the same problem.
> It appears Drools doesn't like it when the last name is asserted into
> working memory.
> The memory usage at this stage is just under 900meg.
> After that drools gradually eats up all the available memory but no more
> assertions are made.
>
> Regards
>
> Simon
>
>
> On 03/08/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
> >
> >  I must admit I didn't check against this example. But we did find a
> > memory leak. Each activation remembers its parent activation, this chain was
> > never getting nulled, which meant for recursive algorithms it went out of
> > memory very quickly - this is now fixed. Maybe you can check trunk and make
> > sure that fixes our problem? Trunk is broken at the moment, while we do MVEL
> > updates, but should be fixed in a few hours. I'll message the list when it
> > is - you won't need to build anything yourself as you will then be able to
> > get the latest snapshot to try from here
> > http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules.
> >
> > Mark
> > Simon French wrote:
> >
> > Hi Mark,
> > After all the hard work you guys have put into drools recently I hope
> > you had a good holiday.
> > Has anybody had a chance to look at this?
> >
> > Simon
> >
> > On 20/07/07, Mark Proctor <[EMAIL PROTECTED]> wrote:
> > >
> > > we'll look into this to see where the memory is going. but won't be
> > > for another week or so - I'm currently on holiday.
> > >
> > > Mark
> > > Simon French wrote:
> > >
> > > Hi,
> > > After attending a session with Mark Proctor in London I was inspired
> > > to play around with Drools in a slightly different way than we use it for 
> > > in
> > > the workplace, and try and solve a puzzle.
> > > Unfortunately I couldn't get Drools to solve it as I kept getting
> > > memory problems (I believe are cartesian joins being the problem),
> > > so I decided to extend the golfer example to see if I got the same
> > > problem
> > > I added two new names and a new integer property, club
> > >
> > > // create all possible Golfer objects
> > > String[] names = new String[] { "Fred", "Joe", "Bob",
> > > "Tom", "Des", "Terry" };
> > > String[] colors = new String[] { "red", "blue",
> > > "plaid", "orange","black", "white" };
> > > int[] positions = new int[] { 1, 2, 3, 4, 5, 6 };
> > > int[] clubs = new int[] {9,8,7,4,5,5};
> > >
> > > for ( int n = 0; n < names.length; n++ ) {
> > >for ( int c = 0; c < colors.length; c++ ) {
> > >   for ( int p = 0; p < positions.length; p++ )
> > > {
> > >   for ( int q = 0; q < clubs.length; q++ )
> > > {
> > >   session.insert(new Golfer( names[n],
> > > colors[c], positions[p], clubs[q]) );
> > >
> > > 
> > >
> > >
> > > Then changed the golder.drl to:
> > >
> > > package com.sample
> > >
> > > import com.sample.Golfer;
> > >
> > >
> > > rule "Golfer Riddle"
> > > when
> > > // A golfer named Fred,
> > >
> > > Golfer( name == "Fred",
> > > $fredsPosition : position, $fredsColor : color,
> > > $fredsClub : club   )
> > >
> > > // Der Golfer hinter Fred trägt blau
> > > Golfer( $unknownsName : name != "Fred",
> > > $unknownsPosition :  position == ( $fredsPosition + 1
> > > ),
> > > $unknownsColor : color == "blue", color !=
> > > $fredsColor,
> > > $unknownsClub : club == 5 )
> > >
> > > // Joe steht an zweiter Stelle
> > > Golfer( name == "Joe", $joesPosition : position == 2,
> > > position != $fredsPosition,
> > > $joesColor : color != $fredsColor,
> > > $joesClub : club == 5 )
> > >
> > > // Bob traegt Karo
> > > Golfer( name == "Bob",
> > > name != $unknownsName,
> > > $bobsPosition : position != $fredsPosition,
> > > position != $unknownsPosition, position !=
> > > $joesPosition,
> > > $bobsColor : color == "plaid",
> > > color != $fredsColor, color != $joesColor,
> > > color != $unknownsColor,
> > > $bobsClub : club < $joesClub )
> > >
> > > // Tom ist nicht 1. oder 4., traegt kein Orange
> > > Golfer( $tomsName : name == "Tom",
> > > $tomsPosition : position != 1, position != 4,
> > > position != $fredsPosition, position != $joesPosition,
> > >
> > > position !=
> > > $bobsPosition,
> > > $tomsColor : color != "orange", color != "blue",

[rules-users] Please help - losing hair

2007-08-16 Thread Richard Hoberman
I'm using Drools 4 (M2), which is supposed to support nested accessors*

This works: when Claim( submissionInfo == null), but not this: when
Claim( submissionInfo.date == null)

Rule file, SubmissionInfo.java and exception are below.

What am I missing?

Richard




* See
http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
which states "Support to nested accessors, property navigation and
simplified collection, arrays and maps syntax"

Rule File

---
package mvanamibia.claim;

import java.lang.Object;
import java.lang.String;
import java.lang.Double;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.sadalbari.mvanamibia.beans.Claim;
import com.sadalbari.mvanamibia.beans.Mandate;
import com.sadalbari.mvanamibia.beans.SubmissionInfo;
import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;

global ClaimEvaluation evaluation;

rule "hasDateReceived"

when
Claim( submissionInfo.date == null )
then
evaluation.getFailures().add("missing: date received");
end

---

Exception
---
org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:368)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testMandateClaim(UnregisteredClaimValidationTest.java:56)
... Removed 22 stack frames
FAILED: testEmptyClaim
org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
token: [EMAIL PROTECTED],471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:368)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
... Removed 22 stack frames


--
SubmissionInfo (relevant bits)

public class SubmissionInfo implements Serializable {

private Date date;

public Date getDate() {
return date;
}

public void setDate(Date date) {
this.date = date;
}


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


RE: [rules-users] could not access property ('=')

2007-08-16 Thread Arsalan S. Zaidi

Hi.

 

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

 

BTW, the work around works just fine. 

 

Thanks!

 

--Arsalan

 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli
Sent: 13 August 2007 22:16
To: Rules Users List
Subject: Re: [rules-users] could not access property ('=')

 



   This looks like an MVEL issue, since your expression is being
converted into an MVEL predicate. May I ask you please to open a JIRA
for that bug?

   Meanwhile, a workaround that shall work for you and may give you
improved perf is to split your pattern into 2 patterns using the from
keyword: 

 

when

   $dto : DTO( )

   W250_4_1( value in ("0" ,"1" ,"6" ,"7" ,"A" ,"C" ,"D" ,"G"
,"L" ,"M" ,"P" ,"Q" ,"S" ,"V" ,"Z" ) ) from $dto.w250_4_1

then


   Thanks, and hope it helps.

   Edson



2007/8/13, Arsalan S. Zaidi < [EMAIL PROTECTED]>:

Hi.

 

I've currently evaluating Drools 4.0 for a project of ours and I'm
running into some problems.

 

I have a rule which looks like this:

 

rule "W250.42 Editable"

  when

DTO(w250_4_1.value in ("0" ,"1" ,"6" ,"7" ,"A" ,"C" ,"D"
,"G" ,"L" ,"M" ,"P" ,"Q" ,"S" ,"V" ,"Z" ) )

  then

System.out.println ("0" );

Action action = createAction("W250.42" , false , true );

retList.add(action); 

end 

 

 

both DTO and w250_4_1 are extremely simple beans. w250_4_1 just has 1
property 'value' which is a String and DTO has one property w250_4_1
which is the bean w250_4_1 .

 

Now when I put "0" into w250_4_1 then everything works fine. The rule is
true and the 'then' portion is executed. However, if I set w250_4_1 to
"6" (which is also present in the in (...)) then I get the following
error.

 

org.drools.RuntimeDroolsException : Exception executing predicate
[EMAIL PROTECTED]

  at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:1
97 )

  at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:122 )

  at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(Compo
siteObjectSinkAdapter.java:317 )

  at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168 )

  at org.drools.reteoo.Rete.assertObject(Rete.java:168 )

  at org.drools.reteoo.ReteooRuleBase.assertObject(
ReteooRuleBase.java:190) 

  at
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:
70 )

  at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.jav
a:848 )

  at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.jav
a:822 )

  at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.jav
a:623 )

  at com.sample.DroolsTest.main( DroolsTest.java:34)

Caused by: org.mvel.PropertyAccessException: failed to access property:
<<==>> in: class com.sample.DTOShadowProxy

  at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChai
n(ReflectiveAccessorOptimizer.java:137 )

  at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccess
or(ReflectiveAccessorOptimizer.java:96 )

  at org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:194 )

  at org.mvel.ast.Or.getReducedValueAccelerated(Or.java:18 )

  at org.mvel.MVELRuntime.execute( MVELRuntime.java:87)

  at org.mvel.CompiledExpression.getValue(
CompiledExpression.java:98) 

  at org.mvel.MVEL.executeExpression( MVEL.java:202)

  at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpre
ssion.java:36 )

  at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:1
91 )

  ... 10 more

Caused by: org.mvel.PropertyAccessException: could not access property
('=') 

  at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropert
y(ReflectiveAccessorOptimizer.java:252 )

  at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChai
n(ReflectiveAccessorOptimizer.java:106 )

  ... 18 more

 

If I keep w250_4_1 as "0", but move "0" in the rule to any other place
place in the in() list (e.g. in ("1","0",...), then I get a similar
error.

 

I get similar errors when trying to use 'not in' in the same
circumstance, except that then the property is ('!')

 

What seems to be the issue?

 

Thanks in advance!

 

Regards,

 

--Arsalan

This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all
copies of this message. 


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