Hey Guys,
Iam John and a newbie..
Iam building a database to store the business rules in the database. For example the following expression
Expression=(a=5 or b>6) and (c<7 or d=0)
will be stored in the database as follows:
Rule
-----------------------------------------
RuleId |LHSCode | Operator | RHSValue
------------------------------------------
R1 a = 5
R2 b > 6
R3 c < 7
R4 d = 0
------------------------------------------
Rule Group
--------------------------------------
RuleGroupId | RuleGroupDescrip
--------------------------------------
G1 R1 or R2
G2 R3 or R4
G3 (R1 or R2) and (R3 or R4)
----------------------------------------
Rule Group Relation_1
--------------------------------------------------------------
RuleGrRelId |RuleGroupId|RuleId|RuleJoinOperator|RuleSeqNo
--------------------------------------------------------------
1 G1 R1 or 1
2 G1 R2 - 2
3 G2 R3 or 1
4 G2 R4 - 2
--------------------------------------------------------------
Rule Group Relation_2
--------------------------------------------------------------
GrRelId |RuleGroupId|GroupJoinOperator|RuleSeqNo
--------------------------------------------------------------
1 G1 and 1
2 G2 - 2
--------------------------------------------------------------
The problem is have expressions with more than 5 or 6 rules in which i have 2 build more tables.Is there any better way to do this?Any Better database design?
Any suggestion would be greatly appreciated...
Regards
John