|
|
|
Home | Business Intelligence | Data Mining | Rosella DBMS | Products & Downloads | Site Map | Contact Us | |
RME-EP Rule Specification LanguageRete engine is the de facto industry standards for rule-based expert system shells. It has been used extensively in various industries for developing expert systems. RME-EP is a Rete engine based on RME (Rule-based Model Evaluation) language with predictive models. RME-EP is based on SQL-99 syntax. The popularity of SQL as the standard database query language has been largely due to its intuitiveness and rich logical expressions. This is very important for especially developing business rules. RME-EP provides a superb language platform for business rule specification. The following sections describe the RME-EP rule specification language in detail. Further details can be found from the accompanying language manual. Here are coding conventions;
Fact names and Data typesFacts are basis of rule inference. Rules are applied based on a set of facts. Facts have a name and a value. With the popularity and support of XML, RME-EP supports dot-notations for fact names. For example, cust, cust.name, cust.age, etc. In addition, quoted identifiers may be used. This is normally used when white spaces are used in names, e.g., "My house.age", "His dog.doctor", etc. Each fact is associated with a data type. Normally one of "INTEGER", "REAL", and "STRING". To define fact data types, the following expressions are used; DECLARE ALL AS <data-type> ; DECLARE <fact-name> AS <data-type> ; The first is used to set default fact types. The second is used to define exceptional fact types. The following example shows this. The first line set the all facts as STRING. The others set special numeric data types as exceptions. (Note that STRING is the system default. No need to have the first expression explicitly!) DECLARE ALL AS STRING ; DECLARE cust.age AS INTEGER ; DECLARE cust.income AS INTEGER ; DECLARE cust.weight AS REAL ; RulesRules are the grains of RME-EP. Rules have the following syntax; RULE <rule-name>: <conditional-expression> ; Rule names can be numbers or identifiers without white spaces in between letters. In addition, quoted literals may be used as well, e.g., 1, MyRule, "My Rule", etc. Conditional expressions can be one of the followings;
The followings are examples of RME-EP rules;
RULE 1: IF cust.offer = 'yes' AND cust.gender ='male' THEN THROWEVENT('email', 'Dear Sir ....') END;
RULE 2: IF cust.offer = 'yes' AND cust.gender ='female' THEN THROWEVENT('email', 'Dear Mdm ....') END;
RULE 3: IF cust.age > 40 and cust.income > 50000 THEN SET cust.status AS 'Interested' END;
RULE 4: IF cust.status = 'Interested' THEN SET cust.offer AS 'yes' END;
An ExampleThe following is a simple working example of RME-EP models;
// declare options;
DECLARE OPTIONS FIREFIRST,ERRORNULL,MAXFIRE(1000) ;
// declare data types;
DECLARE ALL AS STRING; // set default types;
DECLARE cust.age AS INTEGER;
DECLARE cust.salary AS INTEGER;
RULE 1:
IF cust.age > 20 AND cust.salary > 50000 THEN SET cust.status AS 'interested' END;
RULE 2:
IF cust.status='interested' THEN SET cust.action AS 'send offer' END;
RULE 3:
IF ust.action='send offer' THEN THROWEVENT('email1', 'Dear Mr Blah...') END;
For more, please read Predictive Modeling Software. |
![]()
|
