model
stringclasses 13
values | specification
stringlengths 18
187
| ocl
stringlengths 36
305
|
---|---|---|
enumeration Colour(black(): Colour, white(): Colour, red(): Colour)
class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)
class Vehicle(colour: Colour)
class Car()
class Bike()
association Person 'owner 1' -- 'fleet *' Vehicle: ownership
association Car --|> Vehicle
association Bike --|> Vehicle | If setAge(. . . ) is called with a non-negative argument then the argument becomes the new value of the attribute age | context Person::setAge(newAge:int) pre: newAge >= 0 post: self.age = newAge |
enumeration Colour(black(): Colour, white(): Colour, red(): Colour)
class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)
class Vehicle(colour: Colour)
class Car()
class Bike()
association Person 'owner 1' -- 'fleet *' Vehicle: ownership
association Car --|> Vehicle
association Bike --|> Vehicle | Calling birthday() increments the age of a person by 1 | context Person::birthday() post: self.age = self.age@pre + 1 |
enumeration Colour(black(): Colour, white(): Colour, red(): Colour)
class Person(name: String, age: Integer, getName(): String, birthday(), setAge(newAge:int): Integer)
class Vehicle(colour: Colour)
class Car()
class Bike()
association Person 'owner 1' -- 'fleet *' Vehicle: ownership
association Car --|> Vehicle
association Bike --|> Vehicle | Calling getName() delivers the value of the attribute name | context Person::getName() post: result = name |
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)
class Prescription(drug: String, amount: Integer, creator: Doctor)
class MedicalInfo(description: String, creator: Doctor, open: Boolean)
class Patient(name: String)
class Doctor()
class Pharmacist()
association HealthRecord 'record 1' -- 'owner 1' Patient
association HealthRecord 'record 1' -- 'prescription *' Prescription
association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo
association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo
association Patient 'treats *' <|-- 'treatedBy *' Doctor
association Patient 'treats *' <|-- Pharmacist | You can only add a prescription if you have previously created the corresponding MedicalInfo | context HealthRecord::createMedicalInfo(p:MedicalInfo,prescription:Prescription):HealthRecord pre perm1: p.creator = environment.caller |
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)
class Prescription(drug: String, amount: Integer, creator: Doctor)
class MedicalInfo(description: String, creator: Doctor, open: Boolean)
class Patient(name: String)
class Doctor()
class Pharmacist()
association HealthRecord 'record 1' -- 'owner 1' Patient
association HealthRecord 'record 1' -- 'prescription *' Prescription
association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo
association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo
association Patient 'treats *' <|-- 'treatedBy *' Doctor
association Patient 'treats *' <|-- Pharmacist | To create a MedicalInfo about a patient you need to be one of its doctors | context HealthRecord::createMedicalInfo(description:String):HealthRecord post perm2: self.owner.treatedBy.oclAsType(OclAny) ->includes (environment.caller.oclAsType(OclAny)) |
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)
class Prescription(drug: String, amount: Integer, creator: Doctor)
class MedicalInfo(description: String, creator: Doctor, open: Boolean)
class Patient(name: String)
class Doctor()
class Pharmacist()
association HealthRecord 'record 1' -- 'owner 1' Patient
association HealthRecord 'record 1' -- 'prescription *' Prescription
association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo
association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo
association Patient 'treats *' <|-- 'treatedBy *' Doctor
association Patient 'treats *' <|-- Pharmacist | To create a MedicalInfo, you need to be a doctor (not necessarily the one of the patient) | context HealthRecord::createMedicalInfo(description:String):HealthRecord pre perm3: environment.caller.role = 'Doctor' |
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)
class Prescription(drug: String, amount: Integer, creator: Doctor)
class MedicalInfo(description: String, creator: Doctor, open: Boolean)
class Patient(name: String)
class Doctor()
class Pharmacist()
association HealthRecord 'record 1' -- 'owner 1' Patient
association HealthRecord 'record 1' -- 'prescription *' Prescription
association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo
association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo
association Patient 'treats *' <|-- 'treatedBy *' Doctor
association Patient 'treats *' <|-- Pharmacist | The amount of a prescription must not be too large | context Prescription inv AmountNotTooLarge: self.amount < 1000 |
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)
class Prescription(drug: String, amount: Integer, creator: Doctor)
class MedicalInfo(description: String, creator: Doctor, open: Boolean)
class Patient(name: String)
class Doctor()
class Pharmacist()
association HealthRecord 'record 1' -- 'owner 1' Patient
association HealthRecord 'record 1' -- 'prescription *' Prescription
association HealthRecord 'record 1' -- 'medicalinfo *' MedicalInfo
association Prescription 'prescription *' -- 'medicalinfo 1' MedicalInfo
association Patient 'treats *' <|-- 'treatedBy *' Doctor
association Patient 'treats *' <|-- Pharmacist | Closed medical infos can only be read by the doctor which created it | context HealthRecord::readMedicalInfo():MedicalInfo post perm4: resultresult.creator.oclAsType(OclAny) = environment.caller.oclAsType(OclAny) |
class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)
class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)
class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)
class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)
class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)
class Date(today(): Date, durationInDays(d: Date): Integer)
class Max1GB()
class Max10GB()
class Max100GB()
association Customer 'customer' -- 'bill' Bill
association Customer 'customer' -- 'service' Service
association Customer 'customer 1..*' -- 'provider' Provider
association Customer 'customer' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'service' Service
association SurfRecord 'surfRecord 1..*' -- 'provider' Provider
association Provider 'provider' -- 'services 1..*' Service
association Service <|-- Max1GB
association Service <|-- Max10GB
association Service <|-- Max100GB | For the service ``1GB'' the free download variable should be invariant and be set to 1. | context Max1GB inv : self.freedownload = 1024 |
class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)
class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)
class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)
class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)
class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)
class Date(today(): Date, durationInDays(d: Date): Integer)
class Max1GB()
class Max10GB()
class Max100GB()
association Customer 'customer' -- 'bill' Bill
association Customer 'customer' -- 'service' Service
association Customer 'customer 1..*' -- 'provider' Provider
association Customer 'customer' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'service' Service
association SurfRecord 'surfRecord 1..*' -- 'provider' Provider
association Provider 'provider' -- 'services 1..*' Service
association Service <|-- Max1GB
association Service <|-- Max10GB
association Service <|-- Max100GB | A customer can only have a service from his service provider | context Provider inv onlyOfferedService: self.services->includesAll(self.customer->collect(c:Customer | c.service)->asSet()) |
class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)
class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)
class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)
class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)
class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)
class Date(today(): Date, durationInDays(d: Date): Integer)
class Max1GB()
class Max10GB()
class Max100GB()
association Customer 'customer' -- 'bill' Bill
association Customer 'customer' -- 'service' Service
association Customer 'customer 1..*' -- 'provider' Provider
association Customer 'customer' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'service' Service
association SurfRecord 'surfRecord 1..*' -- 'provider' Provider
association Provider 'provider' -- 'services 1..*' Service
association Service <|-- Max1GB
association Service <|-- Max10GB
association Service <|-- Max100GB | 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. | context Bill inv: self.surfRecord.downloadRate <= self.service.freedownload implies self.amount = self.service.price |
class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)
class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)
class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)
class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)
class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)
class Date(today(): Date, durationInDays(d: Date): Integer)
class Max1GB()
class Max10GB()
class Max100GB()
association Customer 'customer' -- 'bill' Bill
association Customer 'customer' -- 'service' Service
association Customer 'customer 1..*' -- 'provider' Provider
association Customer 'customer' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'service' Service
association SurfRecord 'surfRecord 1..*' -- 'provider' Provider
association Provider 'provider' -- 'services 1..*' Service
association Service <|-- Max1GB
association Service <|-- Max10GB
association Service <|-- Max100GB | If the bill has not been paid for 30 days, the customer's flag active will be set to false | 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 |
class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)
class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)
class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)
class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)
class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)
class Date(today(): Date, durationInDays(d: Date): Integer)
class Max1GB()
class Max10GB()
class Max100GB()
association Customer 'customer' -- 'bill' Bill
association Customer 'customer' -- 'service' Service
association Customer 'customer 1..*' -- 'provider' Provider
association Customer 'customer' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'service' Service
association SurfRecord 'surfRecord 1..*' -- 'provider' Provider
association Provider 'provider' -- 'services 1..*' Service
association Service <|-- Max1GB
association Service <|-- Max10GB
association Service <|-- Max100GB | Each customer must have a unique ID. | context Customer inv: self.allInstances()->isUnique(self.id) |
class Customer(id: Integer, name: String, address: String, active: Boolean, changeService(s: Service): Boolean)
class Bill(send_date: Date, paid_date: Date, amount: Real, confirm_payment(): Boolean)
class SurfRecord(downloadRate: Integer, setRate(rate: Integer): Integer, getRate(): Integer)
class Provider(disableService(): OclVoid, enableService(): OclVoid, disableCustomer(): OclVoid, reenableCustomer(c: Customer): OclVoid, sendBill(): OclVoid)
class Service(price: Real, QoS: Integer, freedownload: Integer, provide_service(): Boolean)
class Date(today(): Date, durationInDays(d: Date): Integer)
class Max1GB()
class Max10GB()
class Max100GB()
association Customer 'customer' -- 'bill' Bill
association Customer 'customer' -- 'service' Service
association Customer 'customer 1..*' -- 'provider' Provider
association Customer 'customer' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'surfRecord' SurfRecord
association Bill 'bill' -- 'service' Service
association SurfRecord 'surfRecord 1..*' -- 'provider' Provider
association Provider 'provider' -- 'services 1..*' Service
association Service <|-- Max1GB
association Service <|-- Max10GB
association Service <|-- Max100GB | A customer can only view his own downloadrate | context SurfRecord::getRate():Integer pre perm1: environment.caller.oclAsType(oclLib.OclAny) = self.customer.oclAsType(oclLib.OclAny) pre perm1: environment.caller = self.customer |