This section contains some extensive examples of the use of the BM syntax. An OCL expression is taken and written in the alternative notation. For sake of clarity, the keywords used in the BM notation are written with capital letters . The expression context Customer inv: programs->size() = cards->select( valid = true )->size() becomes context Customer inv: size of programs = size of select i: CustomerCard from cards where i.valid = true The expression context LoyaltyProgram inv: partners.deliveredServices->forAll( pointsEarned = 0 and pointsBurned = 0 ) implies Membership.account->isEmpty() becomes context LoyaltyProgram inv: forall s : Service in collect p.deliveredServices using p : ProgramPartner from partners is true ( ( pointsEarned= 0 and pointsBurned= 0 ) implies isempty collect account using l: LoyaltyAccount from membership ) The expression context LoyaltyProgram def: getServices(levelName: String) = Servicelevel->select( name = levelName ).availableServices becomes context LoyaltyProgram def: getServices(String levelName) = collect s.availableServices using s: ServiceLevel from select sl: ServiceLevel from Servicelevel where sl.name = levelName The expression context ProgramPartner inv: deliveredServices.transactions ->select( isOclType( Burning ) ) ->collect( points )->sum() < 10,000 becomes context ProgramPartner inv: sum of collect t.points using t : Transaction from select b: Transaction from collect s.transactions using s : Service from deliveredServices where b.isOclType( Burning ) < 10,000 |