Business Rules Logical Experssion and SBVR

1,099 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,099
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Business Rules Logical Experssion and SBVR

  1. 1. Conceptual Graphs, Logical Expressions and SBVR<br />By: GeshanManandhar<br />12/04/2011<br />
  2. 2. Business Rules<br />Business rule is “rule that is under business jurisdiction” (Object Management Group, 2008)<br />Constraints are ways to enforce business rules.<br />Conceptual graphs and logical expression provide a path to translate constraints into physical level implementation.<br />SBVR is a formal standard developed by OMG to define business vocabulary and describe rules based on the vocabulary.<br />2<br />
  3. 3. Constraint 3 : Conceptual Graph<br />A pickup biker cannot pickup a consignment in a district which she/he does not cover.<br />3<br />
  4. 4. Constraint 3: Logical Expression<br />Logical Expression:<br />not (a valid concept PB of type ‘Pickup Biker’ and a valid concept DP of type ‘Dispatch Parcel’ and a valid concept DD of type ‘District Division’ and a valid concept PC of type ‘Parcel of Consignment’ and a valid concept PD of type ‘Pickup District’ such that PB.Employeeo DD.Employeeand PB.Dispatch Parcel o DP and DP.Parcel of Consignment o PC and PC.Consignmento PD.Consignmentand PD.District <> DD.District)<br />4<br />
  5. 5. Constraint 3 : SBVR<br />5<br />
  6. 6. Constraint 3: Trigger<br />CREATE TRIGGER [PICKUP_BIKER_COVERS_PICKUP_DISTRICT]<br />ON [DISPATCH_PARCEL] FOR INSERT, UPDATE<br />AS<br />IF EXISTS (SELECT DP.CONSIGNMENT_NR<br /> FROM DISPATCH_PARCEL DP INNER JOIN EMPLOYEE E ON DP.PICKUP_BIKER = E.EMPLOYEE_NR INNER JOIN INSERTED I ON <br />I.PICKUP_BIKER = E.EMPLOYEE_NR INNER JOIN CONSIGNMENT C ON C.CONSIGNMENT_NR = DP.CONSIGNMENT_NR<br /> WHERE C.PICKUP_DISTRICT_NAME <> E.DISTRICT_NAME<br />)<br />BEGIN <br />RAISERROR 4000005 'THE PICKER BIKER DOES NOT COVER THE PICKUP DISTRICT.'<br />ROLLBACK<br />END<br />6<br />
  7. 7. Constraint 4: Conceptual Graph<br />The delivery time of a dispatch parcel must not be equal or smaller than the pickup time of that dispatch parcel.<br />7<br />Logical Expression:<br />not (a valid concept DDT of type ‘Dispatch Delivery Time’and a valid concept DPT of type ‘Dispatch Pickup Time’such that DDT.DispatchParcel o DPT.Dispatch Parcel and DDT.Date_Time<= DPT.Date_Time)<br />
  8. 8. Constraint 4: SBVR<br />8<br />
  9. 9. Constraint 4: Check Constraint<br />ALTER TABLE DISPATCH_PARCEL WITH CHECK <br />ADD CONSTRAINT DISPATCH_DELIVERY_TIME_LATER_THAN_PICKUP_TIME<br />CHECK ((DISPATCH_D > DISPATCH_P))<br />9<br />
  10. 10. Reflection<br />Business rules are easy to express in natural language but difficult to implement.<br />It is better to write rules as what is not wanted (negative statements).<br />A well designed repository of business rules in form of logical expression can help to automate implementation (active approach).<br />10<br />

×