Waleed Zedan | 1 Dec 04:53 2008
Picon

Re: Oring conditions

Hi ,

Thanks for your quick reply,

the problem that these conditions are on different objects for example

Person(name == "xyz") &&
(Cheese(type == "zzz") OR
 Address(street == "1") OR
 Phone (number == "xyz") )

Thanks again.

Best Regards,

Waleed Zedan

On Sun, Nov 30, 2008 at 7:03 PM, Edson Tirelli <tirelli <at> post.com> wrote:
 
   Are conditions 2-4 applied to the same pattern type? If so, you can use the "||" Field Constraint Connective instead of the "or" Conditional Element:

when
    Person( name  == "Bob" )
    Cheese( type == "brie" || size > 2 || price <= 30 )
then
   ...
end

    These conditions will not generate new rules as the OR CE does...

    []s
    Edson


2008/11/30 Waleed Zedan <wzedan <at> gmail.com>
Hi All,

I have this requirment : Rule A -> Condition 1 AND
                                                (Condition 2 OR
                                                 Condition 3 OR
                                                 Condition 4)
The problem is that OR (||) operators in drools are not a short circuiting operators like in Java.

May you please tell me an approach to handle this situation , i have already tried splitting it on multiple rules ,but i am searching for better approach.

I am using Drools 4.0.7.

Thanks.

Best Regards,

--
Waleed Zedan



_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat <at> www.jboss.com

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Waleed Zedan
Senior Software Developer
IT Design & Development Department
Dubai Customs

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Shigeaki Wakizaka | 1 Dec 05:28 2008
Picon

recommend way about same when , different then

Hi. I'm newbie to Drools.

I'm just wondering how I define the rules with my web application that has
several layers, web,business-logic,and data access.
one rule is used in the wab layer, and another one is used in the
business-logic layer.
Both rule's "when" are the same, but the "then"(action) is different.

It looks like code dupulication.
(I mean when the "when" changes, every rules that has same "when" has to be
changed, right?)

What's the recommended way in this situation?

thanks

Shige

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Mark Proctor | 1 Dec 05:30 2008

Re: Oring conditions

Waleed Zedan wrote:
Hi ,

Thanks for your quick reply,

the problem that these conditions are on different objects for example

Person(name == "xyz") &&
(Cheese(type == "zzz") OR
 Address(street == "1") OR
 Phone (number == "xyz") )
Bind each pattern, and do the || field constraints in an eval.

Mark

Thanks again.

Best Regards,

Waleed Zedan

On Sun, Nov 30, 2008 at 7:03 PM, Edson Tirelli <tirelli <at> post.com> wrote:
 
   Are conditions 2-4 applied to the same pattern type? If so, you can use the "||" Field Constraint Connective instead of the "or" Conditional Element:

when
    Person( name  == "Bob" )
    Cheese( type == "brie" || size > 2 || price <= 30 )
then
   ...
end

    These conditions will not generate new rules as the OR CE does...

    []s
    Edson


2008/11/30 Waleed Zedan <wzedan <at> gmail.com>
Hi All,

I have this requirment : Rule A -> Condition 1 AND
                                                (Condition 2 OR
                                                 Condition 3 OR
                                                 Condition 4)
The problem is that OR (||) operators in drools are not a short circuiting operators like in Java.

May you please tell me an approach to handle this situation , i have already tried splitting it on multiple rules ,but i am searching for better approach.

I am using Drools 4.0.7.

Thanks.

Best Regards,

--
Waleed Zedan



_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat <at> www.jboss.com

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Waleed Zedan
Senior Software Developer
IT Design & Development Department
Dubai Customs

_______________________________________________ rules-users mailing list rules-users <at> lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Thierry B | 1 Dec 09:56 2008

expand rules with dsl

Hello,

I've a question about drl and dsl with drools 4.0.

I've this rule :

rule "Contexte1"
	when
	   msg : Message(payload : payload)
	   eval (DOMUtil.xpathEquals(payload, "/Root/aaaa", "bbb"))
	   eval (DOMUtil.xpathEquals(payload, "/Root/cccc", "dddd"))
	then
           System.out.println ("Contexte 1 ************* : OK");
end

I use a dsl, to make it work, so now my drl is like that :

rule "Contexte1"
	when
		>msg : Message(payload : payload)
		xpathEquals "/Root/aaaa" "bbb"
		xpathEquals "/Root/cccc" "dddd"
	then
		Log : "Contexte 1 ************* : OK";
end

I was forced to make an ">" at the line "msg : Message(payload : payload)"
otherwise, he tells me that he can't expand that line.

There is a way to :
- avoid to put the ">" even if I have to add something else to the dsl ?
- avoid the line "msg : Message(payload : payload)" in my drl and simplify
my dsl so that xPathEquals "know" that the "payload" variable come from
any object Message in Working Memory ?

Thanks :-)

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Thierry B | 1 Dec 11:01 2008

drools 4.0 and enum in java 1.5

Hello,

I'd like to use enum in java 1.5 with drools.

I try that :

A message class :
package com.pv.rules.beans;

public class Message {

	String payload;
	Type type;

	public enum Type {
	   XML;
	}

	public Message(){
		this.type = Type.XML;
	}

	public Message(String payload){
		this.type = Type.XML;
		this.payload = payload;
	};

	public String getPayload(){
		return payload;
	}

	public void setPayload(String payload){
		this.payload = payload;
	}

	public Type getType(){
		return type;
	}
}

and in my drl :

rule "Contexte1"
	when
		>msg : Message(type == "XML", payload : payload)
		xpathEquals "/Root/aaaa" "bbbb"
		xpathEquals "/Root/cccc" "dddd
	then
		Log : "Contexte 1 ************* : OK";
end

but I've this error :

Unable to resolve ObjectType 'Message' : [Rule name=Contexte1,
agendaGroup=MAIN, salience=0, no-loop=false]
Rule Compilation error : [Rule name=Contexte1, agendaGroup=MAIN,
salience=0, no-loop=false]

Do you have an idea?

Thanks :-)

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Michal Bali | 1 Dec 11:25 2008
Picon

Re: expand rules with dsl

Hi,

You can do both ways:
1) 
in DSL:
There is a Message that=msg : Message(payload : payload)
in DSLR:
There is a Message that
xpathEquals "/Root/aaaa" "bbb"
xpathEquals "/Root/cccc" "dddd"

2) 
in DSL:
xpathEquals "{path}" "{value}"=msg : Message(payload : payload) and eval (DOMUtil.xpathEquals(payload, "{path}", "{value}"))
andXpathEquals "{path}" "{value}"=eval (DOMUtil.xpathEquals(payload, "{path}", "{value}"))
in DSLR:
xpathEquals "/Root/aaaa" "bbb"
andXpathEquals "/Root/cccc" "dddd"

On Mon, Dec 1, 2008 at 8:56 AM, Thierry B <jboss-rules <at> tbzone.org> wrote:
Hello,

I've a question about drl and dsl with drools 4.0.

I've this rule :

rule "Contexte1"
       when
          msg : Message(payload : payload)
          eval (DOMUtil.xpathEquals(payload, "/Root/aaaa", "bbb"))
          eval (DOMUtil.xpathEquals(payload, "/Root/cccc", "dddd"))
       then
          System.out.println ("Contexte 1 ************* : OK");
end

I use a dsl, to make it work, so now my drl is like that :

rule "Contexte1"
       when
               >msg : Message(payload : payload)
               xpathEquals "/Root/aaaa" "bbb"
               xpathEquals "/Root/cccc" "dddd"
       then
               Log : "Contexte 1 ************* : OK";
end

I was forced to make an ">" at the line "msg : Message(payload : payload)"
otherwise, he tells me that he can't expand that line.

There is a way to :
- avoid to put the ">" even if I have to add something else to the dsl ?
- avoid the line "msg : Message(payload : payload)" in my drl and simplify
my dsl so that xPathEquals "know" that the "payload" variable come from
any object Message in Working Memory ?

Thanks :-)

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Shyam, Pallav | 1 Dec 11:26 2008

RE: drools 4.0 and enum in java 1.5

Maybe you will have to import Message.Type.XML in the drl file and then use it.

-----Original Message-----
From: rules-users-bounces <at> lists.jboss.org [mailto:rules-users-bounces <at> lists.jboss.org] On
Behalf Of Thierry B
Sent: Monday, December 01, 2008 3:32 PM
To: rules-users <at> lists.jboss.org
Subject: [rules-users] drools 4.0 and enum in java 1.5

Hello,

I'd like to use enum in java 1.5 with drools.

I try that :

A message class :
package com.pv.rules.beans;

public class Message {

        String payload;
        Type type;

        public enum Type {
           XML;
        }

        public Message(){
                this.type = Type.XML;
        }

        public Message(String payload){
                this.type = Type.XML;
                this.payload = payload;
        };

        public String getPayload(){
                return payload;
        }

        public void setPayload(String payload){
                this.payload = payload;
        }

        public Type getType(){
                return type;
        }
}

and in my drl :

rule "Contexte1"
        when
                >msg : Message(type == "XML", payload : payload)
                xpathEquals "/Root/aaaa" "bbbb"
                xpathEquals "/Root/cccc" "dddd
        then
                Log : "Contexte 1 ************* : OK";
end

but I've this error :

Unable to resolve ObjectType 'Message' : [Rule name=Contexte1,
agendaGroup=MAIN, salience=0, no-loop=false]
Rule Compilation error : [Rule name=Contexte1, agendaGroup=MAIN,
salience=0, no-loop=false]

Do you have an idea?

Thanks :-)

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive
confidentiality or privilege. Use of this email is prohibited when received in error.

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Michal Bali | 1 Dec 11:30 2008
Picon

Re: StatefulSessionSnapshotter and full serialization mode

Hi,

I didn't get any answers. Resending ..

I have a web application that has a long running drools flow. I am trying to persist this drools flow using the SingleSessionCommandService from project drools-process-enterprise.

Is it possible to use full serialization mode (SerializablePlaceholderResolverStrategy) with StatefulSessionSnapshotter? It seems that StatefulSessionSnapshotter uses the default, which is identity (IdentityPlaceholderResolverStrategy). Is is possible to change this?

Thanking you in advance.

Best Regards,
Michal


On Wed, Nov 26, 2008 at 8:40 PM, Michal Bali <michalbali <at> gmail.com> wrote:
Hi,

Is it possible to use full serialization mode (SerializablePlaceholderResolverStrategy) with StatefulSessionSnapshotter? It seems that StatefulSessionSnapshotter uses the default which is identity (IdentityPlaceholderResolverStrategy). Is is possible to change this?

I have a web application that has a long running drools flow. I am trying to persist this droolsflow using the SingleSessionCommandService from project drools-process-enterprise.

Thanking you in advance.

Best Regards,
Michal



_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Thierry B | 1 Dec 12:25 2008

Re: expand rules with dsl

> Hi,
>
> You can do both ways:
> 1)
> in DSL:
> There is a Message that=msg : Message(payload : payload)
> in DSLR:
> There is a Message that
> xpathEquals "/Root/aaaa" "bbb"
> xpathEquals "/Root/cccc" "dddd"
>
> 2)
> in DSL:
> xpathEquals "{path}" "{value}"=msg : Message(payload : payload) and eval
> (DOMUtil.xpathEquals(payload, "{path}", "{value}"))
> andXpathEquals "{path}" "{value}"=eval (DOMUtil.xpathEquals(payload,
> "{path}", "{value}"))
> in DSLR:
> xpathEquals "/Root/aaaa" "bbb"
> andXpathEquals "/Root/cccc" "dddd"

Ok, Thanks :-)

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Thierry B | 1 Dec 16:02 2008

RE: drools 4.0 and enum in java 1.5

> Maybe you will have to import Message.Type.XML in the drl file and then
> use it.
>

Hello,

I've these imports :

import com.pv.rules.beans.Message;
import com.pv.rules.beans.Message.Type.XML;

but it tell me :

Unable to create restriction '[QualifiedIndentifierRestr: ==
com.pv.rules.beans.Message.Type.XML ]' for field 'type' in the rule
'Contexte1' : [Rule name=Contexte1, agendaGroup=MAIN, salience=0,
no-loop=false]
Rule Compilation error : [Rule name=Contexte1, agendaGroup=MAIN,
salience=0, no-loop=false]
	com/pv/rules/Rule_Contexte1_0.java (2:63) : The import
com.pv.rules.beans.Message.Type.XML cannot be resolved
com.pv.rules.beans.Message.Type.XML

Maybe, it's not possible to use enum in drl :-(

Thanks :-)

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Gmane