4.0 Language Updates
by Ronald R. DiFrango
All,
I have the following rule:
rule "Repayment Code Requires Approval"
salience 60
when
repaymentCode : RepaymentCode( code == "MD", matchApprv == "Y" )
mdOutput : ModelDiscrepancyOutput( $amt1 : sumRTVQty, $amt2 :
sumCmAndRnr)
eval($amt1.doubleValue() == $amt2.doubleValue())
then
System.out.println("Repayment Code Requires Approval");
processMDAdjustments(drools.getWorkingMemory().getQueryResults( "MD
Adjustments" ), StatusConstants.APPROVAL);
System.out.println("mdOutput: " + mdOutput);
end
If I remember correctly, there was going to be an update to the rules
language that would allow me to eliminate the eval. Is this true and if so
what is the syntax that accomplishes this?
Ron
17 years, 5 months
RE: [rules-users] matches operator
by Hehl, Thomas
Try "^Hello.*" I think, I'm not very good with regular expressions.
For more information, have a look at:
http://www.regular-expressions.info/tutorial.html
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Ashwini Joshi
Sent: Monday, July 09, 2007 8:54 AM
To: 'Rules Users List'
Subject: RE: [rules-users] matches operator
Can you please give me example of using matches operator for startswith?
Thanks,
Ashwini
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Hehl, Thomas
Sent: Monday, July 09, 2007 5:31 PM
To: 'Rules Users List'
Subject: RE: [rules-users] matches operator
Also, Java is far stricter on syntax for regular expressions than anything
else I've seen. You can't just test your stuff at a unix prompt or using
grep to see if it works. That's just the first step. I generally use the vi
find command.
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: Monday, July 09, 2007 7:16 AM
To: Rules Users List
Subject: Re: [rules-users] matches operator
Read up on regular expression, what you just wrote there is not valid.
Mark
Ashwini Joshi wrote:
Hi,
Has anyone used the "matches" operator?
In our application we need to support startWith, endsWith operators for
string variable. I am thinking of using matches operator. But the 'matches'
operator is not working. I am trying the following code
rule "Hello World"
when
m : Message(message matches "Hello*")
then
System.out.println( "Hello World");
end
And the value set in the message is "Hello World". But it is not going into
the then clause.
If anyone has already used matches operator I would like to know how we can
use it for startswith, endsWith. How do we specify the regular expression?
Can we use "*"
Thanks,
Ashwini
DISCLAIMER ========== This e-mail may contain privileged and confidential
information which is the property of Persistent Systems Pvt. Ltd. It is
intended only for the use of the individual or entity to which it is
addressed. If you are not the intended recipient, you are not authorized to
read, retain, copy, print, distribute or use this message. If you have
received this communication in error, please notify the sender and delete
all copies of this message. Persistent Systems Pvt. Ltd. does not accept any
liability for virus infected mails.
_____
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users
<https://lists.jboss.org/mailman/listinfo/rules-users>
DISCLAIMER ========== This e-mail may contain privileged and confidential
information which is the property of Persistent Systems Pvt. Ltd. It is
intended only for the use of the individual or entity to which it is
addressed. If you are not the intended recipient, you are not authorized to
read, retain, copy, print, distribute or use this message. If you have
received this communication in error, please notify the sender and delete
all copies of this message. Persistent Systems Pvt. Ltd. does not accept any
liability for virus infected mails.
17 years, 5 months
RE: [rules-users] matches operator
by Hehl, Thomas
Also, Java is far stricter on syntax for regular expressions than anything
else I've seen. You can't just test your stuff at a unix prompt or using
grep to see if it works. That's just the first step. I generally use the vi
find command.
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: Monday, July 09, 2007 7:16 AM
To: Rules Users List
Subject: Re: [rules-users] matches operator
Read up on regular expression, what you just wrote there is not valid.
Mark
Ashwini Joshi wrote:
Hi,
Has anyone used the "matches" operator?
In our application we need to support startWith, endsWith operators for
string variable. I am thinking of using matches operator. But the 'matches'
operator is not working. I am trying the following code
rule "Hello World"
when
m : Message(message matches "Hello*")
then
System.out.println( "Hello World");
end
And the value set in the message is "Hello World". But it is not going into
the then clause.
If anyone has already used matches operator I would like to know how we can
use it for startswith, endsWith. How do we specify the regular expression?
Can we use "*"
Thanks,
Ashwini
DISCLAIMER ========== This e-mail may contain privileged and confidential
information which is the property of Persistent Systems Pvt. Ltd. It is
intended only for the use of the individual or entity to which it is
addressed. If you are not the intended recipient, you are not authorized to
read, retain, copy, print, distribute or use this message. If you have
received this communication in error, please notify the sender and delete
all copies of this message. Persistent Systems Pvt. Ltd. does not accept any
liability for virus infected mails.
_____
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users
<https://lists.jboss.org/mailman/listinfo/rules-users>
17 years, 5 months
RE: rules-users Digest, Vol 8, Issue 45
by Sikkandar Nawabjan
anybody have the idea of what is consequneceexception....why it is occured?
am using droosl 3.0.6
org.drools.spi.ConsequenceException - org.drools.RuntimeDroolsException: java.lang.NullPointerExceptionorg.drools.spi.ConsequenceException: org.drools.RuntimeDroolsException: java.lang.NullPointerException at org.drools.common.DefaultAgenda.fireActivation(Unknown Source) at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source) at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source) at
Thanks and Regs,
Basha
________________________________
From: rules-users-bounces(a)lists.jboss.org on behalf of rules-users-request(a)lists.jboss.org
Sent: Mon 7/9/2007 1:04 PM
To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 8, Issue 45
Send rules-users mailing list submissions to
rules-users(a)lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
rules-users-request(a)lists.jboss.org
You can reach the person managing the list at
rules-users-owner(a)lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."
Today's Topics:
1. Re: Re: No OR syntax (Ronald R. DiFrango)
2. More JBoss Rules IDE 4.x upgrade Woes (Ronald R. DiFrango)
3. Re: Re: No OR syntax (Mark Proctor)
4. Re: More JBoss Rules IDE 4.x upgrade Woes (Ronald R. DiFrango)
5. matches operator (Ashwini Joshi)
----------------------------------------------------------------------
Message: 1
Date: Sun, 8 Jul 2007 17:56:27 -0400
From: "Ronald R. DiFrango" <ron.difrango(a)gmail.com>
Subject: Re: [rules-users] Re: No OR syntax
To: "Mark Proctor" <mproctor(a)codehaus.org>
Cc: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID:
<eb33f140707081456y5b1e2567gf3a86f67a1f2eee7(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Nice; an in operator just like SQL :-)
On 7/7/07, Mark Proctor <mproctor(a)codehaus.org> wrote:
>
> Sorry it's now && and ||
> You can also us the 'in' operator
> Cheese( type in ( 'stilton', 'brie' ))
> Cheese( type not in ( 'stilton', 'brie' ))
> Cheese( type memberOf $myCheeseTypeList )
> Cheese( type not memberOf $myCheeseTypeList )
>
> Mark
>
> Ronald R. DiFrango wrote:
>
> Answered my own question:
>
> MyObject (status == StatusConstants.MATCHED | == StatusConstants.APPROVAL)
>
> On 7/7/07, Ronald R. DiFrango < ron.difrango(a)gmail.com> wrote:
> >
> > All,
> >
> > If I remember correctly, in the 4.x version of Drools you were adding an
> > or type syntax where you could compare a value against multiple values.
> > What is the new syntax for it?
> >
> > I am looking to do something logically like:
> >
> > MyObject (status in ("Open" or "Matched")
> >
> > Ron
> >
>
> ------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070708/378aa15...
------------------------------
Message: 2
Date: Sun, 8 Jul 2007 17:59:47 -0400
From: "Ronald R. DiFrango" <ron.difrango(a)gmail.com>
Subject: [rules-users] More JBoss Rules IDE 4.x upgrade Woes
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Message-ID:
<eb33f140707081459h5bde7cc9ud5ddb2a0c8e52b83(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
All
I have to that upgrading a 3.0.x JBoss rules project to a 4.0.x version is
not the smoothest transition.
First, I reported that the library path is not correct but I was able to
work around this issue.
Now, I found another feature/bug. When I click on RETE view, I get the
following exception:
!ENTRY org.drools.eclipse 4 120 2007-07-08 17:54:09.181 !MESSAGE Internal
error in Drools Plugin: !STACK 0 java.lang.Exception: Unable to parse rules
to show RETE view! at
org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source) at
org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source) at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
ModalContext.java:113) !ENTRY org.drools.eclipse 4 120 2007-07-08 17:54:
09.259 !MESSAGE Internal error in Drools Plugin: !STACK 0
java.lang.reflect.InvocationTargetException at
org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source) at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
ModalContext.java:113) Caused by: java.lang.Exception: Unable to parse rules
to show RETE view! at
org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source) ...
2 more Root exception: java.lang.Exception: Unable to parse rules to show
RETE view! at org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown
Source) at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
ModalContext.java:113)
Do I really have to create a new Project and re-import everything over to it
to get it to work properly? Is there no upgrade feature that automatically
upgrades my project like in most other Eclipse plugins?
Thanks!
Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070708/c55b08f...
------------------------------
Message: 3
Date: Sun, 08 Jul 2007 23:29:48 +0100
From: Mark Proctor <mproctor(a)codehaus.org>
Subject: Re: [rules-users] Re: No OR syntax
To: difranr(a)alumni.pitt.edu, Rules Users List
<rules-users(a)lists.jboss.org>
Message-ID: <4691655C.90202(a)codehaus.org>
Content-Type: text/plain; charset="iso-8859-1"
The 'in' operator is just sugar for == 'stilton' || == 'brie' but we
felt it improved the declarative nature of the language sufficiently to
warrant the sugar.
Mark
Ronald R. DiFrango wrote:
> Nice; an in operator just like SQL :-)
>
> On 7/7/07, *Mark Proctor* <mproctor(a)codehaus.org
> <mailto:mproctor@codehaus.org>> wrote:
>
> Sorry it's now && and ||
> You can also us the 'in' operator
> Cheese( type in ( 'stilton', 'brie' ))
> Cheese( type not in ( 'stilton', 'brie' ))
> Cheese( type memberOf $myCheeseTypeList )
> Cheese( type not memberOf $myCheeseTypeList )
>
> Mark
>
> Ronald R. DiFrango wrote:
>> Answered my own question:
>>
>> MyObject (status == StatusConstants.MATCHED | ==
>> StatusConstants.APPROVAL)
>>
>> On 7/7/07, *Ronald R. DiFrango* < ron.difrango(a)gmail.com
>> <mailto:ron.difrango@gmail.com>> wrote:
>>
>> All,
>>
>> If I remember correctly, in the 4.x version of Drools you
>> were adding an or type syntax where you could compare a value
>> against multiple values. What is the new syntax for it?
>>
>> I am looking to do something logically like:
>>
>> MyObject (status in ("Open" or "Matched")
>>
>> Ron
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>>
>> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> <https://lists.jboss.org/mailman/listinfo/rules-users>
>>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070708/409cb25...
------------------------------
Message: 4
Date: Sun, 8 Jul 2007 20:19:13 -0400
From: "Ronald R. DiFrango" <ron.difrango(a)gmail.com>
Subject: [rules-users] Re: More JBoss Rules IDE 4.x upgrade Woes
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Message-ID:
<eb33f140707081719q5853aaa1h9702cca86227671d(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
All,
OK, a new project cleared up the RETE view. I will say the problem still
does exist where the project does not work properly unless I import the JDT
compiler.
Ron
On 7/8/07, Ronald R. DiFrango <ron.difrango(a)gmail.com> wrote:
>
> All
>
> I have to that upgrading a 3.0.x JBoss rules project to a 4.0.x version is
> not the smoothest transition.
>
> First, I reported that the library path is not correct but I was able to
> work around this issue.
>
> Now, I found another feature/bug. When I click on RETE view, I get the
> following exception:
>
> !ENTRY org.drools.eclipse 4 120 2007-07-08 17:54:09.181 !MESSAGE Internal
> error in Drools Plugin: !STACK 0 java.lang.Exception: Unable to parse
> rules to show RETE view! at
> org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source)
> at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source) at
> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
> ModalContext.java:113) !ENTRY org.drools.eclipse 4 120 2007-07-08 17:54:
> 09.259 !MESSAGE Internal error in Drools Plugin: !STACK 0
> java.lang.reflect.InvocationTargetException at
> org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source) at
> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
> ModalContext.java:113) Caused by: java.lang.Exception: Unable to parse
> rules to show RETE view! at
> org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source)
> ... 2 more Root exception: java.lang.Exception: Unable to parse rules to
> show RETE view! at
> org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source)
> at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source) at
> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
> ModalContext.java:113)
>
>
> Do I really have to create a new Project and re-import everything over to
> it to get it to work properly? Is there no upgrade feature that
> automatically upgrades my project like in most other Eclipse plugins?
>
> Thanks!
>
> Ron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070708/15eedb5...
------------------------------
Message: 5
Date: Mon, 9 Jul 2007 13:05:25 +0530
From: "Ashwini Joshi" <ashwini_joshi(a)persistent.co.in>
Subject: [rules-users] matches operator
To: <rules-users(a)lists.jboss.org>
Message-ID: <00cd01c7c1fb$b72c14e0$0e6f4d0a(a)persistent.co.in>
Content-Type: text/plain; charset="us-ascii"
Hi,
Has anyone used the "matches" operator?
In our application we need to support startWith, endsWith operators for
string variable. I am thinking of using matches operator. But the 'matches'
operator is not working. I am trying the following code
rule "Hello World"
when
m : Message(message matches "Hello*")
then
System.out.println( "Hello World");
end
And the value set in the message is "Hello World". But it is not going into
the then clause.
If anyone has already used matches operator I would like to know how we can
use it for startswith, endsWith. How do we specify the regular expression?
Can we use "*"
Thanks,
Ashwini
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070709/d9bbcbc...
------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
End of rules-users Digest, Vol 8, Issue 45
******************************************
17 years, 5 months
matches operator
by Ashwini Joshi
Hi,
Has anyone used the "matches" operator?
In our application we need to support startWith, endsWith operators for
string variable. I am thinking of using matches operator. But the 'matches'
operator is not working. I am trying the following code
rule "Hello World"
when
m : Message(message matches "Hello*")
then
System.out.println( "Hello World");
end
And the value set in the message is "Hello World". But it is not going into
the then clause.
If anyone has already used matches operator I would like to know how we can
use it for startswith, endsWith. How do we specify the regular expression?
Can we use "*"
Thanks,
Ashwini
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.
17 years, 5 months
toString
by Mike D
Good morning. I'm new to Drools and need a little assistance on how to
compare a string to a numeric.
Example:
ShipmentHeader transMode is a numeric, while the TransMode is a character.
(We have a legacy system which we can't change... for now). Is there an
easy way to do it w/o having to run an eval?
rule "00310 Fail"
when
#conditions
$status : SendToCustomsStatus()
exists ValidationReference(validationNo == 310)
exists ValidationControl(validationNo == 310)
exists ShipmentHeader(portLading == 0,$transMode : transMode)
TransMode(transMode == $transMode, portLadingRequired == "Y")
then
#actions
$status.fail(310);
end
Thanks,
Mike
--
View this message in context: http://www.nabble.com/toString-tf4029720.html#a11446453
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 5 months
More JBoss Rules IDE 4.x upgrade Woes
by Ronald R. DiFrango
All
I have to that upgrading a 3.0.x JBoss rules project to a 4.0.x version is
not the smoothest transition.
First, I reported that the library path is not correct but I was able to
work around this issue.
Now, I found another feature/bug. When I click on RETE view, I get the
following exception:
!ENTRY org.drools.eclipse 4 120 2007-07-08 17:54:09.181 !MESSAGE Internal
error in Drools Plugin: !STACK 0 java.lang.Exception: Unable to parse rules
to show RETE view! at
org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source) at
org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source) at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
ModalContext.java:113) !ENTRY org.drools.eclipse 4 120 2007-07-08 17:54:
09.259 !MESSAGE Internal error in Drools Plugin: !STACK 0
java.lang.reflect.InvocationTargetException at
org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source) at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
ModalContext.java:113) Caused by: java.lang.Exception: Unable to parse rules
to show RETE view! at
org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source) ...
2 more Root exception: java.lang.Exception: Unable to parse rules to show
RETE view! at org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown
Source) at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(
ModalContext.java:113)
Do I really have to create a new Project and re-import everything over to it
to get it to work properly? Is there no upgrade feature that automatically
upgrades my project like in most other Eclipse plugins?
Thanks!
Ron
17 years, 5 months
No OR syntax
by Ronald R. DiFrango
All,
If I remember correctly, in the 4.x version of Drools you were adding an or
type syntax where you could compare a value against multiple values. What
is the new syntax for it?
I am looking to do something logically like:
MyObject (status in ("Open" or "Matched")
Ron
17 years, 5 months