Skip to content
SysML v2 (structure) templates

Teaching Case — A Redefinition That Redefined Nothing

A redefinition is the one construct where a typo does not fail. `part redefines engien : TurboEngine;` does not replace the inherited `engine` — it silently declares a SECOND feature beside it, so the specialized vehicle has two engines. The compartment lists a part called `engien` in exactly the font it would list a correct one, and the inherited engine is not drawn at all because inherited features usually are not. The second finding here is the sibling defect: a redefinition that widens the multiplicity it replaces, so the specialization stops requiring what its supertype required.

Template previewSysML v2 (structure)
VehiclesinterconnectionSportVehicleinteriorengien: TurboEnginewheels: Wheel[0..*]engine: Engine2 statements in this model contradict others — over 5 definitions, 4features and 0 connections. 8 of the 13 checks had nothing to run on.ERROR`Vehicles::SportVehicle::engien` redefines `engien`, and nothing `SportVehicle`specializes declares a feature by that name. It did not replace anything — itdeclared a SECOND feature beside whatever it meant to replace, and thecompartment lists it exactly as it would list a correct one. The supertypes do…ERROR`Vehicles::SportVehicle::wheels` widens `Vehicle::wheels` rather thannarrowing it: `[0..*]` lowers the floor from 4 to 0, so this definition no longerrequires what its supertype required; `[0..*]` raises the ceiling from 4 to *, sothis definition permits more than its supertype does. A specialization that…GAPNothing is connected here, so there was no end to resolve.GAPNo connection here joins two ports of one definition, so there was noconjugation to check.GAPNo connection joins two related port definitions that share a directed feature,so there was no direction to compare.GAPNo connection here names a definition with declared ends, so there was no endorder or arity to check.GAPNo flow is declared here, so there was no direction to check.GAPNo flow here declares a payload, so there was nothing to compare against adestination.GAPNo part here declares a port, so there was no connection point to check.GAPNo composite part here declares a boundary port that accepts anything, sothere was no arrival to route.OKAll 6 declared types resolve to a definition in this document, so every checkbelow had the definition it needed to read.OKThe composition tree over 5 part definitions is acyclic, so every definition herecan be built. References were excluded, correctly: a reference cycle is anordinary bidirectional association.OKEvery line was read and no cap bit: the 5 definitions above are the wholedocument, so the counts are totals rather than floors.

Make it your own.

package Vehicles {

  part def Engine;
  part def TurboEngine :> Engine;
  part def Wheel;

  part def Vehicle {
    part engine : Engine;
    part wheels : Wheel[4];
  }

  part def SportVehicle :> Vehicle {
    // Redefines nothing. `Vehicle` declares `engine`, not `engien`, so
    // this declares a new feature and the inherited one survives beside it.
    part redefines engien : TurboEngine;

    // A widening, not a narrowing: the supertype requires exactly four
    // wheels and this permits none. Same compartment row, four characters
    // different.
    part redefines wheels : Wheel[0..*];
  }
}