File size: 128,133 Bytes
1e9db36
1
{"model":"class Player()\n class Match(startDate: Date, endDate: Date, playMove(p,m), getScore())\n class Tournament(name: String, startDate: Date, endDate: Date, acceptPlayer(p), removePlayer(p), schedule())\n association Match 'matches *' -- 'tournament 1' Tournament\n association Match 'matches *' -- 'players *' Player\n association Player 'players *' -- 'tournaments *' Tournament", "specification":"All Matches in a Tournament occur within the Tournament's time frame.","ocl":"context Tournament inv: self.matches->forAll(m:Match | m.startDate.after(self.startDate) and m.endDate.before(self.endDate))"} {"model":"class Player()\n class Match(startDate: Date, endDate: Date, playMove(p,m), getScore())\n class Tournament(name: String, startDate: Date, endDate: Date, acceptPlayer(p), removePlayer(p), schedule())\n association Match 'matches *' -- 'tournament 1' Tournament\n association Match 'matches *' -- 'players *' Player\n association Player 'players *' -- 'tournaments *' Tournament", "specification":"Each Tournament conducts at least one Match on the first day of the Tournament.","ocl":"context Tournament inv: self.matches->exists(m:Match | m.startDate.equals(self.startDate))"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"Every customer who enters a loyalty program must be of legal age.","ocl":"context Customer inv: self.age >= 18"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"Male customers must be approached using the title Mr..","ocl":"context Customer inv: self.isMale implies self.title = Mr."} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The number of valid cards for every customer must be equal to the number of programs in which the customer participates.","ocl":"context Customer inv: self.cards->select(valid=true)->size()=self.programs->size()"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The validFrom date of customer cards should be earlier than goodThru.","ocl":"context CustomerCard inv: self.validFrom < self.goodThru"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The birth date of the owner of a customer card must not be in the future.","ocl":"context CustomerCard inv: self.owner.dateOfBirth <> future"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The owner of a customer card must participate in at least one loyalty program.","ocl":"context CustomerCard inv: self.owner.programs->size() >= 1"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"There must be at least one transaction for a customer card with at least 100 points.","ocl":"context CustomerCard inv: self.transactions->select(point >= 100)->size()>= 1"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The service level of each membership must be a service level known to the loyalty program.","ocl":"context Membership inv: self.currentLevel->includes(self.program.levels)"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The participants of a membership must have the correct card belonging to this membership.","ocl":"context Membership inv: self.participants.cards->includes(self.card)"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The color of a membership's card must match the service level of the membership.","ocl":"context Membership inv: self.card.color = self.currentLevel.name"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"Memberships must not have associated accounts.","ocl":"context Membership inv: self.account->isEmpty()"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"Loyalty programs must offer at least one service to their customers.","ocl":"context LoyaltyProgram inv: self.partners.deliveredServices->size() >= 1"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"If none of the services offered in a loyalty program credits or debits the loyalty accounts: , then these instances are useless and should not be present.","ocl":"context LoyaltyProgram inv: partners.deliveredServices->forAll(pointsEarned = 0 and pointsBurned = 0) implies Membership.account->isEmpty()"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The name of the first level must be Silver.","ocl":"context LoyaltyProgram inv: self.levels->first().name = Silver"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"There must exist at least one service level with the name basic.","ocl":"context LoyaltyProgram inv: self.level->exists(name = 'basic')"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The number of participants in a loyalty program must be less than 10: ,000.","ocl":"context LoyaltyProgram inv: self.participants->size()<10000"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The number of the loyalty account must be unique within a loyalty program.","ocl":"context LoyaltyProgram inv: self.Membership.account->isUnique(acc|acc.numbers)"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The names of all customers of a loyalty program must be different.","ocl":"context LoyaltyProgram inv: self.participants.name->forAll(c1,c2|c1.name<>c2.name)"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The maximum age of participants in loyalty programs is 70.","ocl":"context LoyaltyProgram inv: self.participants->forAll(age<= 70)"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"There may be only one loyalty account that has a number lower than 10: ,000.","ocl":"context LoyaltyProgram inv: self.Membership.account->one(number < 10,000)"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The attribute numberOfCustomers of class ProgramPartner must be equal to the number of customers who participate in one or more loyalty programs offered by this program partner.","ocl":"context ProgramPartner inv: self.numberOfCustomers=programs.participants->asSet()->size()"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"A maximum of 10: ,000 points may be earned using services of one partner.","ocl":"context ProgramPartner inv: self.deliveredServices.pointsEarned<=10,000"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"All cards that generate transactions on the loyalty account must have the same owner.","ocl":"context LoyaltyAccount inv: self.transactions.cards.owner->asSet()->size() = 1"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"If the points earned in a loyalty account is greater than zero: , there exists a transaction with more than zero points.","ocl":"context LoyaltyAccount inv: points > 0 implies transactions->exists(t | t .points > 0)"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"There must be one transaction with exactly 500 points.","ocl":"context Transaction inv: self.transaction->select(point = 500)->size()=1"} {"model":"class LoyaltyProgram(name: String, enroll(), getServices(): Service)\n class ProgramPartner(numberOfCustomers: Integer, name: String)\n class Membership()\n class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge())\n class ServiceLevel(name: String)\n class Service(condition: Boolean, pointsEarned: Integer, pointsBurned: Integer, description: String, serviceNr: Integer)\n class CustomerCard(valid: Boolean, validFrom: Date, goodThru: Date, color: Color, printedName: String)\n class LoyaltyAccount(points: Integer, numbers: Integer, earn(), burn(), isEmpty())\n class Transaction(date: String, amount: Integer, point: Integer, programs())\n association LoyaltyProgram 'programs *' -- 'participants *' Customer\n association LoyaltyProgram 'programs 1..*' -- 'partners 1..*' ProgramPartner\n association LoyaltyProgram 'program 1' -- 'levels 1..*' ServiceLevel\n association LoyaltyProgram 'programs 0..1' -- 'membership 0..1' Membership\n association Customer 'owner 1' -- 'cards *' CustomerCard\n association ProgramPartner 'partner 0..1' -- 'deliveredServices *' Service\n association ServiceLevel 'currentLevel 1' -- 'currentLevel *' Membership\n association ServiceLevel 'level 0..1' -- 'availableServices *' Service\n association Membership --> 'card 1' CustomerCard\n association Membership --> 'account 0..1' LoyaltyAccount\n association CustomerCard 'card 1' -- 'transactions *' Transaction\n association LoyaltyAccount 'account 1' -- 'transactions *' Transaction\n association Service 'generatedBy 0..1' -- 'transactions *' Transaction", "specification":"The available services for a service level must be offered by a partner of the loyalty program to which the service level belongs.","ocl":"context ServiceLevel inv: self.program.partners->includesAll(self.availableServices.partner)"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The age of employees must be greater than or equal to 18","ocl":"context Employee inv: self.age() >= 18"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The supervisor of an employee must be older than the employee","ocl":"context Employee inv: self.supervisor->notEmpty() implies self.age() > self.supervisor.age()"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The salary of an employee cannot be greater than the salary of his\/her supervisor","ocl":"context Employee inv: self.supervisor->notEmpty() implies self.salary < self.supervisor.salary"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The hire date of employees must be greater than their birth date","ocl":"context Employee inv: self.hireDate > self.birthDate"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The start date of an employe as manager of a department must be greater than his\/her hire date","ocl":"context Employee inv: self.manages->notEmpty() implies self.manages.startDate > self.hireDate"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"A supervisor must be hired before every employee s\/he supervises","ocl":"context Employee inv: self.subordinates->notEmpty() implies self.subordinates->forall( e | e.hireDate > self.hireDate )"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The manager of a department must be an employee of the department","ocl":"context Department inv: self.worksFor->includes(self.manages.employee)"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The SSN of employees is an identifer (or a key)","ocl":"context Employee inv: Employee.allInstances->forAll( e1, e2 | e1 <> e2 implies e1.SSN <> e2.SSN )"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The name and relationship of dependents is a partial identifer: they are unique among all dependents of an employee","ocl":"context Employee inv: self.dependents->notEmpty() implies self.dependents->forAll( e1, e2 | e1 <> e2 implies ( e1.name <> e2.name or e1.relationship <> e2.relationship ))"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The location of a project must be in one of the locations of its department","ocl":"context Project inv: self.controls.locations->includes(self.location)"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The attribute nbrEmployees in Department keeps the number of employees that works for the department","ocl":"context Department inv: self.nbrEmployees = self.worksFor->size()"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"An employee works at most in 4 projects","ocl":"context Employee inv: self.worksOn->size() <= 4"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"An employee may only work on projects controlled by the department in which s\/he works","ocl":"context Employee inv: self.worksFor.controls->includesAll(self.worksOn.project)"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"An employee works at least 30h\/week and at most 50 h\/week on all its projects","ocl":"context Employee inv: let totHours: Integer = self.worksOn->collect(hours)->sum() in totHours >= 30 and totHours <=50"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"A project can have at most 2 employees working on the project less than 10 hours","ocl":"context Project inv: self.worksOn->select( hours < 10 )->size() <= 2"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"Only department managers can work less than 5 hours on a project","ocl":"context Employee inv: self.worksOn->select( hours < 5 )->notEmpty() implies Department.allInstances()->collect(manages.employee)-> includes(self)"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The only managers that can work less than 5 hours on a department project must be an employee of the department itself","ocl":"context Employee inv: self.worksOn->select( hours < 5 )->notEmpty() implies self.worksFor.manages.employee=self"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"Employees without subordinates must work at least 10 hours on every project they work","ocl":"context Employee inv: self.subordinates->isEmpty() implies self.worksOn->forAll( hours >=10 )"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The manager of a department must work at least 5 hours on all projects controlled by the department","ocl":"context Department inv: self.controls->forall( p:Project | self.manages.employee.worksOn->select(hours >= 5)->contains(p) )"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"An employee cannot supervise him\/herself","ocl":"context Employee inv: self.subordinates->excludes(self)"} {"model":"class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age())\n class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer)\n class Project(number: Integer, name: String, location: String)\n class Manages(startDate: Date)\n class WorksOn(hours: Integer)\n class Dependent(name: String, relationship: String, sex: String, birthDate: Date\n association Employee 'manager 1' -- 'department 0..1' Department: (Employee, Department) .. Manages\n association Employee 'employees 4..*' -- 'department 1' Department: WorksFor\n association Employee 'owned 1..*' -- 'worksOn 1..*' Project: (Employee, Project) .. WorksOn\n association Employee 'supervisor 0..1' -- 'subordinates 0..*' Employee: Supervision\n association Employee 'employee 1' -- 'dependents 0..*' Dependent\n association Department 'department 1..*' -- 'controls 1' Project", "specification":"The supervision relationship must not be cyclic","ocl":"context Employee def: allSubordinates = self.subordinates->union(self->subordinates->collect(e:Employee | e.allSubordinates)) inv: self.allSubordinates->exludes(self)"} {"model":"class Date(date: String)\n class Car(regNum: String)\n class CarGroup(category: String)\n class Branch(address: String)\n class Quote(value: Integer)\n class Rental(id: String, price: Real, state: String, startingDate: Date, endingDate: Date)\n class Customer(id: String, name: String, birthday: Date, licenseExpData: Date, premium: Boolean, discount: Integer)\n class BlackListed(blackListedDate: Date)\n association Car 'cars 1..*' -- 'carGroup 1' CarGroup\n association Car 'car 0..1' -- 'rentalAgreement *' Rental\n association CarGroup 'low 0..1' -- 'high 0..1' CarGroup\n association CarGroup 'carGroup 1..*' -- 'branch 1..*' Branch\n association Branch 'pickUpBranch 1' -- 'pickUpRental *' Rental\n association Branch 'dropOffBranch 1' -- 'dropOffRental *' Rental\n association Rental 'rental 1..*' -- 'driver 1..*' Customer\n association BlackListed --|> Customer\n ", "specification":"Rental ending date must be later or equal than starting date","ocl":"context Rental inv: self.startingdate <= self.endingDate"} {"model":"class Date(date: String)\n class Car(regNum: String)\n class CarGroup(category: String)\n class Branch(address: String)\n class Quote(value: Integer)\n class Rental(id: String, price: Real, state: String, startingDate: Date, endingDate: Date)\n class Customer(id: String, name: String, birthday: Date, licenseExpData: Date, premium: Boolean, discount: Integer)\n class BlackListed(blackListedDate: Date)\n association Car 'cars 1..*' -- 'carGroup 1' CarGroup\n association Car 'car 0..1' -- 'rentalAgreement *' Rental\n association CarGroup 'low 0..1' -- 'high 0..1' CarGroup\n association CarGroup 'carGroup 1..*' -- 'branch 1..*' Branch\n association Branch 'pickUpBranch 1' -- 'pickUpRental *' Rental\n association Branch 'dropOffBranch 1' -- 'dropOffRental *' Rental\n association Rental 'rental 1..*' -- 'driver 1..*' Customer\n association BlackListed --|> Customer\n ","specification":"On Mondays the agency is close (so no rentals starting on a Monday)","ocl":"context Rental inv: not self.startingDate.dayOfTheWeek()<>DayOftheWeek::Monday"} {"model":"class Date(date: String)\n class Car(regNum: String)\n class CarGroup(category: String)\n class Branch(address: String)\n class Quote(value: Integer)\n class Rental(id: String, price: Real, state: String, startingDate: Date, endingDate: Date)\n class Customer(id: String, name: String, birthday: Date, licenseExpData: Date, premium: Boolean, discount: Integer)\n class BlackListed(blackListedDate: Date)\n association Car 'cars 1..*' -- 'carGroup 1' CarGroup\n association Car 'car 0..1' -- 'rentalAgreement *' Rental\n association CarGroup 'low 0..1' -- 'high 0..1' CarGroup\n association CarGroup 'carGroup 1..*' -- 'branch 1..*' Branch\n association Branch 'pickUpBranch 1' -- 'pickUpRental *' Rental\n association Branch 'dropOffBranch 1' -- 'dropOffRental *' Rental\n association Rental 'rental 1..*' -- 'driver 1..*' Customer\n association BlackListed --|> Customer\n ","specification":"Minimum duration of a rental is 10 hours","ocl":"context Rental inv: (self.endDate - self.startingDate).hours() >= 10"} {"model":"class Date(date: String)\n class Car(regNum: String)\n class CarGroup(category: String)\n class Branch(address: String)\n class Quote(value: Integer)\n class Rental(id: String, price: Real, state: String, startingDate: Date, endingDate: Date)\n class Customer(id: String, name: String, birthday: Date, licenseExpData: Date, premium: Boolean, discount: Integer)\n class BlackListed(blackListedDate: Date)\n association Car 'cars 1..*' -- 'carGroup 1' CarGroup\n association Car 'car 0..1' -- 'rentalAgreement *' Rental\n association CarGroup 'low 0..1' -- 'high 0..1' CarGroup\n association CarGroup 'carGroup 1..*' -- 'branch 1..*' Branch\n association Branch 'pickUpBranch 1' -- 'pickUpRental *' Rental\n association Branch 'dropOffBranch 1' -- 'dropOffRental *' Rental\n association Rental 'rental 1..*' -- 'driver 1..*' Customer\n association BlackListed --|> Customer\n ","specification":"Last Friday of each month the agency is closed","ocl":"context Rental inv: not self.startingdate = self.startingdate.getMonth().last('Friday')"} {"model":"class Airport(name: String)\n class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer)\n class Airline(name: String)\n class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight))\n association Airport 'origin 1' -- 'departingFlights *' Flight\n association Airport 'destination 1' -- 'arrivingFlights *' Flight\n association Flight 'flights *' -- 'airline 1' Airline\n association Flight 'flight 1' -- '(ordered) passengers *' Passenger\n association Passenger 'CEO 0..1' -- 'airline 0..1' Airline\n ","specification":"All flight objects must have a duration attribute that is less than four","ocl":"context Flight inv: self.duration < 4"} {"model":"class Airport(name: String)\n class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer)\n class Airline(name: String)\n class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight))\n association Airport 'origin 1' -- 'departingFlights *' Flight\n association Airport 'destination 1' -- 'arrivingFlights *' Flight\n association Flight 'flights *' -- 'airline 1' Airline\n association Flight 'flight 1' -- '(ordered) passengers *' Passenger\n association Passenger 'CEO 0..1' -- 'airline 0..1' Airline\n ","specification":"The maximum number of passengers on any flight may not exceed 1000","ocl":"context Flight inv: self.maxNrPassenger <= 1000"} {"model":"class Airport(name: String)\n class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer)\n class Airline(name: String)\n class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight))\n association Airport 'origin 1' -- 'departingFlights *' Flight\n association Airport 'destination 1' -- 'arrivingFlights *' Flight\n association Flight 'flights *' -- 'airline 1' Airline\n association Flight 'flight 1' -- '(ordered) passengers *' Passenger\n association Passenger 'CEO 0..1' -- 'airline 0..1' Airline\n ","specification":"For every passenger the age attribute must be greater than or equal to the class attribute minAge","ocl":"context Passenger inv: self.age >= self.minAge"} {"model":"class Airport(name: String)\n class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer)\n class Airline(name: String)\n class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight))\n association Airport 'origin 1' -- 'departingFlights *' Flight\n association Airport 'destination 1' -- 'arrivingFlights *' Flight\n association Flight 'flights *' -- 'airline 1' Airline\n association Flight 'flight 1' -- '(ordered) passengers *' Passenger\n association Passenger 'CEO 0..1' -- 'airline 0..1' Airline\n ","specification":"The duration attribute of all flight objects must be equal to the difference between the arrivalTime attribute and the departTime attribute","ocl":"context Flight inv: self.duration = self.arrivalTime - self.departTime"} {"model":"class Airport(name: String)\n class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer)\n class Airline(name: String)\n class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight))\n association Airport 'origin 1' -- 'departingFlights *' Flight\n association Airport 'destination 1' -- 'arrivingFlights *' Flight\n association Flight 'flights *' -- 'airline 1' Airline\n association Flight 'flight 1' -- '(ordered) passengers *' Passenger\n association Passenger 'CEO 0..1' -- 'airline 0..1' Airline\n ","specification":"The airport from which a flight is leaving is different from the destination airport","ocl":"context Flight inv: self.origin <> self.destination"} {"model":"class Airport(name: String)\n class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer)\n class Airline(name: String)\n class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight))\n association Airport 'origin 1' -- 'departingFlights *' Flight\n association Airport 'destination 1' -- 'arrivingFlights *' Flight\n association Flight 'flights *' -- 'airline 1' Airline\n association Flight 'flight 1' -- '(ordered) passengers *' Passenger\n association Passenger 'CEO 0..1' -- 'airline 0..1' Airline\n ","specification":"For every flight the name of the airport from which it is leaving must be 'Amsterdam'","ocl":"context Flight inv: self.origin.name = 'Amsterdam'"} {"model":"class Airport(name: String)\n class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer)\n class Airline(name: String)\n class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight))\n association Airport 'origin 1' -- 'departingFlights *' Flight\n association Airport 'destination 1' -- 'arrivingFlights *' Flight\n association Flight 'flights *' -- 'airline 1' Airline\n association Flight 'flight 1' -- '(ordered) passengers *' Passenger\n association Passenger 'CEO 0..1' -- 'airline 0..1' Airline\n ","specification":"For every flight the name of the airline must be 'KLM'","ocl":"context Flight inv: self.airline.name = 'KLM'"} {"model":"class Unit(name: String, symbol: String, description: String, definitionURI: String)\n class SystemOfUnits(name String, symbol: String, description: String, definitionURI: String)\n class SystemOfQuantities(name String, symbol: String, description: String, definitionURI: String)\n class QuantityKind(name String, symbol: String, description: String, definitionURI: String)\n class Prefix(name: String, symbol: String, factor: Real)\n class AffineConversionUnit(factor: Real, offset: Integer)\n class UnitFactor(exponent: Real)\n class GeneralConversionUnit(expression: String, expressionLanguageURI: String)\n class DerivedUnit()\n class SimpleUnit()\n class ConversionBasedUnit()\n class PrefixedUnit()\n class LinearConversionUnit()\n association Unit --> 'quantityKind 0..1' QuantityKind\n association SystemOfUnits --> 'systemofQuantities *' SystemOfQuantities\n association SystemOfUnits --> 'unit *' Unit\n association SystemOfUnits --> 'baseUnit *' Unit\n association SystemOfUnits --> 'prefix *' Prefix\n association SystemOfQuantities --> 'baseQuantityKind *' QuantityKind\n association UnitFactor --> 'unit 1' Unit\n association DerivedUnit --> 'factor 1..*' UnitFactor\n association ConversionBasedUnit --> 'referenceUnit 1' Unit\n association PrefixedUnit --> 'prefix 1' Prefix\n association DerivedUnit --|> Unit\n association SimpleUnit --|> Unit\n association ConversionBasedUnit --|> Unit\n association PrefixedUnit --|> ConversionBasedUnit\n association LinearConverionUnit --|> ConversionBasedUnit\n association AffineConversionUnit --|> ConversionBasedUnit\n association GeneralConversionUnit --|> ConversionBasedUnit", "specification":"The referenceUnit shall not be a PrefixedUnit","ocl":"context PrefixedUnit inv: not referenceUnit->oclIsTypeOf(PrefixedUnit)"} {"model":"class Unit(name: String, symbol: String, description: String, definitionURI: String)\n class SystemOfUnits(name String, symbol: String, description: String, definitionURI: String)\n class SystemOfQuantities(name String, symbol: String, description: String, definitionURI: String)\n class QuantityKind(name String, symbol: String, description: String, definitionURI: String)\n class Prefix(name: String, symbol: String, factor: Real)\n class AffineConversionUnit(factor: Real, offset: Integer)\n class UnitFactor(exponent: Real)\n class GeneralConversionUnit(expression: String, expressionLanguageURI: String)\n class DerivedUnit()\n class SimpleUnit()\n class ConversionBasedUnit()\n class PrefixedUnit()\n class LinearConversionUnit()\n association Unit --> 'quantityKind 0..1' QuantityKind\n association SystemOfUnits --> 'systemofQuantities *' SystemOfQuantities\n association SystemOfUnits --> 'unit *' Unit\n association SystemOfUnits --> 'baseUnit *' Unit\n association SystemOfUnits --> 'prefix *' Prefix\n association SystemOfQuantities --> 'baseQuantityKind *' QuantityKind\n association UnitFactor --> 'unit 1' Unit\n association DerivedUnit --> 'factor 1..*' UnitFactor\n association ConversionBasedUnit --> 'referenceUnit 1' Unit\n association PrefixedUnit --> 'prefix 1' Prefix\n association DerivedUnit --|> Unit\n association SimpleUnit --|> Unit\n association ConversionBasedUnit --|> Unit\n association PrefixedUnit --|> ConversionBasedUnit\n association LinearConverionUnit --|> ConversionBasedUnit\n association AffineConversionUnit --|> ConversionBasedUnit\n association GeneralConversionUnit --|> ConversionBasedUnit", "specification":"In a coherent system of units, there is only one base unit for each base quantity.","ocl":"context SystemOfUnits inv: self.systemOfQuantities.baseQuantityKind.size() = self.baseUnit->size() = 1"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct", "specification":"The stock of a Product is always a natural number, i.e., it is a positive Integer. This also ensures the definedness of the stock.","ocl":"context Product inv isNat: self.stock >= 0"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"The Product id is unique.","ocl":"context Product inv idUnique: Product::allInstances()->forAll(p1:Product, p2:Product | p1.id <> p2.id)"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"The quantity of an Order is always a natural number, i.e., it is a positive Integer. This also ensures the definedness of the quantity.","ocl":"context Order inv isNat: self.quantity >= 0"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"The state of an Order should either be `pending'  or `invoiced'.","ocl":"context Order inv stateRange: (self.state = 'pending') or (self.state = 'invoiced')"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"The Order id is unique.","ocl":"context Order inv idUnique: Order::allInstances()->forAll(o1:Order, o2:Order | o1.id <> o2.id)"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"order(...) function creates a new Order","ocl":"context Order::Order(prd:Product, qty:Integer):OclVoid pre: qty > 0 pre: self.warehouse.products->exists(x:Product | x = prd) pre: not prd.oclIsUndefined() post: self.oclIsNew() and  self.quantity = qty and self.orderedProduct = prd"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"The state of the order will be changed into 'invoiced' if the ordered quantity is either less or equal to the quantity which is in stock according to the reference of the ordered product.","ocl":"context Order::invoice() : Boolean pre: self.state = 'pending' and self.quantity <= self.orderedProduct.stock post: self.state = 'invoiced' and self.quantity = self.quantity@pre and self.orderedProduct = self.orderedProduct@pre and self.orderedProduct.stock = self.orderedProduct@pre.stock - self.quantity"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"cancel() function cancels order as an opposite operation to invoice order","ocl":"context Order::cancel() : Boolean pre:  self.state = 'invoiced' post: self.state = 'pending' and self.quantity = self.quantity@pre and self.product = self.product@pre and self.product.stock = self.product@pre.stock + self@pre.quantity"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"supply(...) function adds quantity of the product to the stock","ocl":"context Product::supply(qty:Integer):Boolean pre: qty > 0 post: self.stock = self.stock@pre + qty"} {"model":"class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean)\n class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean)\n association Order 'order 1' --> 'product 1' Product: OrderProduct","specification":"release(...) removes quantity of the product from the stock","ocl":"context Product::release(qty:Integer):Boolean pre:  self.stock >= qty post: self.stock = self.stock@pre - qty"} {"model":"class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House))\n class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date)\n class House(value: Money)\n association Person 'owner 1' -- 'houses *' House\n association House 'security 1' -- 'mortgages *' Mortgage\n association Mortgage 'mortgages *' -- 'borrower 1' Person", "specification":"The start date for any mortgage must be before the end date.","ocl":"context Mortgage: inv: startDate < endDate"} {"model":"class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House))\n class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date)\n class House(value: Money)\n association Person 'owner 1' -- 'houses *' House\n association House 'security 1' -- 'mortgages *' Mortgage\n association Mortgage 'mortgages *' -- 'borrower 1' Person","specification":"A person may have a mortgage on a house only if that house is owned by the person.","ocl":"context Mortgage: inv: self.security.owner = self.borrower"} {"model":"class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House))\n class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date)\n class House(value: Money)\n association Person 'owner 1' -- 'houses *' House\n association House 'security 1' -- 'mortgages *' Mortgage\n association Mortgage 'mortgages *' -- 'borrower 1' Person","specification":"A person may have mortgage on a house only if that house is owned by the person (use Person as context).","ocl":"context Person: inv: self.mortgages.security.owner->forAll(p : Person | p = self)"} {"model":"class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House))\n class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date)\n class House(value: Money)\n association Person 'owner 1' -- 'houses *' House\n association House 'security 1' -- 'mortgages *' Mortgage\n association Mortgage 'mortgages *' -- 'borrower 1' Person","specification":"The social security number of all persons must be unique (use House as a context).","ocl":"context Person: inv: Person::allInstance()->forAll(p1,p2 : Person | p1<>p2 implies p1.socSecNr <> p2.socSecNr)"} {"model":"class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House))\n class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date)\n class House(value: Money)\n association Person 'owner 1' -- 'houses *' House\n association House 'security 1' -- 'mortgages *' Mortgage\n association Mortgage 'mortgages *' -- 'borrower 1' Person","specification":"The social security number of all persons must be unique (use Person as a context).","ocl":"context Person::getMortgage(sum:Money, security:House) pre: self.mortgages.monthlyPayment->sum() <= self.salary * 0.30"} {"model":"class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House))\n class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date)\n class House(value: Money)\n association Person 'owner 1' -- 'houses *' House\n association House 'security 1' -- 'mortgages *' Mortgage\n association Mortgage 'mortgages *' -- 'borrower 1' Person","specification":"A new mortgage will be allowed only when the person's income is sufficient (assume that the yearly payment must be less than 30% of the salary).","ocl":"context Person::getMortgage(sum:Money, security:House) pre: security.value >= (security.mortgages.principal->sum() + sum)"} {"model":"class Train(identifier: String, numOfWagons: Integer, numOfEngines: Integer, weight: Integer)\n class Wagon(weight: Integer, smoking: Boolean, currentLoad: Integer, capacity: Integer)\n association Train 'train 1' -- 'wagon *' Wagon\n association Wagon 'succ 0..1' -- 'pred 0..1' Wagon", "specification":"All the trains will have the same number of wagons.","ocl":"context Train: inv: self.wagon -> size() >= 1"} {"model":"class Train(identifier: String, numOfWagons: Integer, numOfEngines: Integer, weight: Integer)\n class Wagon(weight: Integer, smoking: Boolean, currentLoad: Integer, capacity: Integer)\n association Train 'train 1' -- 'wagon *' Wagon\n association Wagon 'succ 0..1' -- 'pred 0..1' Wagon","specification":"A wagon and its successor wagon should belong to the same train.","ocl":"context Wagon: inv: self.succ -> notEmpty() implies self.succ.train = self.train"} {"model":"class Train(identifier: String, numOfWagons: Integer, numOfEngines: Integer, weight: Integer)\n class Wagon(weight: Integer, smoking: Boolean, currentLoad: Integer, capacity: Integer)\n association Train 'train 1' -- 'wagon *' Wagon\n association Wagon 'succ 0..1' -- 'pred 0..1' Wagon","specification":"The current load of a wagon cannot exceed its capacity","ocl":"context Train: inv: Train.allInstances -> forAll(x:Train,y:Train | x.wagon->size() = y.wagon->size() )"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage", "specification":"Value of attribute noEmployees in instances of Company must be less than or equal to 50","ocl":"context Company inv: self.noEmployees <= 50"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"The stock price of companies is greater than 0","ocl":"context Company inv: self.stockPrice() > 0"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"Income of a person is the sum of the salaries of her jobs","ocl":"context Person::income(): Integer body: self.job.salary->sum()"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"descendants() obtains the direct and indirect descendants of a person","ocl":"context Person::descendants(): Set body: result = self.children->union(self.children->collect(c | c.descendants()))"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"Only married women can have a maiden name","ocl":"context Person inv: self.maidenName <> `' implies self.gender = Gender::female and self.isMarried = true"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"A person is currently married to at most one person","ocl":"context Person inv: self.marriage[wife]->select(m | m.ended = false)->size()=1 and self.marriage[husband]->select(m | m.ended = false)->size()=1"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"currentSpouse() selects the current spouse of a person","ocl":"context Person::currentSpouse() : Person pre: self.isMarried = true body: if gender = Gender::male self.marriage[wife]->select(m | m.ended = false).wife else self.marriage[husband]->select(m | m.ended = false).husband"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"There are at most 100 persons","ocl":"context Person inv: Person.allInstances()->size() <= 100"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"A company has at least one employee older than 50","ocl":"context Company inv: self.employees->select(age > 50)->notEmpty()"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"The collection of employees of a company who are less than 18 years old is empty","ocl":"context Company inv: self.employees->reject(age>=18)->isEmpty()"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"The age of each employee is less than or equal to 65","ocl":"context Company inv: self.employees->forAll(age <= 65)"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"All instances of persons have unique names","ocl":"context Person inv: Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name )"} {"model":"enumeration Gender(male, female)\n class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set)\n class Bank(accountNo: Integer)\n class Job(title: String, startDate: Date, salary: Integer)\n class Company(name: String, noEmployees: Integer, stockPrice(): Real, hireEmployee(p: Person))\n class Marriage(place: String, date: Date, ended: Boolean)\n assocation Person 'employees *' -- 'employer *' Company: Job\n assocation Person 'manager 1' -- 'managedCompanies *' Company\n assocation Person 'customer 0..1' -- 'banks *' Bank\n assocation Person 'parents 0..2' -- 'children *' Person\n assocation Person 'wife *' -- 'husband *' Person: Marriage","specification":"The firstName of at least one employee is equal to 'Jack'","ocl":"context Company inv: self.employees->exists(firstName = 'Jack')"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle", "specification":"A vehicle owner must be at least 18 years old","ocl":"context Vehicle inv: self. owner. age >= 18"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle","specification":"Nobody has more than 3 vehicles","ocl":"context Person inv: self.fleet->size <= 3"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle","specification":"All cars of a person are black","ocl":"context Person inv: self.fleet->forAll(v | v.colour = #black)"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle","specification":"Nobody has more than 3 black vehicles","ocl":"context Person inv: self.fleet->forAll(v | v.colour = #black) -> size <= 3"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle","specification":"A person younger than 18 owns no cars","ocl":"context Person inv: age<18 implies self.fleet->forAll(v | not v.oclIsKindOf(Car))"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle","specification":"There is a red car","ocl":"context Car inv: Car.allInstances()->exists(c | c.colour=#red)"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle","specification":"If setAge(. . . ) is called with a non-negative argument then the argument becomes the new value of the attribute age","ocl":"context Person::setAge(newAge:int) pre: newAge >= 0 post: self.age = newAge"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle","specification":"Calling birthday() increments the age of a person by 1","ocl":"context Person::birthday() post: self.age = self.age@pre + 1"} {"model":"enumeration Colour(black(): Colour, white(): Colour, red(): Colour)\n class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)\n class Vehicle(colour: Colour)\n class Car()\n class Bike()\n association Person 'owner 1' -- 'fleet *' Vehicle: ownership\n association Car --|> Vehicle\n association Bike --|> Vehicle","specification":"Calling getName() delivers the value of the attribute name","ocl":"context Person::getName() post: result = name"} {"model":"class HealthRecord(createMedicalInfo(description: String): HealthRecord, updateMedicalInfo(description: String): HealthRecord, createPrescription(info: MedicalInfo, prescription: Prescription): HealthRecord, deletePrescription(prescription: Prescription): HealthRecord, readMedicalInfo(MedicalInfo: OclVoid), readPrescription(): Prescription)\n class Prescription(drug: String, amount: Integer, creator: Doctor)\n class MedicalInfo(description: String, creator: Doctor, open: Boolean)\n class Patient(name: String)\n class Doctor()\n class Pharmacist()\n association HealthRecord 'record 1' -- 'owner 1' Patient\n association HealthRecord 'record 1' -- 'prescription *' Prescription\n association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo\n association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo\n association Patient 'treats *' <|-- 'treatedBy *' Doctor\n association Patient 'treats *' <|-- Pharmacist","specification":"You can only add a prescription if you have previously created the corresponding MedicalInfo","ocl":"context HealthRecord::createMedicalInfo(p:MedicalInfo,prescription:Prescription):HealthRecord pre perm1: p.creator = environment.caller "} {"model":"class HealthRecord(createMedicalInfo(description: String): HealthRecord, updateMedicalInfo(description: String): HealthRecord, createPrescription(info: MedicalInfo, prescription: Prescription): HealthRecord, deletePrescription(prescription: Prescription): HealthRecord, readMedicalInfo(MedicalInfo: OclVoid), readPrescription(): Prescription)\n class Prescription(drug: String, amount: Integer, creator: Doctor)\n class MedicalInfo(description: String, creator: Doctor, open: Boolean)\n class Patient(name: String)\n class Doctor()\n class Pharmacist()\n association HealthRecord 'record 1' -- 'owner 1' Patient\n association HealthRecord 'record 1' -- 'prescription *' Prescription\n association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo\n association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo\n association Patient 'treats *' <|-- 'treatedBy *' Doctor\n association Patient 'treats *' <|-- Pharmacist","specification":"To create a MedicalInfo about a patient you need to be one of its doctors","ocl":"context HealthRecord::createMedicalInfo(description:String):HealthRecord post perm2:  self.owner.treatedBy.oclAsType(OclAny) ->includes (environment.caller.oclAsType(OclAny))"} {"model":"class HealthRecord(createMedicalInfo(description: String): HealthRecord, updateMedicalInfo(description: String): HealthRecord, createPrescription(info: MedicalInfo, prescription: Prescription): HealthRecord, deletePrescription(prescription: Prescription): HealthRecord, readMedicalInfo(MedicalInfo: OclVoid), readPrescription(): Prescription)\n class Prescription(drug: String, amount: Integer, creator: Doctor)\n class MedicalInfo(description: String, creator: Doctor, open: Boolean)\n class Patient(name: String)\n class Doctor()\n class Pharmacist()\n association HealthRecord 'record 1' -- 'owner 1' Patient\n association HealthRecord 'record 1' -- 'prescription *' Prescription\n association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo\n association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo\n association Patient 'treats *' <|-- 'treatedBy *' Doctor\n association Patient 'treats *' <|-- Pharmacist","specification":"To create a MedicalInfo, you need to be a doctor (not necessarily the one of the patient)","ocl":"context HealthRecord::createMedicalInfo(description:String):HealthRecord pre perm3: environment.caller.role = 'Doctor'"} {"model":"class HealthRecord(createMedicalInfo(description: String): HealthRecord, updateMedicalInfo(description: String): HealthRecord, createPrescription(info: MedicalInfo, prescription: Prescription): HealthRecord, deletePrescription(prescription: Prescription): HealthRecord, readMedicalInfo(MedicalInfo: OclVoid), readPrescription(): Prescription)\n class Prescription(drug: String, amount: Integer, creator: Doctor)\n class MedicalInfo(description: String, creator: Doctor, open: Boolean)\n class Patient(name: String)\n class Doctor()\n class Pharmacist()\n association HealthRecord 'record 1' -- 'owner 1' Patient\n association HealthRecord 'record 1' -- 'prescription *' Prescription\n association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo\n association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo\n association Patient 'treats *' <|-- 'treatedBy *' Doctor\n association Patient 'treats *' <|-- Pharmacist","specification":"The amount of a prescription must not be too large","ocl":"context Prescription inv AmountNotTooLarge: self.amount < 1000"} {"model":"class HealthRecord(createMedicalInfo(description: String): HealthRecord, updateMedicalInfo(description: String): HealthRecord, createPrescription(info: MedicalInfo, prescription: Prescription): HealthRecord, deletePrescription(prescription: Prescription): HealthRecord, readMedicalInfo(MedicalInfo: OclVoid), readPrescription(): Prescription)\n class Prescription(drug: String, amount: Integer, creator: Doctor)\n class MedicalInfo(description: String, creator: Doctor, open: Boolean)\n class Patient(name: String)\n class Doctor()\n class Pharmacist()\n association HealthRecord 'record 1' -- 'owner 1' Patient\n association HealthRecord 'record 1' -- 'prescription *' Prescription\n association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo\n association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo\n association Patient 'treats *' <|-- 'treatedBy *' Doctor\n association Patient 'treats *' <|-- Pharmacist","specification":"Closed medical infos can only be read by the doctor which created it","ocl":"context HealthRecord::readMedicalInfo():MedicalInfo post perm4: resultresult.creator.oclAsType(OclAny) = environment.caller.oclAsType(OclAny)"} {"model":"class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)\n class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)\n class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)\n class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)\n class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)\n class Date(today(): Date, durationInDays(d: Date): Integer)\n class Max1GB()\n class Max10GB()\n class Max100GB()\n association Customer 'customer' -- 'bill' Bill\n association Customer 'customer' -- 'service' Service\n association Customer 'customer 1..*' -- 'provider' Provider\n association Customer 'customer' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'service' Service\n association SurfRecord 'surfRecord 1..*' -- 'provider' Provider\n association Provider 'provider' -- 'services 1..*' Service\n association Service <|-- Max1GB\n association Service <|-- Max10GB\n association Service <|-- Max100GB","specification":"For the service ``1GB'' the free download variable should be invariant and be set to 1.","ocl":"context Max1GB inv : self.freedownload = 1024"} {"model":"class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)\n class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)\n class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)\n class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)\n class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)\n class Date(today(): Date, durationInDays(d: Date): Integer)\n class Max1GB()\n class Max10GB()\n class Max100GB()\n association Customer 'customer' -- 'bill' Bill\n association Customer 'customer' -- 'service' Service\n association Customer 'customer 1..*' -- 'provider' Provider\n association Customer 'customer' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'service' Service\n association SurfRecord 'surfRecord 1..*' -- 'provider' Provider\n association Provider 'provider' -- 'services 1..*' Service\n association Service <|-- Max1GB\n association Service <|-- Max10GB\n association Service <|-- Max100GB","specification":"A customer can only have a service from his service provider","ocl":"context Provider inv onlyOfferedService: self.services->includesAll(self.customer->collect(c:Customer | c.service)->asSet())"} {"model":"class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)\n class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)\n class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)\n class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)\n class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)\n class Date(today(): Date, durationInDays(d: Date): Integer)\n class Max1GB()\n class Max10GB()\n class Max100GB()\n association Customer 'customer' -- 'bill' Bill\n association Customer 'customer' -- 'service' Service\n association Customer 'customer 1..*' -- 'provider' Provider\n association Customer 'customer' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'service' Service\n association SurfRecord 'surfRecord 1..*' -- 'provider' Provider\n association Provider 'provider' -- 'services 1..*' Service\n association Service <|-- Max1GB\n association Service <|-- Max10GB\n association Service <|-- Max100GB","specification":"If the download rate of a customer (in Surf-Record) is lower than the freedownload of his service, then the amount_of_money in his bill is equal to the price in the service.","ocl":"context Bill inv: self.surfRecord.downloadRate <= self.service.freedownload implies self.amount = self.service.price"} {"model":"class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)\n class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)\n class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)\n class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)\n class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)\n class Date(today(): Date, durationInDays(d: Date): Integer)\n class Max1GB()\n class Max10GB()\n class Max100GB()\n association Customer 'customer' -- 'bill' Bill\n association Customer 'customer' -- 'service' Service\n association Customer 'customer 1..*' -- 'provider' Provider\n association Customer 'customer' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'service' Service\n association SurfRecord 'surfRecord 1..*' -- 'provider' Provider\n association Provider 'provider' -- 'services 1..*' Service\n association Service <|-- Max1GB\n association Service <|-- Max10GB\n association Service <|-- Max100GB","specification":"If the bill has not been paid for 30 days, the customer's flag active will be set to false","ocl":"context Customer inv: self.bill.send_date.durationInDays(self.bill.paid_date.today()) > 30 and self.bill.send_date.durationInDays(self.bill.paid_date) > 30 implies not self.active "} {"model":"class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)\n class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)\n class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)\n class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)\n class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)\n class Date(today(): Date, durationInDays(d: Date): Integer)\n class Max1GB()\n class Max10GB()\n class Max100GB()\n association Customer 'customer' -- 'bill' Bill\n association Customer 'customer' -- 'service' Service\n association Customer 'customer 1..*' -- 'provider' Provider\n association Customer 'customer' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'service' Service\n association SurfRecord 'surfRecord 1..*' -- 'provider' Provider\n association Provider 'provider' -- 'services 1..*' Service\n association Service <|-- Max1GB\n association Service <|-- Max10GB\n association Service <|-- Max100GB","specification":"Each customer must have a unique ID.","ocl":"context Customer inv: self.allInstances()->isUnique(self.id)"} {"model":"class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)\n class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)\n class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)\n class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)\n class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)\n class Date(today(): Date, durationInDays(d: Date): Integer)\n class Max1GB()\n class Max10GB()\n class Max100GB()\n association Customer 'customer' -- 'bill' Bill\n association Customer 'customer' -- 'service' Service\n association Customer 'customer 1..*' -- 'provider' Provider\n association Customer 'customer' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'surfRecord' SurfRecord\n association Bill 'bill' -- 'service' Service\n association SurfRecord 'surfRecord 1..*' -- 'provider' Provider\n association Provider 'provider' -- 'services 1..*' Service\n association Service <|-- Max1GB\n association Service <|-- Max10GB\n association Service <|-- Max100GB","specification":"A customer can only view his own downloadrate","ocl":"context SurfRecord::getRate():Integer pre perm1: environment.caller.oclAsType(oclLib.OclAny) = self.customer.oclAsType(oclLib.OclAny) pre perm1:  environment.caller = self.customer"}