[rules-users] To know about correct Drools rule file (drl) syntaxes

2008-05-29 Thread Hareendra Pelige

Hi All,

I am new to this Drools rule engine. After looking at its features, I am
really interested on this. I tried few samples given in jboss site and
got to know high-level understanding of the rule engine and how it can
be used in our business applications.

But, I am really confused with the rule syntaxes used in sample files,
samples published in the internet.

 

Few such syntaxes are listed bellow. Could you please let me know which
is better for enterprise applications?

 

1. 

rule Hello World

dialect mvel

when

m : Message( status == Message.HELLO, message :
message

)

then

System.out.println( message ); 

modify ( m ) { message = Goodbyte cruel world,

   status = Message.GOODBYE };

System.out.println( message );


end

 

rule Good Bye

dialect java

when

Message( status == Message.GOODBYE, message :
message )

then

System.out.println( message );

End

 

Questions:

Here, what is dialect and what are 'mvel' and 'java'?

What are the differences between 'mvel' and 'java'

 

2.

rule-set name=disposition rules

xmlns=http://drools.org/rules;

xmlns:java=http://drools.org/semantics/java;

xmlns:xs=http://www.w3.org/2001/XMLSchema-instance;

xs:schemaLocation=http://drools.org/rules rules.xsd

 
http://drools.org/semantics/java java.xsd

  

!-- season sale means 10% off item price --

rule name=season sales

parameter identifier=item

classde.linsin.example.drools.domain.Item/class

/parameter

parameter identifier=bill

classde.linsin.example.drools.domain.Bill/class

/parameter

parameter identifier=quantity

classjava.lang.Integer/class

/parameter

java:condition

item.isOnSeasonSale() == true

/java:condition

java:consequence

double price = (item.getPrice()*(100-10))/100;

bill.addItem(item, quantity.intValue()*price);

/java:consequence

/rule



!-- customer discount means 5% off total --

rule name=discount

parameter identifier=bill

classde.linsin.example.drools.domain.Bill/class

/parameter

parameter identifier=customer

classde.linsin.example.drools.domain.Customer/class

/parameter

java:condition

customer.isDiscount() == true

/java:condition

java:consequence

double total = bill.getTotal();

bill.setTotal((total*(100-5))/100);

/java:consequence

/rule

/rule-set

 

3. 

package com.test

 

import com.test.common.*;

import java.util.ArrayList;

 

// Extract TestData

rule Extract Test Data

dialect java

when

$productRequest :
ProductRequest(bookingRequest!=null) 

then

insert( $productRequest.getDivision() );

 

System.out.println( Extracted Test Data.); end

 

 

 

Could you please point me a location(s) to learn drl rule language with
its syntaxes?

 

Appreciate any of your help.

 

Thanks and regards

Hareendra Pelige

 

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Benjamin J
McMillan
Sent: Thursday, May 29, 2008 3:15 AM
To: Rules Users List
Subject: [rules-users] the BRMS and queries

 

All,

 

Either the BRMS, when uploading a DRL file, doesn't read in queries, or

it doesn't build them into the deployment package.

 

Is this by design, or a bug? For now my application (my unit tests,

actually) queries the working memory for decision objects, instead of

having rules respond to the decisions and put them into a data structure

the java app can see. I could do the latter, but I'm just wondering if

maybe I'm doing something wrong regarding queries and the BRMS.

 

Thanks!

 

Ben

 

 

 

___

rules-users mailing list

rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users



 

This message, including any attachments, contains confidential information 
intended for a specific individual and purpose, and is intended for the 
addressee only. Any unauthorized disclosure, use, dissemination, copying, or 
distribution of this message or any of its attachments or the information 
contained in this e-mail, or the taking of any action based on it, is strictly 
prohibited. If you are not the intended recipient, please notify the sender 
immediately by return e-mail and delete this message.___
rules-users mailing list
rules-users@lists.jboss.org

[rules-users] Re: Ant script for creating pkg files

2008-05-29 Thread ravi thalupula
Hi,

You can use below ant script to build .pkg files

project default=rules name=RuleProject

!-- Uncomment this for Maven Runner --
property name=eclipsepath  value=./
!-- Uncomment this for Eclipse Runner  --
!-- property name=eclipsepath  value=../../..// --
path id=cheese.classpath
pathelement location=${eclipsepath}/build/Beans.jar/
/path

 target name=beans 
tstamp/

echo message=CREATING Beans JAR.../
jar
jarfile=./build/Beans.jar

  fileset
  dir=./bin/
/jar

  /target

path
 pathelement/pathelement
/path
path id=drools.classpath
fileset dir=${eclipsepath}/build/lib/
include name=*.jar/
/fileset
pathelement location=target/
/path

taskdef name=compiler
classname=org.drools.contrib.DroolsCompilerAntTask
classpathref=drools.classpath /

target name=rules 
compiler
srcdir=${eclipsepath}/src/main/rules
tofile=${eclipsepath}/target/cheese.pkg
classpathref=cheese.classpath
binformat=package 
include name=*.drl /
!-- include name=*.brl /
include name=*.xml /
include name=*.dslr / --
/compiler
/target


/project

reference http://www.nabble.com/Ant-compiler-task--td15906277.html#a15907448


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


[rules-users] Re: To know about correct Drools rule file (drl) syntaxes

2008-05-29 Thread pramod george
Hi.
Check: drools.pdf
http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.html
http://legacy.drools.codehaus.org/Tutorials+and+Examples


-P

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


[rules-users] Using global in LHS

2008-05-29 Thread Markus Helbig
Hi,

again a question, any body had success using globals in LHS?

Following DSL

[condition][]is a Item=Item()
[condition][]-is of type Advertisment=advertisment contains catId


rule
 when
$pli: is a Item
- is of type Advertisment
 then
// do whatever you want
end

catId is a member of Item
advertisment is a Integer[] array set as global

comiling ends with:

Unable to create Field Extractor for 'advertisment' of '[ClassObjectType

It works fine if advertisment is a member of Item, but i want to have
it as global ...

Cheers

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


Re: [rules-users] To know about correct Drools rule file (drl) syntaxes

2008-05-29 Thread Mark Proctor

Hareendra Pelige wrote:


Hi All,

I am new to this Drools rule engine. After looking at its features, I 
am really interested on this. I tried few samples given in jboss site 
and got to know high-level understanding of the rule engine and how it 
can be used in our business applications.


But, I am really confused with the rule syntaxes used in sample files, 
samples published in the internet.


 

Few such syntaxes are listed bellow. Could you please let me know 
which is better for enterprise applications?


 


1.

rule Hello World

dialect mvel

when

m : Message( status == Message.HELLO, message 
: message


)

then

System.out.println( message );

modify ( m ) { message = Goodbyte cruel world,

   status = Message.GOODBYE };

System.out.println( message );   


end

 


rule Good Bye

dialect java

when

Message( status == Message.GOODBYE, message : 
message )


then

System.out.println( message );   


End

 


Questions:

Here, what is dialect and what are 'mvel' and 'java'?

What are the differences between 'mvel' and 'java'

 


2.

rule-set name=disposition rules

xmlns=http://drools.org/rules;   


xmlns:java=http://drools.org/semantics/java;

xmlns:xs=http://www.w3.org/2001/XMLSchema-instance;

xs:schemaLocation=http://drools.org/rules rules.xsd


   http://drools.org/semantics/java java.xsd


 


!-- season sale means 10% off item price --

rule name=season sales

parameter identifier=item

classde.linsin.example.drools.domain.Item/class

/parameter

parameter identifier=bill

classde.linsin.example.drools.domain.Bill/class

/parameter

parameter identifier=quantity

classjava.lang.Integer/class

/parameter

java:condition

item.isOnSeasonSale() == true

/java:condition

java:consequence

double price = (item.getPrice()*(100-10))/100;

bill.addItem(item, quantity.intValue()*price);

/java:consequence

/rule

   


!-- customer discount means 5% off total --

rule name=discount

parameter identifier=bill

classde.linsin.example.drools.domain.Bill/class

/parameter

parameter identifier=customer

classde.linsin.example.drools.domain.Customer/class

/parameter

java:condition

customer.isDiscount() == true

/java:condition

java:consequence

double total = bill.getTotal();

bill.setTotal((total*(100-5))/100);

/java:consequence

/rule

/rule-set


that is drools2.0 - there is no relation between this and 4.0.


 


3.

package com.test

 


import com.test.common.*;

import java.util.ArrayList;

 


// Extract TestData

rule Extract Test Data

dialect java

when

$productRequest : 
ProductRequest(bookingRequest!=null)


then

insert( $productRequest.getDivision() );

 


System.out.println( Extracted Test Data.); end

 

 

 

Could you please point me a location(s) to learn drl rule language 
with its syntaxes?


 


Appreciate any of your help.

 


Thanks and regards

Hareendra Pelige

 

 


-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Benjamin J 
McMillan

Sent: Thursday, May 29, 2008 3:15 AM
To: Rules Users List
Subject: [rules-users] the BRMS and queries

 


All,

 


Either the BRMS, when uploading a DRL file, doesn't read in queries, or

it doesn't build them into the deployment package.

 


Is this by design, or a bug? For now my application (my unit tests,

actually) queries the working memory for decision objects, instead of

having rules respond to the decisions and put them into a data structure

the java app can see. I could do the latter, but I'm just wondering if

maybe I'm doing something wrong regarding queries and the BRMS.

 


Thanks!

 


Ben

 

 

 


___

rules-users mailing list

rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users

 

This message, including any attachments, contains confidential 
information intended for a specific individual and purpose, and is 
intended for the addressee only. Any unauthorized disclosure, use, 
dissemination, copying, or distribution of this message or any of its 
attachments or the information contained in this e-mail, or the taking 
of any action based on it, is strictly prohibited. If you are not the 

RE: [rules-users] Old drools-spring project

2008-05-29 Thread Hehl, Thomas
If it helps, I am running Spring 2.5 with drools 4 and not having issues.

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lake Pancake
Sent: Thursday, May 29, 2008 9:33 AM
To: rules-users@lists.jboss.org
Subject: [rules-users] Old drools-spring project

 


I found this:

http://docs.codehaus.org/display/DROOLS/Drools+Spring+Tutorial
http://docs.codehaus.org/display/DROOLS/Drools+Spring+Tutorial 

The latest version available for drools-spring appears to be 2.5-beta-1.  Is
it stable and does it work with Drools 4 or should I stay away?

Thanks

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


Re: [rules-users] Old drools-spring project

2008-05-29 Thread Mark Proctor

Lake Pancake wrote:


I found this:

http://docs.codehaus.org/display/DROOLS/Drools+Spring+Tutorial

The latest version available for drools-spring appears to be 
2.5-beta-1.  Is it stable and does it work with Drools 4 or should I 
stay away?
It does not work with drools 2.5. Paul Browne is working on spring 
integration with 4.0, but its slow progress due to not enough community 
involvement.


Thanks


___
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] Old drools-spring project

2008-05-29 Thread Hehl, Thomas
Really. What kinds of issues are you seeing for Spring? I am using decision
tables and, as I stated earlier, it's working very well.

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Proctor
Sent: Thursday, May 29, 2008 10:03 AM
To: Rules Users List
Subject: Re: [rules-users] Old drools-spring project

 

Lake Pancake wrote: 


I found this:

http://docs.codehaus.org/display/DROOLS/Drools+Spring+Tutorial
http://docs.codehaus.org/display/DROOLS/Drools+Spring+Tutorial 

The latest version available for drools-spring appears to be 2.5-beta-1.  Is
it stable and does it work with Drools 4 or should I stay away?

It does not work with drools 2.5. Paul Browne is working on spring
integration with 4.0, but its slow progress due to not enough community
involvement.




Thanks



 





  _  



 
___
rules-users mailing list
rules-users@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: To know about correct Drools rule file (drl)syntaxes

2008-05-29 Thread Mark Proctor

Hareendra Pelige wrote:


Thanks for the feedback.

According to your experience, which rule file language is commonly used?

drl, rtfm, its well explaine and the examples are well documented as 
walk through tutorials.

http://www.jboss.org/drools/documentation.html


 


Thanks

Hareendra Pelige

 




*From:* [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] *On Behalf Of *pramod george

*Sent:* Thursday, May 29, 2008 1:54 PM
*To:* rules-users@lists.jboss.org
*Subject:* [rules-users] Re: To know about correct Drools rule file 
(drl)syntaxes


 


Hi.
Check: drools.pdf
http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.html
http://legacy.drools.codehaus.org/Tutorials+and+Examples


-P

 


Amity

 

 

This message, including any attachments, contains confidential 
information intended for a specific individual and purpose, and is 
intended for the addressee only. Any unauthorized disclosure, use, 
dissemination, copying, or distribution of this message or any of its 
attachments or the information contained in this e-mail, or the taking 
of any action based on it, is strictly prohibited. If you are not the 
intended recipient, please notify the sender immediately by return 
e-mail and delete this message.




___
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] Re: To know about correct Drools rule file (drl)syntaxes

2008-05-29 Thread Christine
On Thu, May 29, 2008 16:17, Hareendra Pelige wrote:

 According to your experience, which rule file language is commonly used?

I would say that this syntax from your email is easiest to use. As Mark
explained, the xml-type language is old, version 2.0. You can define a
domain specific language, but that's worth the effort only in larger
projects, I'd say.

Christine


rule Hello World

   when
m : Message( status == Message.HELLO, message : message)
   then
System.out.println( message );
modify ( m ) { message = Goodbyte cruel world,
status = Message.GOODBYE };
System.out.println( message );
end



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