1. Leonardo Enrique Ibarra Becerra<br />Maestría en Sistemas y Computación<br />Desarrollo de Software Basado en Modelos<br />Purpose<br />The purpose of this exercise is to master the Object Constraint Language<br />This example was taken from: Jos Warmer in the OMG Advanced UML Modelling Tutorial. www.omg.org/docs/omg/01-03-04.ppt<br />General Class Diagram<br />Exercise 1<br />1. All flight objects must have a duration attribute that is less than four<br />context Flight inv:<br />self.duration < 4<br />2. The maximum number of passengers on any flight may not exceed 1000<br />context Flight inv:<br />self.maxNrPassengers <= 1000<br />ó<br />context Flight inv:<br />self.passengers->size() <= 1000<br />3. For every passenger the age attribute must be greater than or equal to the class attribute minAge<br />context Flight inv:<br />self.age >= self.minAge<br />4. The duration attribute of all flight objects must be equal to the difference between the arrivalTime attribute and the departTime attribute<br />context Flight inv:<br />self.duration = self.arrivalTime – self.departTime<br />5. The airport from which a flight is leaving is different from the destination airport.<br />context Flight inv:<br />self.origin <> self.destination<br />6. For every flight the name of the airport from which it is leaving, must be “Amsterdam”.<br />context Flight inv:<br />self.origin.name = ‘Amsterdam’<br />7. For every flight the name of the airline must be “KLM”.<br />context Flight inv:<br />self.airline.name = ‘KLM’<br />