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">
<class>de.linsin.example.drools.domain.Item</class>
</parameter>
<parameter identifier="bill">
<class>de.linsin.example.drools.domain.Bill</class>
</parameter>
<parameter identifier="quantity">
<class>java.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">
<class>de.linsin.example.drools.domain.Bill</class>
</parameter>
<parameter identifier="customer">
<class>de.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: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] 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(a)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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users