Dataset Viewer
Auto-converted to Parquet Duplicate
model
stringclasses
13 values
specification
stringlengths
18
187
ocl
stringlengths
36
305
class Player() class Match(startDate: Date, endDate: Date, playMove(p,m), getScore()) class Tournament(name: String, startDate: Date, endDate: Date, acceptPlayer(p), removePlayer(p), schedule()) association Match 'matches *' -- 'tournament 1' Tournament association Match 'matches *' -- 'players *' Player associati...
All Matches in a Tournament occur within the Tournament's time frame.
context Tournament inv: self.matches->forAll(m:Match | m.startDate.after(self.startDate) and m.endDate.before(self.endDate))
class Player() class Match(startDate: Date, endDate: Date, playMove(p,m), getScore()) class Tournament(name: String, startDate: Date, endDate: Date, acceptPlayer(p), removePlayer(p), schedule()) association Match 'matches *' -- 'tournament 1' Tournament association Match 'matches *' -- 'players *' Player associati...
Each Tournament conducts at least one Match on the first day of the Tournament.
context Tournament inv: self.matches->exists(m:Match | m.startDate.equals(self.startDate))
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
Every customer who enters a loyalty program must be of legal age.
context Customer inv: self.age >= 18
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
Male customers must be approached using the title Mr..
context Customer inv: self.isMale implies self.title = Mr.
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The number of valid cards for every customer must be equal to the number of programs in which the customer participates.
context Customer inv: self.cards->select(valid=true)->size()=self.programs->size()
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The validFrom date of customer cards should be earlier than goodThru.
context CustomerCard inv: self.validFrom < self.goodThru
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The birth date of the owner of a customer card must not be in the future.
context CustomerCard inv: self.owner.dateOfBirth <> future
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The owner of a customer card must participate in at least one loyalty program.
context CustomerCard inv: self.owner.programs->size() >= 1
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
There must be at least one transaction for a customer card with at least 100 points.
context CustomerCard inv: self.transactions->select(point >= 100)->size()>= 1
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The service level of each membership must be a service level known to the loyalty program.
context Membership inv: self.currentLevel->includes(self.program.levels)
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The participants of a membership must have the correct card belonging to this membership.
context Membership inv: self.participants.cards->includes(self.card)
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The color of a membership's card must match the service level of the membership.
context Membership inv: self.card.color = self.currentLevel.name
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
Memberships must not have associated accounts.
context Membership inv: self.account->isEmpty()
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
Loyalty programs must offer at least one service to their customers.
context LoyaltyProgram inv: self.partners.deliveredServices->size() >= 1
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
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.
context LoyaltyProgram inv: partners.deliveredServices->forAll(pointsEarned = 0 and pointsBurned = 0) implies Membership.account->isEmpty()
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The name of the first level must be Silver.
context LoyaltyProgram inv: self.levels->first().name = Silver
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
There must exist at least one service level with the name basic.
context LoyaltyProgram inv: self.level->exists(name = 'basic')
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The number of participants in a loyalty program must be less than 10: ,000.
context LoyaltyProgram inv: self.participants->size()<10000
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The number of the loyalty account must be unique within a loyalty program.
context LoyaltyProgram inv: self.Membership.account->isUnique(acc|acc.numbers)
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The names of all customers of a loyalty program must be different.
context LoyaltyProgram inv: self.participants.name->forAll(c1,c2|c1.name<>c2.name)
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The maximum age of participants in loyalty programs is 70.
context LoyaltyProgram inv: self.participants->forAll(age<= 70)
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
There may be only one loyalty account that has a number lower than 10: ,000.
context LoyaltyProgram inv: self.Membership.account->one(number < 10,000)
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
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.
context ProgramPartner inv: self.numberOfCustomers=programs.participants->asSet()->size()
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
A maximum of 10: ,000 points may be earned using services of one partner.
context ProgramPartner inv: self.deliveredServices.pointsEarned<=10,000
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
All cards that generate transactions on the loyalty account must have the same owner.
context LoyaltyAccount inv: self.transactions.cards.owner->asSet()->size() = 1
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
If the points earned in a loyalty account is greater than zero: , there exists a transaction with more than zero points.
context LoyaltyAccount inv: points > 0 implies transactions->exists(t | t .points > 0)
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
There must be one transaction with exactly 500 points.
context Transaction inv: self.transaction->select(point = 500)->size()=1
class LoyaltyProgram(name: String, enroll(), getServices(): Service) class ProgramPartner(numberOfCustomers: Integer, name: String) class Membership() class Customer(name: String, title: String, isMale: Boolean, dateOfBirth: Integer, age: Integer, cAge()) class ServiceLevel(name: String) class Service(condition: B...
The available services for a service level must be offered by a partner of the loyalty program to which the service level belongs.
context ServiceLevel inv: self.program.partners->includesAll(self.availableServices.partner)
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The age of employees must be greater than or equal to 18
context Employee inv: self.age() >= 18
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The supervisor of an employee must be older than the employee
context Employee inv: self.supervisor->notEmpty() implies self.age() > self.supervisor.age()
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The salary of an employee cannot be greater than the salary of his/her supervisor
context Employee inv: self.supervisor->notEmpty() implies self.salary < self.supervisor.salary
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The hire date of employees must be greater than their birth date
context Employee inv: self.hireDate > self.birthDate
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The start date of an employe as manager of a department must be greater than his/her hire date
context Employee inv: self.manages->notEmpty() implies self.manages.startDate > self.hireDate
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
A supervisor must be hired before every employee s/he supervises
context Employee inv: self.subordinates->notEmpty() implies self.subordinates->forall( e | e.hireDate > self.hireDate )
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The manager of a department must be an employee of the department
context Department inv: self.worksFor->includes(self.manages.employee)
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The SSN of employees is an identifer (or a key)
context Employee inv: Employee.allInstances->forAll( e1, e2 | e1 <> e2 implies e1.SSN <> e2.SSN )
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The name and relationship of dependents is a partial identifer: they are unique among all dependents of an employee
context Employee inv: self.dependents->notEmpty() implies self.dependents->forAll( e1, e2 | e1 <> e2 implies ( e1.name <> e2.name or e1.relationship <> e2.relationship ))
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The location of a project must be in one of the locations of its department
context Project inv: self.controls.locations->includes(self.location)
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The attribute nbrEmployees in Department keeps the number of employees that works for the department
context Department inv: self.nbrEmployees = self.worksFor->size()
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
An employee works at most in 4 projects
context Employee inv: self.worksOn->size() <= 4
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
An employee may only work on projects controlled by the department in which s/he works
context Employee inv: self.worksFor.controls->includesAll(self.worksOn.project)
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
An employee works at least 30h/week and at most 50 h/week on all its projects
context Employee inv: let totHours: Integer = self.worksOn->collect(hours)->sum() in totHours >= 30 and totHours <=50
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
A project can have at most 2 employees working on the project less than 10 hours
context Project inv: self.worksOn->select( hours < 10 )->size() <= 2
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
Only department managers can work less than 5 hours on a project
context Employee inv: self.worksOn->select( hours < 5 )->notEmpty() implies Department.allInstances()->collect(manages.employee)-> includes(self)
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The only managers that can work less than 5 hours on a department project must be an employee of the department itself
context Employee inv: self.worksOn->select( hours < 5 )->notEmpty() implies self.worksFor.manages.employee=self
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
Employees without subordinates must work at least 10 hours on every project they work
context Employee inv: self.subordinates->isEmpty() implies self.worksOn->forAll( hours >=10 )
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The manager of a department must work at least 5 hours on all projects controlled by the department
context Department inv: self.controls->forall( p:Project | self.manages.employee.worksOn->select(hours >= 5)->contains(p) )
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
An employee cannot supervise him/herself
context Employee inv: self.subordinates->excludes(self)
class Employee(SSN: Integer, firstName: String, lastName: String, birthDate: Date, sex: String, salary: Integer, address: String, hireDate: Date, age()) class Department(number: Integer, name: String, locations: String, nbrEmployees: Integer) class Project(number: Integer, name: String, location: String) class Manag...
The supervision relationship must not be cyclic
context Employee def: allSubordinates = self.subordinates->union(self->subordinates->collect(e:Employee | e.allSubordinates)) inv: self.allSubordinates->exludes(self)
class Date(date: String) class Car(regNum: String) class CarGroup(category: String) class Branch(address: String) class Quote(value: Integer) class Rental(id: String, price: Real, state: String, startingDate: Date, endingDate: Date) class Customer(id: String, name: String, birthday: Date, licenseExpData: Date, pr...
Rental ending date must be later or equal than starting date
context Rental inv: self.startingdate <= self.endingDate
class Date(date: String) class Car(regNum: String) class CarGroup(category: String) class Branch(address: String) class Quote(value: Integer) class Rental(id: String, price: Real, state: String, startingDate: Date, endingDate: Date) class Customer(id: String, name: String, birthday: Date, licenseExpData: Date, pr...
On Mondays the agency is close (so no rentals starting on a Monday)
context Rental inv: not self.startingDate.dayOfTheWeek()<>DayOftheWeek::Monday
class Date(date: String) class Car(regNum: String) class CarGroup(category: String) class Branch(address: String) class Quote(value: Integer) class Rental(id: String, price: Real, state: String, startingDate: Date, endingDate: Date) class Customer(id: String, name: String, birthday: Date, licenseExpData: Date, pr...
Minimum duration of a rental is 10 hours
context Rental inv: (self.endDate - self.startingDate).hours() >= 10
class Date(date: String) class Car(regNum: String) class CarGroup(category: String) class Branch(address: String) class Quote(value: Integer) class Rental(id: String, price: Real, state: String, startingDate: Date, endingDate: Date) class Customer(id: String, name: String, birthday: Date, licenseExpData: Date, pr...
Last Friday of each month the agency is closed
context Rental inv: not self.startingdate = self.startingdate.getMonth().last('Friday')
class Airport(name: String) class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer) class Airline(name: String) class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight)) association Airport 'origin 1' -- 'departingFlights *' Flight association Airp...
All flight objects must have a duration attribute that is less than four
context Flight inv: self.duration < 4
class Airport(name: String) class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer) class Airline(name: String) class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight)) association Airport 'origin 1' -- 'departingFlights *' Flight association Airp...
The maximum number of passengers on any flight may not exceed 1000
context Flight inv: self.maxNrPassenger <= 1000
class Airport(name: String) class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer) class Airline(name: String) class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight)) association Airport 'origin 1' -- 'departingFlights *' Flight association Airp...
For every passenger the age attribute must be greater than or equal to the class attribute minAge
context Passenger inv: self.age >= self.minAge
class Airport(name: String) class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer) class Airline(name: String) class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight)) association Airport 'origin 1' -- 'departingFlights *' Flight association Airp...
The duration attribute of all flight objects must be equal to the difference between the arrivalTime attribute and the departTime attribute
context Flight inv: self.duration = self.arrivalTime - self.departTime
class Airport(name: String) class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer) class Airline(name: String) class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight)) association Airport 'origin 1' -- 'departingFlights *' Flight association Airp...
The airport from which a flight is leaving is different from the destination airport
context Flight inv: self.origin <> self.destination
class Airport(name: String) class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer) class Airline(name: String) class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight)) association Airport 'origin 1' -- 'departingFlights *' Flight association Airp...
For every flight the name of the airport from which it is leaving must be 'Amsterdam'
context Flight inv: self.origin.name = 'Amsterdam'
class Airport(name: String) class Flight(departTime: Date, arrivalTime: Date, duration: Date, maxNrPassenger: Integer) class Airline(name: String) class Passenger(minAge: Integer, age: Integer, needsAssistance: Boolean, book(f: Flight)) association Airport 'origin 1' -- 'departingFlights *' Flight association Airp...
For every flight the name of the airline must be 'KLM'
context Flight inv: self.airline.name = 'KLM'
class Unit(name: String, symbol: String, description: String, definitionURI: String) class SystemOfUnits(name String, symbol: String, description: String, definitionURI: String) class SystemOfQuantities(name String, symbol: String, description: String, definitionURI: String) class QuantityKind(name String, symbol: S...
The referenceUnit shall not be a PrefixedUnit
context PrefixedUnit inv: not referenceUnit->oclIsTypeOf(PrefixedUnit)
class Unit(name: String, symbol: String, description: String, definitionURI: String) class SystemOfUnits(name String, symbol: String, description: String, definitionURI: String) class SystemOfQuantities(name String, symbol: String, description: String, definitionURI: String) class QuantityKind(name String, symbol: S...
In a coherent system of units, there is only one base unit for each base quantity.
context SystemOfUnits inv: self.systemOfQuantities.baseQuantityKind.size() = self.baseUnit->size() = 1
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
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.
context Product inv isNat: self.stock >= 0
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
The Product id is unique.
context Product inv idUnique: Product::allInstances()->forAll(p1:Product, p2:Product | p1.id <> p2.id)
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
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.
context Order inv isNat: self.quantity >= 0
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
The state of an Order should either be `pending' or `invoiced'.
context Order inv stateRange: (self.state = 'pending') or (self.state = 'invoiced')
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
The Order id is unique.
context Order inv idUnique: Order::allInstances()->forAll(o1:Order, o2:Order | o1.id <> o2.id)
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
order(...) function creates a new Order
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
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
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.
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
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
cancel() function cancels order as an opposite operation to invoice order
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
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
supply(...) function adds quantity of the product to the stock
context Product::supply(qty:Integer):Boolean pre: qty > 0 post: self.stock = self.stock@pre + qty
class Order(id: Integer, quantity: Integer, state: String, Order(prd: Product, qty: Integer): OclVoid, cancel(): Boolean, invoice(): Boolean) class Product(id: Integer, stock: Integer, Product(): Boolean, supply(qty: Integer): Boolean, release(qty: Integer): Boolean) association Order 'order 1' --> 'product 1' Produc...
release(...) removes quantity of the product from the stock
context Product::release(qty:Integer):Boolean pre: self.stock >= qty post: self.stock = self.stock@pre - qty
class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House)) class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date) class House(value: Money) association Person 'owner 1' -- 'houses *' House association House 'security 1' -- 'mortgages *' Mortgage associ...
The start date for any mortgage must be before the end date.
context Mortgage: inv: startDate < endDate
class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House)) class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date) class House(value: Money) association Person 'owner 1' -- 'houses *' House association House 'security 1' -- 'mortgages *' Mortgage associ...
A person may have a mortgage on a house only if that house is owned by the person.
context Mortgage: inv: self.security.owner = self.borrower
class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House)) class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date) class House(value: Money) association Person 'owner 1' -- 'houses *' House association House 'security 1' -- 'mortgages *' Mortgage associ...
A person may have mortgage on a house only if that house is owned by the person (use Person as context).
context Person: inv: self.mortgages.security.owner->forAll(p : Person | p = self)
class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House)) class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date) class House(value: Money) association Person 'owner 1' -- 'houses *' House association House 'security 1' -- 'mortgages *' Mortgage associ...
The social security number of all persons must be unique (use House as a context).
context Person: inv: Person::allInstance()->forAll(p1,p2 : Person | p1<>p2 implies p1.socSecNr <> p2.socSecNr)
class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House)) class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date) class House(value: Money) association Person 'owner 1' -- 'houses *' House association House 'security 1' -- 'mortgages *' Mortgage associ...
The social security number of all persons must be unique (use Person as a context).
context Person::getMortgage(sum:Money, security:House) pre: self.mortgages.monthlyPayment->sum() <= self.salary * 0.30
class Person(socSecNr: Integer, salary: Money, getMortgage(sum: Money, security: House)) class Mortgage(principal: Money, monthlyPayment: Money, startDate: Date, endDate: Date) class House(value: Money) association Person 'owner 1' -- 'houses *' House association House 'security 1' -- 'mortgages *' Mortgage associ...
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).
context Person::getMortgage(sum:Money, security:House) pre: security.value >= (security.mortgages.principal->sum() + sum)
class Train(identifier: String, numOfWagons: Integer, numOfEngines: Integer, weight: Integer) class Wagon(weight: Integer, smoking: Boolean, currentLoad: Integer, capacity: Integer) association Train 'train 1' -- 'wagon *' Wagon association Wagon 'succ 0..1' -- 'pred 0..1' Wagon
All the trains will have the same number of wagons.
context Train: inv: self.wagon -> size() >= 1
class Train(identifier: String, numOfWagons: Integer, numOfEngines: Integer, weight: Integer) class Wagon(weight: Integer, smoking: Boolean, currentLoad: Integer, capacity: Integer) association Train 'train 1' -- 'wagon *' Wagon association Wagon 'succ 0..1' -- 'pred 0..1' Wagon
A wagon and its successor wagon should belong to the same train.
context Wagon: inv: self.succ -> notEmpty() implies self.succ.train = self.train
class Train(identifier: String, numOfWagons: Integer, numOfEngines: Integer, weight: Integer) class Wagon(weight: Integer, smoking: Boolean, currentLoad: Integer, capacity: Integer) association Train 'train 1' -- 'wagon *' Wagon association Wagon 'succ 0..1' -- 'pred 0..1' Wagon
The current load of a wagon cannot exceed its capacity
context Train: inv: Train.allInstances -> forAll(x:Train,y:Train | x.wagon->size() = y.wagon->size() )
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
Value of attribute noEmployees in instances of Company must be less than or equal to 50
context Company inv: self.noEmployees <= 50
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
The stock price of companies is greater than 0
context Company inv: self.stockPrice() > 0
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
Income of a person is the sum of the salaries of her jobs
context Person::income(): Integer body: self.job.salary->sum()
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
descendants() obtains the direct and indirect descendants of a person
context Person::descendants(): Set body: result = self.children->union(self.children->collect(c | c.descendants()))
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
Only married women can have a maiden name
context Person inv: self.maidenName <> `' implies self.gender = Gender::female and self.isMarried = true
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
A person is currently married to at most one person
context Person inv: self.marriage[wife]->select(m | m.ended = false)->size()=1 and self.marriage[husband]->select(m | m.ended = false)->size()=1
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
currentSpouse() selects the current spouse of a person
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
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
There are at most 100 persons
context Person inv: Person.allInstances()->size() <= 100
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
A company has at least one employee older than 50
context Company inv: self.employees->select(age > 50)->notEmpty()
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
The collection of employees of a company who are less than 18 years old is empty
context Company inv: self.employees->reject(age>=18)->isEmpty()
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
The age of each employee is less than or equal to 65
context Company inv: self.employees->forAll(age <= 65)
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
All instances of persons have unique names
context Person inv: Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name )
enumeration Gender(male, female) class Person(firstName: String, lastName: String, gender: Gender, birthDate: Date, age: Integer, isMarried: Boolean, maidenName: String, isUnemployed: Boolean, income(): Integer, currentSpouse(): Person, descendants(): Set) class Bank(accountNo: Integer) class Job(title: String, star...
The firstName of at least one employee is equal to 'Jack'
context Company inv: self.employees->exists(firstName = 'Jack')
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 ...
A vehicle owner must be at least 18 years old
context Vehicle inv: self. owner. age >= 18
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 ...
Nobody has more than 3 vehicles
context Person inv: self.fleet->size <= 3
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 ...
All cars of a person are black
context Person inv: self.fleet->forAll(v | v.colour = #black)
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 ...
Nobody has more than 3 black vehicles
context Person inv: self.fleet->forAll(v | v.colour = #black) -> size <= 3
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 ...
A person younger than 18 owns no cars
context Person inv: age<18 implies self.fleet->forAll(v | not v.oclIsKindOf(Car))
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 ...
There is a red car
context Car inv: Car.allInstances()->exists(c | c.colour=#red)
End of preview. Expand in Data Studio

Introduction

uml_nl_ocl_100 is a small size dataset containing ca. 100 OCL constraints and their corresponding plantUML models, contraint specification in natural language.

This dataset is adapted from the models_dataset by Abukhalaf et al. We removed all empty constraints and merged class and association information into one piece for each model.

The original dataset including model files is avaible here: https://doi.org/10.5281/zenodo.7749795

Usage

Generation of OCL constraints based on model information and natural language based constraint specification. Generation of natural language description for OCL constraints and model information.

License

The dataset is available under the Creative Commons NonCommercial (CC BY-NC 4.0).

Downloads last month
6