{ * File: W18.sml.txt * Author: Michael Schrefl, Bernd Neumayr, Manfred Jeusfeld * Created: 13-Oct-2013/M.Jeusfeld (13-Oct-2013/M.Jeusfeld) * ------------------------------------------------------ * like E18 but use unqualified numbers as mileage values; * a violation of axiom i2 is detected * } Mileage in ALABEL end LinearMeasure in OBJECT end MetricLinearMeasure in OBJECT with IN c1: LinearMeasure end ImperialLinearMeasure in OBJECT with IN c1: LinearMeasure end km in OBJECT with IN c1: MetricLinearMeasure end m in OBJECT with IN c1: MetricLinearMeasure end 12 in OBJECT with IN c1: km IN c2: m end 12000 in OBJECT with IN c1: m end miles in OBJECT with IN c1: ImperialLinearMeasure end 7.45 in OBJECT with IN c1: miles IN c2: m IN c3: km end {* Since VolvoV50 has two Mileage attributes, we need to define at an upper level a more abstract version of Mileage from which the two Mileages of VolvoV50 are instantiated (or specialized) *} CarModel in OBJECT with linkDR m1: LinearMeasure end CarModel!m1 with sourcelevel s: 2 targetlevel t: 3 label l: Mileage end VolvoV50 in OBJECT with IN c1: CarModel linkDR m1: MetricLinearMeasure linkDR m2: ImperialLinearMeasure end VolvoV50!m1 with sourcelevel s: 1 targetlevel t: 2 label l: Mileage end VolvoV50!m2 with sourcelevel s: 1 targetlevel t: 2 label l: Mileage end myV50 in OBJECT with IN c1: VolvoV50 linkDR m1: 12 linkDR m2: 7.45 linkDR m3: 12000 end myV50!m1 with sourcelevel s: 0 targetlevel t: 0 label l: Mileage end myV50!m2 with sourcelevel s: 0 targetlevel t: 0 label l: Mileage end myV50!m3 with sourcelevel s: 0 targetlevel t: 0 label l: Mileage end