[rules-users] To know about correct Drools rule file (drl) syntaxes
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. 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"> de.linsin.example.drools.domain.Item de.linsin.example.drools.domain.Bill java.lang.Integer item.isOnSeasonSale() == true double price = (item.getPrice()*(100-10))/100; bill.addItem(item, quantity.intValue()*price); de.linsin.example.drools.domain.Bill de.linsin.example.drools.domain.Customer customer.isDiscount() == true double total = bill.getTotal(); bill.setTotal((total*(100-5))/100); 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 https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] To know about correct Drools rule file (drl) syntaxes
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. 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"> de.linsin.example.drools.domain.Item de.linsin.example.drools.domain.Bill java.lang.Integer item.isOnSeasonSale() == true double price = (item.getPrice()*(100-10))/100; bill.addItem(item, quantity.intValue()*price); de.linsin.example.drools.domain.Bill de.linsin.example.drools.domain.Customer customer.isDiscount() == true double total = bill.getTotal(); bill.setTotal((total*(100-5))/100); 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 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