RE: [rules-users] RE: Duplicate check using dialect(firing multiple times)

2007-11-14 Thread Sikkandar Nawabjan
Edson,

With this code it is firing. But it is firing 2 times(u also got same 2 time 
output). why is that? how we can avoid?

Thanks and Regss,

Basha

 

 

 

   Sorry, my mistake. "this" is a reserved word in java (duh!!), and so you 
need to use your own binding:

m : Message( $message1 : message )
mdup : Message($message2:message==$message1,eval(mdup != m) ) 

   You can't use mvel dialect, because in MVEL the operators "==" and "!=" will 
call the equals() method anyway.
   Other than that, it is working just fine for me:

rule "Find duplicates" 
salience 10
when
$f1 : Message( $m1 : message )
$f2 : Message( $m2 : message == $m1, eval( $f1 != $f2 ) )
then
System.out.println( "FIRED DUPLICATE:" ); 
System.out.println( "  $f1 = "+$f1+" [ message="+$m1+" ]"  );
System.out.println( "  $f2 = "+$f2+" [ message="+$m2+" ]"  );
end 

rule "Find differents"
when
$f1 : Message( $m1 : message )
$f2 : Message( $m2 : message != $m1 )
then
System.out.println( "FIRED DIFFERENT:" );
System.out.println( "  $f1 = "+$f1+" [ message="+$m1+" ]" );
System.out.println( "  $f2 = "+$f2+" [ message="+$m2+" ]"  );
end

The code to insert facts is:

Message message1 = new Message();
message1.setMessage(  "Hello World" );
workingMemory.insert( message1 );
Message message2 = new Message(); 
message2.setMessage(  "Hello World" );
workingMemory.insert( message2 );
Message message3 = new Message();
message3.setMessage(  "Hello Bob" ); 
workingMemory.insert( message3 );
workingMemory.fireAllRules();   

And the result is:

FIRED DUPLICATE:
  $f1 = [EMAIL PROTECTED] [ message=Hello World ] 
  $f2 = [EMAIL PROTECTED] [ message=Hello World ]
FIRED DUPLICATE:
  $f1 = [EMAIL PROTECTED] [ message=Hello World ]
  $f2 = [EMAIL PROTECTED] [ message=Hello World ]
FIRED DIFFERENT:
  $f1 = [EMAIL PROTECTED] [ message=Hello Bob ]
  $f2 = [EMAIL PROTECTED] [ message=Hello World ]
FIRED DIFFERENT:
  $f1 = [EMAIL PROTECTED] [ message=Hello World ]
  $f2 = [EMAIL PROTECTED] [ message=Hello Bob ]
FIRED DIFFERENT:
  $f1 = [EMAIL PROTECTED] [ message=Hello Bob ] 
  $f2 = [EMAIL PROTECTED] [ message=Hello World ]
FIRED DIFFERENT:
  $f1 = [EMAIL PROTECTED] [ message=Hello World ]
  $f2 = [EMAIL PROTECTED] [ message=Hello Bob ]

[]s
Edson



2007/11/14, Sikkandar Nawabjan <[EMAIL PROTECTED]>: 

i just use this sort of rule

rule "Hello World"

dialect "mvel" 

when

m : Message( $message1 : message )

mdup : Message($message2:message==$message1,eval(this!=m) )

then

System.out.println("Rule Fired"+m +"::"+mdup );

System.out.println ("Rule Fired"+$message1 +"::"+$message2 );

end



if i put rule parameter dialect "MVEL"  the error "this should be used 
in static context" is gone. But now the rule is firing whatever may be the data 

i assert 2 objects with message Hello and Hello1.

still the rule is firing(2 times).

Thanks and regs,

basha




Message: 1
Date: Wed, 14 Nov 2007 09:48:02 -0200
From: "Edson Tirelli" < [EMAIL PROTECTED]>
Subject: Re: [rules-users] RE: how to find duplicate inlineeval
To: "Rules Users List" 
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1" 

   Sorry, you lost me. What is the error message?
   Can you send us a self contained test showing the problem you are 
having?

   []s
   Edson

2007/11/14, Sikkandar Nawabjan < [EMAIL PROTECTED]  >:
>
> Edson,
>
> As you said i used inline eval. But am getting erroe message like this
> can't be used in static context.am  using 
statelesssession to assert my
> objects.
>
> i also put eval(this!=obj1) as follows.
>
>   $obj1:Object1($id:id,$name:name)
>   $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1 
> ))  eval($obj2!=  $obj1)
>
> Though my references are different the rule is not firing
>
>
> Thanks and Regs
>
> Basha
>
> From: [EMAIL PROTECTED] on behalf of Edson Tirelli
> Sent: Tue 11/13/2007 9:35 PM
> To: Rules Users List
> Subject: Re: [rules-users] RE: how to find duplicate
>
>
>
>
>Sikkandar,
>
>The only way to check for iden

[rules-users] Re: howto BRMS - already stuck at fact model

2007-11-14 Thread Chong Minsk Goh
Hi Darren,

Glad I am not alone : )

I am also in the process of using BRMS for our application. Would also
like to seek advice on how to better use the BRMS.

Especially on how the parsing of user inputs to DRL is executed,
specifically which package/api in drools is used.




Cheers!
Chong Minsk




>
> Message: 1
> Date: Wed, 14 Nov 2007 10:06:05 -0500
> From: "Darren Hartford" <[EMAIL PROTECTED]>
> Subject: [rules-users] howto BRMS - already stuck at fact model
>loading
> To: 
> Message-ID:
><[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
>
> Hey all, new to BRMS as trying to learn how this works.  My usecase is
> to take an existing, working EJB3 application and migrate some of the
> complex rules over to be managed by BRMS.
>
>
>
> However, initial attempts over the course of a couple of days have
> yielded zero results.
>
>
>
> When trying to follow
> http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.
> html#d0e5301, they want you to load a fact model.  I take an existing
> EJB3 entity bean and it loads fine.  There doesn't seem anything more
> for me to do, or to verify this is o.k. or not.  So, then I move to the
> rule editors, and nothing works - not able to use the guided editor at
> all, and using the DSL text editor with the 'model/entity' from the jar
> isn't recognized.
>
>
>
> Now, I admit ignorance, and I would like some direction as to how to
> best learn to use BRMS.
>
>
>
> There were a couple mentions of a drools-examples-brms, but it just can
> not be found.  Following the documentation mentioned above is only
> guidelines without any good examples leaving one easily lost.
>
>
>
> http://www.google.com/search?q=drools-example-brms
>
> http://www.nabble.com/forum/Search.jtp?query=jbrms+example&local=y&forum
> =11822&daterange=0&startdate=&enddate=
>
> http://labs.jboss.com/drools/downloads.html
>
> http://labs.jboss.com/drools/livetrails/index.html
>
>
>
> So - where can one go to learn how to use BRMS to help convert an
> existing EJB3 application to use Drools and BRMS?
>
>
>
> Thanky,
>
> -D
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] mvel regex not working???

2007-11-14 Thread Carlsen, Len
Hi,

 

I have an email validation regex where the mvel matches doesn't seem to
work. I have created 2 rules where test1 uses the Java String matches
and test2 uses the mvel matches. Test1 works but test2 doesn't. I am
using Drools 4.0.3 and JDK 1.6.0_02.

 

rule "Test1"

when

// This works

email : String()

eval( !email.matches(
"^[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+(
\\.[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+
)[EMAIL PROTECTED]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9
-]{0,61}[a-zA-Z0-9])?)*\\.[a-zA-Z]{2,6}$" ) )

then

System.out.println( "1-Invalid Email Address: " + email );

end

 

rule "Test2"

when

// This doesn't work

email : String( toString not matches
"^[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+(
\\.[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+
)[EMAIL PROTECTED]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9
-]{0,61}[a-zA-Z0-9])?)*\\.[a-zA-Z]{2,6}$" )

then

System.out.println( "2-Invalid Email Address: " + email );

end

 

Here's the output using email addresses [EMAIL PROTECTED] (valid) and x.xx.com
(invalid):

 

test1-Invalid Email Address: x.xx.com

test2-Invalid Email Address: [EMAIL PROTECTED]

test2-Invalid Email Address: x.xx.com

 

The regex expressions are exactly the same. Am I doing something wrong
here?

 

Thanks,

 

Len

 

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


Re: [rules-users] create XML rules with XML parser

2007-11-14 Thread Fernando Meyer
Hi,

If you mean the appropriate rule then use the following xsd

http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-4.0.xsd

Regards



On 11/14/07, Raffaele Viola <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I want to create automatically the xml containing the rules using a parser
> like castor, which .xsd I have to use to generate the appropriate java
> class?
> Can someone give me some indications?
>
> Thanks
> Raffo
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
Fernando Meyer http://fmeyer.org
JBoss Rules Core Developer
[EMAIL PROTECTED]
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] create XML rules with XML parser

2007-11-14 Thread Raffaele Viola
Hi all,

I want to create automatically the xml containing the rules using a parser
like castor, which .xsd I have to use to generate the appropriate java
class?
Can someone give me some indications?

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


[rules-users] Another rule vendor being acquired

2007-11-14 Thread Paul Haley
I hope it is interesting to the community to consider the second business
rules vendor acquisition within the last 30 days.

 

Haley Systems (www.haley.com), the company that I founded many years ago
(hopefully, some of you have heard of it!), is in the process of being
acquired by Ruleburst.  I am not going with the acquisition but have started
up my own "vendor neutral" business practice in which I anticipate helping
improve and support Drools and the emerging standards in rules and web
semantics. 

 

See
http://www.ad-hoc-news.de/CorporateNews/en/14178920/RuleBurst-Acquires-US-Bu
siness-Rules-Technology-Vendor 

 

Regards,

Paul

 

 



 

<>

Paul V  Haley.vcf
Description: Binary data
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] XML Import Sample

2007-11-14 Thread Fernando Meyer
Hi,

All that you need is understand the drools' xml unit tests.

Regards .

On 11/14/07, MHersey <[EMAIL PROTECTED]> wrote:
>
>
> I'm new to Drools and am looking into using the XmlPackageReader to import
> XML rules.
>
> Can someone point me to some sample code?  I've found a few snippets from
> different projects but the information is disconnected.
>
> Thanks for any pointers to a noob.
>
> Michael
> --
> View this message in context:
> http://www.nabble.com/XML-Import-Sample-tf4806317.html#a13750536
> 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
>



-- 
Fernando Meyer http://fmeyer.org
JBoss Rules Core Developer
[EMAIL PROTECTED]
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] XML Import Sample

2007-11-14 Thread Fernando Meyer
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/

sorry forgot the link ;)

On 11/14/07, Fernando Meyer <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> All that you need is understand the drools' xml unit tests.
>
> Regards .
>
> On 11/14/07, MHersey < [EMAIL PROTECTED]> wrote:
> >
> >
> > I'm new to Drools and am looking into using the XmlPackageReader to
> > import
> > XML rules.
> >
> > Can someone point me to some sample code?  I've found a few snippets
> > from
> > different projects but the information is disconnected.
> >
> > Thanks for any pointers to a noob.
> >
> > Michael
> > --
> > View this message in context:
> > http://www.nabble.com/XML-Import-Sample-tf4806317.html#a13750536
> > 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
> >
>
>
>
> --
> Fernando Meyer http://fmeyer.org
> JBoss Rules Core Developer
> [EMAIL PROTECTED]




-- 
Fernando Meyer http://fmeyer.org
JBoss Rules Core Developer
[EMAIL PROTECTED]
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] XML Import Sample

2007-11-14 Thread MHersey

I'm new to Drools and am looking into using the XmlPackageReader to import
XML rules.

Can someone point me to some sample code?  I've found a few snippets from
different projects but the information is disconnected.

Thanks for any pointers to a noob.

Michael
-- 
View this message in context: 
http://www.nabble.com/XML-Import-Sample-tf4806317.html#a13750536
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] create .pkg file with or without BRMS

2007-11-14 Thread LNguyen

I think the DroolsCompilerAntTask generates a serialized RuleBase, not a
Package.

Linh


Arnaud Bouzinac wrote:
> 
> Hi,
> 
> I'm using BRMS to generate a .pkg for an application
> 
> i need to generate the same file without BRMS:
> i'm trying to use a drools-ant task, but, pkg file generated with
> drools-ant
> task is not the same !!!
> i don't found a specific documentation to do that ?
> 
> Somebody can help me please ?
> 
> thanks for your help
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  />
> 
> 
>  srcdir="${eclipsepath}../rules/"
> tofile="${eclipsepath}../rules/FLIResultsUpdateRules.pkg"
> classpathref="qirules.classpath" >
> 
> 
> 
> 
> 
> 
> ___
> 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/create-.pkg-file-with-or-without-BRMS-tf4803289.html#a13749958
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] Is InternalRuleBase safe to use?

2007-11-14 Thread Jared Davis
Hi,

re:Drools 4.0.3

 I want/need to use ConsequenceExceptionHandler for exception handling.
 I'd like to be able to get the ConsequenceExceptionHandler from a 
StatefulSession. 

The only way I see to get the handler relies on InternalRuleBase. 
The JavaDoc at http://downloads.jboss.com/drools/docs/_
4.0.3.15993.GA/apidocs/org/drools/common/InternalRuleBase.html
does not have any annotation that it is internal use only. However the naming
convention sure makes me this this is a bad idea. 

Any alternatives to the following code to retrieve the 
ConsequenceExceptionHandler?


InternalRuleBase thisSmellsLikeABadIdea= (InternalRuleBase) wm.getRuleBase();
DroolsExceptionHandler deh = (DroolsExceptionHandler)
thisSmellsLikeABadIdea.getConfiguration().getConsequenceExceptionHandler();
List exceptions = deh.getExceptions();

(Where DroolsExceptionHandler is 

package droolsconfig;

import java.util.ArrayList;
import java.util.List;
import org.drools.WorkingMemory;
import org.drools.spi.Activation;
import org.drools.spi.ConsequenceExceptionHandler;


public class DroolsExceptionHandler implements ConsequenceExceptionHandler {
List exceptions = new ArrayList();
   
public DroolsExceptionHandler() {
}

public void handleException(Activation activation, WorkingMemory
workingMemory, Exception exception) {
exceptions.add(exception);
}
public List getExceptions() {
return exceptions;
}

}

)


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


[rules-users] howto BRMS - already stuck at fact model loading

2007-11-14 Thread Darren Hartford
Hey all, new to BRMS as trying to learn how this works.  My usecase is
to take an existing, working EJB3 application and migrate some of the
complex rules over to be managed by BRMS.

 

However, initial attempts over the course of a couple of days have
yielded zero results.

 

When trying to follow
http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.
html#d0e5301, they want you to load a fact model.  I take an existing
EJB3 entity bean and it loads fine.  There doesn't seem anything more
for me to do, or to verify this is o.k. or not.  So, then I move to the
rule editors, and nothing works - not able to use the guided editor at
all, and using the DSL text editor with the 'model/entity' from the jar
isn't recognized.

 

Now, I admit ignorance, and I would like some direction as to how to
best learn to use BRMS.

 

There were a couple mentions of a drools-examples-brms, but it just can
not be found.  Following the documentation mentioned above is only
guidelines without any good examples leaving one easily lost.

 

http://www.google.com/search?q=drools-example-brms

http://www.nabble.com/forum/Search.jtp?query=jbrms+example&local=y&forum
=11822&daterange=0&startdate=&enddate=

http://labs.jboss.com/drools/downloads.html

http://labs.jboss.com/drools/livetrails/index.html

 

So - where can one go to learn how to use BRMS to help convert an
existing EJB3 application to use Drools and BRMS?

 

Thanky,

-D

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


Re: [rules-users] RE: Duplicate check using dialect

2007-11-14 Thread Edson Tirelli
   Sorry, my mistake. "this" is a reserved word in java (duh!!), and so you
need to use your own binding:

m : Message( $message1 : message )
mdup : Message($message2:message==$message1,eval(mdup != m) )

   You can't use mvel dialect, because in MVEL the operators "==" and "!="
will call the equals() method anyway.
   Other than that, it is working just fine for me:

rule "Find duplicates"
salience 10
when
$f1 : Message( $m1 : message )
$f2 : Message( $m2 : message == $m1, eval( $f1 != $f2 ) )
then
System.out.println( "FIRED DUPLICATE:" );
System.out.println( "  $f1 = "+$f1+" [ message="+$m1+" ]"  );
System.out.println( "  $f2 = "+$f2+" [ message="+$m2+" ]"  );
end

rule "Find differents"
when
$f1 : Message( $m1 : message )
$f2 : Message( $m2 : message != $m1 )
then
System.out.println( "FIRED DIFFERENT:" );
System.out.println( "  $f1 = "+$f1+" [ message="+$m1+" ]" );
System.out.println( "  $f2 = "+$f2+" [ message="+$m2+" ]"  );
end

The code to insert facts is:

Message message1 = new Message();
message1.setMessage(  "Hello World" );
workingMemory.insert( message1 );
Message message2 = new Message();
message2.setMessage(  "Hello World" );
workingMemory.insert( message2 );
Message message3 = new Message();
message3.setMessage(  "Hello Bob" );
workingMemory.insert( message3 );
workingMemory.fireAllRules();

And the result is:

FIRED DUPLICATE:
  $f1 = [EMAIL PROTECTED] [ message=Hello World ]
  $f2 = [EMAIL PROTECTED] [ message=Hello World ]
FIRED DUPLICATE:
  $f1 = [EMAIL PROTECTED] [ message=Hello World ]
  $f2 = [EMAIL PROTECTED] [ message=Hello World ]
FIRED DIFFERENT:
  $f1 = [EMAIL PROTECTED] [ message=Hello Bob ]
  $f2 = [EMAIL PROTECTED] [ message=Hello World ]
FIRED DIFFERENT:
  $f1 = [EMAIL PROTECTED] [ message=Hello World ]
  $f2 = [EMAIL PROTECTED] [ message=Hello Bob ]
FIRED DIFFERENT:
  $f1 = [EMAIL PROTECTED] [ message=Hello Bob ]
  $f2 = [EMAIL PROTECTED] [ message=Hello World ]
FIRED DIFFERENT:
  $f1 = [EMAIL PROTECTED] [ message=Hello World ]
  $f2 = [EMAIL PROTECTED] [ message=Hello Bob ]

[]s
Edson

2007/11/14, Sikkandar Nawabjan <[EMAIL PROTECTED]>:
>
> i just use this sort of rule
>
> rule "Hello World"
>
> dialect "mvel"
>
> when
>
> m : Message( $message1 : message )
>
> mdup : Message($message2:message==$message1,eval(this!=m) )
>
> then
>
> System.out.println("Rule Fired"+m +"::"+mdup );
>
> System.out.println("Rule Fired"+$message1 +"::"+$message2 );
>
> end
>
>
>
> if i put rule parameter dialect "MVEL"  the error "this should be used in
> static context" is gone. But now the rule is firing whatever may be the data
>
> i assert 2 objects with message Hello and Hello1.
>
> still the rule is firing(2 times).
>
> Thanks and regs,
>
> basha
>
>
>
>
> Message: 1
> Date: Wed, 14 Nov 2007 09:48:02 -0200
> From: "Edson Tirelli" <[EMAIL PROTECTED]>
> Subject: Re: [rules-users] RE: how to find duplicate inlineeval
> To: "Rules Users List" 
> Message-ID:
> <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
>Sorry, you lost me. What is the error message?
>Can you send us a self contained test showing the problem you are
> having?
>
>[]s
>Edson
>
> 2007/11/14, Sikkandar Nawabjan <[EMAIL PROTECTED]>:
> >
> > Edson,
> >
> > As you said i used inline eval. But am getting erroe message like this
> > can't be used in static context.am using statelesssession to assert my
> > objects.
> >
> > i also put eval(this!=obj1) as follows.
> >
> >   $obj1:Object1($id:id,$name:name)
> >   $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1
> > ))  eval($obj2!=  $obj1)
> >
> > Though my references are different the rule is not firing
> >
> >
> > Thanks and Regs
> >
> > Basha
> >
> > From: [EMAIL PROTECTED] on behalf of Edson Tirelli
> > Sent: Tue 11/13/2007 9:35 PM
> > To: Rules Users List
> > Subject: Re: [rules-users] RE: how to find duplicate
> >
> >
> >
> >
> >Sikkandar,
> >
> >The only way to check for identity is to use an inline eval and use
> > java code to check that:
> >
> > when
> > $obj1:Object1($id:id,$name:name)
> > $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1 ))
> > then
> >
> >Another option is to configure your rulebase to not allow the same
> > object to be matched by more than one pattern in your rules. To do that
> you
> > can either set a system property:
> >
> > drools.removeIdentities = true
> >
> > Or you can use drools API:
> >
> > RuleBaseConfiguration conf = new RuleBaseConfiguration();
> > conf.setRemoveIdentities( true );
> > RuleBase rulebase = RuleBaseFactory.newRuleBase( conf );
> >
> > If you do that, your rule can be written as this:
> >
> > when
> > $obj1:Object

[rules-users] RE: Duplicate check using dialect

2007-11-14 Thread Sikkandar Nawabjan
i just use this sort of rule

rule "Hello World"

dialect "mvel" 

when

m : Message( $message1 : message )

mdup : Message($message2:message==$message1,eval(this!=m) )

then

System.out.println("Rule Fired"+m +"::"+mdup );

System.out.println("Rule Fired"+$message1 +"::"+$message2 );

end

 

if i put rule parameter dialect "MVEL"  the error "this should be used in 
static context" is gone. But now the rule is firing whatever may be the data

i assert 2 objects with message Hello and Hello1. 

still the rule is firing(2 times).

Thanks and regs,

basha

 


Message: 1
Date: Wed, 14 Nov 2007 09:48:02 -0200
From: "Edson Tirelli" <[EMAIL PROTECTED]>
Subject: Re: [rules-users] RE: how to find duplicate inlineeval
To: "Rules Users List" 
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

   Sorry, you lost me. What is the error message?
   Can you send us a self contained test showing the problem you are having?

   []s
   Edson

2007/11/14, Sikkandar Nawabjan <[EMAIL PROTECTED]>:
>
> Edson,
>
> As you said i used inline eval. But am getting erroe message like this
> can't be used in static context.am using statelesssession to assert my
> objects.
>
> i also put eval(this!=obj1) as follows.
>
>   $obj1:Object1($id:id,$name:name)
>   $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1
> ))  eval($obj2!=  $obj1)
>
> Though my references are different the rule is not firing
>
>
> Thanks and Regs
>
> Basha
>
> From: [EMAIL PROTECTED] on behalf of Edson Tirelli
> Sent: Tue 11/13/2007 9:35 PM
> To: Rules Users List
> Subject: Re: [rules-users] RE: how to find duplicate
>
>
>
>
>Sikkandar,
>
>The only way to check for identity is to use an inline eval and use
> java code to check that:
>
> when
> $obj1:Object1($id:id,$name:name)
> $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1 ))
> then
>
>Another option is to configure your rulebase to not allow the same
> object to be matched by more than one pattern in your rules. To do that you
> can either set a system property:
>
> drools.removeIdentities = true
>
> Or you can use drools API:
>
> RuleBaseConfiguration conf = new RuleBaseConfiguration();
> conf.setRemoveIdentities( true );
> RuleBase rulebase = RuleBaseFactory.newRuleBase( conf );
>
> If you do that, your rule can be written as this:
>
> when
> $obj1:Object1($id:id,$name:name)
> $obj2:Object1(id==$id,$name:name==$name)
> then
>
>Since the engine will never allow the same fact to simultaneously match
> both patterns.
>
>[]s
>Edson


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


Re: [rules-users] RE: how to find duplicate inlineeval

2007-11-14 Thread Edson Tirelli
   Sorry, you lost me. What is the error message?
   Can you send us a self contained test showing the problem you are having?

   []s
   Edson

2007/11/14, Sikkandar Nawabjan <[EMAIL PROTECTED]>:
>
> Edson,
>
> As you said i used inline eval. But am getting erroe message like this
> can't be used in static context.am using statelesssession to assert my
> objects.
>
> i also put eval(this!=obj1) as follows.
>
>   $obj1:Object1($id:id,$name:name)
>   $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1
> ))  eval($obj2!=  $obj1)
>
> Though my references are different the rule is not firing
>
>
> Thanks and Regs
>
> Basha
>
> From: [EMAIL PROTECTED] on behalf of Edson Tirelli
> Sent: Tue 11/13/2007 9:35 PM
> To: Rules Users List
> Subject: Re: [rules-users] RE: how to find duplicate
>
>
>
>
>Sikkandar,
>
>The only way to check for identity is to use an inline eval and use
> java code to check that:
>
> when
> $obj1:Object1($id:id,$name:name)
> $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1 ))
> then
>
>Another option is to configure your rulebase to not allow the same
> object to be matched by more than one pattern in your rules. To do that you
> can either set a system property:
>
> drools.removeIdentities = true
>
> Or you can use drools API:
>
> RuleBaseConfiguration conf = new RuleBaseConfiguration();
> conf.setRemoveIdentities( true );
> RuleBase rulebase = RuleBaseFactory.newRuleBase( conf );
>
> If you do that, your rule can be written as this:
>
> when
> $obj1:Object1($id:id,$name:name)
> $obj2:Object1(id==$id,$name:name==$name)
> then
>
>Since the engine will never allow the same fact to simultaneously match
> both patterns.
>
>[]s
>Edson
>
>
>
>
>
> 2007/11/13, Sikkandar Nawabjan <[EMAIL PROTECTED]>:
>
> Hi,
> am passing list of objects to working memory. i want to fire the
> rule if there is any duplicate objects in the list
>
> i write code like this
>
> when
> $obj1:Object1($id:id,$name:name)
> $obj2:Object1(id==$id,$name:name==$name,this!=$obj1)
> then
>   fire rule
>
> Now the problem lies at this!=objj1(a highlighted check). i put
> this to avoid a object check with itself.
> But this is internally calling equals method of the corresponding
> object and always return true. Because i overriden equals method in the
> Object itself
> so at the end the rule won't fire even if there is a duplicate
> object. how i can solve this
>
> equals(Object obj){
> if(this.id=obj.id&& this.name==obj.name)
>   return true;
> else
>   return false;
> }
>
>
>
>
> 
>
> From: [EMAIL PROTECTED] on behalf of
> [EMAIL PROTECTED]
> Sent: Tue 11/13/2007 2:04 AM
> To: rules-users@lists.jboss.org
> Subject: rules-users Digest, Vol 12, Issue 27
>
>
>
> Send rules-users mailing list submissions to
> rules-users@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
>  [EMAIL PROTECTED]  [EMAIL PROTECTED]>
>
> You can reach the person managing the list at
> [EMAIL PROTECTED]
>
> When replying, please edit your Subject line so it is more
> specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
>1. Re: Drools and jBPM integration (Fabian Weisensee)
>2. Re: java.lang.OutOfMemoryError: Java heap space (Edson
> Tirelli)
>3. Re: Drools and jBPM integration (Mark Proctor)
>4. Re: Drools and jBPM integration (Mark Proctor)
>
>
>
> --
>
> Message: 1
> Date: Mon, 12 Nov 2007 18:23:06 +0100
> From: Fabian Weisensee <[EMAIL PROTECTED]>
> Subject: Re: [rules-users] Drools and jBPM integration
> To: Rules Users List < rules-users@lists.jboss.org  rules-users@lists.jboss.org> >
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Yes, thanks for your help. I'll try your suggestion for #2.
>
> I resolved the deployment problem by myself. It was just a mistake
> with
> the JBoss ESB deploying...
>
> But now I have another problem. The rule file is found, but there
> seem
> to be some problems with the parser.
>
> The FireRulesActionHandler class from the jbpm wiki uses the
> following code:
> RuleBaseImpl ruleBase = new RuleBaseImpl();
> ruleBase.addPackage(pkg);
>
> But the RuleBaseImpl class doesn't seem to be part of drools
> anymore. I
> looked at the jav

RE: [rules-users] RE: how to find duplicate inlineeval

2007-11-14 Thread Sikkandar Nawabjan
Edson,

As you said i used inline eval. But am getting erroe message like this can't be 
used in static context.am using statelesssession to assert my objects.

i also put eval(this!=obj1) as follows. 

  $obj1:Object1($id:id,$name:name)
  $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1 ))  eval($obj2!=  
$obj1)

Though my references are different the rule is not firing


Thanks and Regs

Basha

From: [EMAIL PROTECTED] on behalf of Edson Tirelli
Sent: Tue 11/13/2007 9:35 PM
To: Rules Users List
Subject: Re: [rules-users] RE: how to find duplicate




   Sikkandar,

   The only way to check for identity is to use an inline eval and use java 
code to check that:

when
$obj1:Object1($id:id,$name:name)
$obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1 )) 
then

   Another option is to configure your rulebase to not allow the same object to 
be matched by more than one pattern in your rules. To do that you can either 
set a system property:

drools.removeIdentities = true

Or you can use drools API:

RuleBaseConfiguration conf = new RuleBaseConfiguration();
conf.setRemoveIdentities( true );
RuleBase rulebase = RuleBaseFactory.newRuleBase( conf );

If you do that, your rule can be written as this: 

when
$obj1:Object1($id:id,$name:name)
$obj2:Object1(id==$id,$name:name==$name)
then

   Since the engine will never allow the same fact to simultaneously match both 
patterns.

   []s
   Edson





2007/11/13, Sikkandar Nawabjan <[EMAIL PROTECTED]>: 

Hi,
am passing list of objects to working memory. i want to fire the rule 
if there is any duplicate objects in the list

i write code like this

when
$obj1:Object1($id:id,$name:name)
$obj2:Object1(id==$id,$name:name==$name,this!=$obj1) 
then
  fire rule

Now the problem lies at this!=objj1(a highlighted check). i put this to 
avoid a object check with itself.
But this is internally calling equals method of the corresponding 
object and always return true. Because i overriden equals method in the Object 
itself 
so at the end the rule won't fire even if there is a duplicate object. 
how i can solve this

equals(Object obj){
if(this.id=obj.id&& this.name==obj.name)
  return true;
else
  return false; 
}






From: [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED]
Sent: Tue 11/13/2007 2:04 AM
To: rules-users@lists.jboss.org 
Subject: rules-users Digest, Vol 12, Issue 27



Send rules-users mailing list submissions to
rules-users@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
 [EMAIL PROTECTED]  

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific 
than "Re: Contents of rules-users digest..."


Today's Topics:

   1. Re: Drools and jBPM integration (Fabian Weisensee)
   2. Re: java.lang.OutOfMemoryError: Java heap space (Edson Tirelli) 
   3. Re: Drools and jBPM integration (Mark Proctor)
   4. Re: Drools and jBPM integration (Mark Proctor)


--

Message: 1
Date: Mon, 12 Nov 2007 18:23:06 +0100 
From: Fabian Weisensee <[EMAIL PROTECTED]>
Subject: Re: [rules-users] Drools and jBPM integration
To: Rules Users List < rules-users@lists.jboss.org 
 >
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Yes, thanks for your help. I'll try your suggestion for #2. 

I resolved the deployment problem by myself. It was just a mistake with
the JBoss ESB deploying...

But now I have another problem. The rule file is found, but there seem
to be some problems with the parser. 

The FireRulesActionHandler class from the jbpm wiki uses the following 
code:
RuleBaseImpl ruleBase = new RuleBaseImpl();
ruleBase.addPackage(pkg);

But the RuleBaseImpl class doesn't seem to be part of drools anymore. I 
looked at the javadocs to find a replacement. I've found the
RuleBaseLoader class which looked like what I needed. I replaced the two
lines with this:
RuleBaseLoader rbl = RuleBaseLoader.getInstance();
R

Re: [rules-users] Fire Rules in DT based on a rule in DT

2007-11-14 Thread Steven Williams
I added agenda-group to decision tables in September 2006.

cheers
Steve

On Nov 14, 2007 6:50 PM, Arjun Dhar <[EMAIL PROTECTED]> wrote:

> Hi,
>  I have the following scenario.
>
> SCENARIO (simplified for discussion from actual blown up scenario)
> -
>  1. A decision table (DT) with rules for "all types of employees" - Call
> it "Common DT"
>  2. The DT mentioned in Point 1 has a condition that fetched data
> depending
> on "Type Of Employee"
>
>  3. There are other decision tables that would like to use the the rules
> from "Common DT", but here are the challenges:
>
> Challenges
> --
> 1. Decision does not support Agenda Groups
> 2. Using a fact; to hold the evaluated result from a DT can pass it from a
> child to a parent; but it requires an "update()"; which can cause infinite
> recursion if i dont have a "Execute ONE Rule Only from Table" decision
> variable.
>
> (Parent) DT - Condition 1, condition 2, Condition 3 (Actually result of
> Child
> DT)
>
>
> (Child DT)
> ... The relation is maintained using decision variables.
>
> This relation works perfenctly good (been working for 3 months now), but
> issue
> is it creates a Sort of a Tree (with each node a DT); in shich I cannot
> fire a
> common set of rules from Any Node.
>
> As an alternative; I'm suggesting to the client to write replicated DT's
> for
> each type of employee instead of 1 generic DT.
>
> Can anyone help?
>
> I've been begging for agenda Groups in decision tables but I guess you
> guys are
> tied up. So at a design level can you suggest a work around?
>
> Thanks,
> Arjun
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] create .pkg file with or without BRMS

2007-11-14 Thread Arnaud Bouzinac
Hi,

I'm using BRMS to generate a .pkg for an application

i need to generate the same file without BRMS:
i'm trying to use a drools-ant task, but, pkg file generated with drools-ant
task is not the same !!!
i don't found a specific documentation to do that ?

Somebody can help me please ?

thanks for your help
























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


[rules-users] Fire Rules in DT based on a rule in DT

2007-11-14 Thread Arjun Dhar
Hi,
 I have the following scenario.

SCENARIO (simplified for discussion from actual blown up scenario)
-
 1. A decision table (DT) with rules for "all types of employees" - Call 
it "Common DT"
 2. The DT mentioned in Point 1 has a condition that fetched data depending 
on "Type Of Employee"

 3. There are other decision tables that would like to use the the rules 
from "Common DT", but here are the challenges:
  
Challenges
--
1. Decision does not support Agenda Groups
2. Using a fact; to hold the evaluated result from a DT can pass it from a 
child to a parent; but it requires an "update()"; which can cause infinite 
recursion if i dont have a "Execute ONE Rule Only from Table" decision variable.

(Parent) DT - Condition 1, condition 2, Condition 3 (Actually result of Child 
DT)


(Child DT)
... The relation is maintained using decision variables.

This relation works perfenctly good (been working for 3 months now), but issue 
is it creates a Sort of a Tree (with each node a DT); in shich I cannot fire a 
common set of rules from Any Node.

As an alternative; I'm suggesting to the client to write replicated DT's for 
each type of employee instead of 1 generic DT.

Can anyone help?

I've been begging for agenda Groups in decision tables but I guess you guys are 
tied up. So at a design level can you suggest a work around?

Thanks,
Arjun

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