Lesson 7: Composition & Subsetting
The Parts Tree
In SysML v1, defining a system variant (like a "Sports Car" versus a generic "Vehicle") often required complex Generalization Sets or heavily Redefined Properties. You had to draw many relationship lines to show ownership and inheritance.
In SysML v2, we simplify this using Nesting (Composition) and Subsetting. This creates what methodologists call a Parts Tree—a logical hierarchy where specific parts designate members of, or identify items belonging to, a broader definition.
Visualizing the Shift: The "Black Diamond" vs. Curly Braces
To understand SysML v2, we must look at how it handles the most common structural concept: Composition.
1. SysML v1 (The Diagrammatic Way) To show that a Vehicle owns an Engine, you had to draw a line with a solid Black Diamond on the parent side.
- Visual: Vehicle ◆────── engine
- Constraint: To see the full hierarchy, you often had to trace these lines across multiple disjointed Block Definition Diagrams (BDDs).
2. SysML v2 (The Graphical-Textual Hybrid) You no longer have to manually draw the lines, but the black diamond doesn't disappear! Instead, you can simply type textual nesting using curly braces { }, and add the code block to create a Tree View; SysModeler will generate the view complete with the standard black diamonds.
- Textual code:
package VehicleTreeView {
part def SimpleVehicle {
part engine; // Defaults to a multiplicity of [1]
part wheels[4]; // Explicitly set to exactly 4 wheels
}
view def 'Part Structure View' {
import Views::*;
filter (@SysML::PartDefinition or @SysML::PartUsage);
render asTreeDiagram;
}
view 'vehicle structure view' : 'Part Structure View' {
expose SimpleVehicle::**;
}
}- Graphical notation:

Building the Parts Hierarchy
Here is the structurally valid code. Notice how we explicitly use [4] to satisfy the parent's generic requirement for 2..* wheels.
Textual Code:
package VehicleHierarchy {
// 1. The Generic Definitions
part def Engine;
part def V8_Engine :> Engine;
part def Wheel;
// 2. The Abstract Base
abstract part def Vehicle {
// Parent Requirement: Minimum 2 wheels, Minimum 1 engine
abstract part engines : Engine[1..*];
abstract part wheels : Wheel[2..*];
}
// 3. The Specific Variant
part def SportsCar :> Vehicle {
// We specify [4] to satisfy the parent's [2..*] requirement.
part carWheels : Wheel[4] subsets wheels;
// We identify the specific engine type
// 'subsets' implies this V8 is the designated member from the generic 'engines' list.
part mainEngine : V8_Engine subsets engines;
}
}Graphical Notation:


Deep Dive: The Nuance of subsets
- Abstract Definitions: We defined
abstract part engines. Marking the usage as abstract signals that these are architectural placeholders intended to be fulfilled via subsetting. They prevent direct realization by design intent until the definition is made specific in a subclass. subsetsdesignates Membership: InSportsCar, we definedpart mainEngine. By addingsubsets engines, we assert thatmainEngineis identified as a member of the inheritedenginescollection.- Multiplicity Logic: In SysML v2, omitting multiplicity defaults to
[1..1]only if the usage does not have any explicit owned subsettings or redefinitions. If we wrotepart carWheels subsets wheels;without a number, it would inherit the parent's multiplicity ([2..*]). We write[4]to be specific.
💡 V1 vs. V2 Cheat Sheet
| SysML v1 | SysML v2 |
|---|---|
| Composite Association (Black Diamond Line) | Textual nesting { } AND Graphical Black Diamond |
Generalization Sets / {subsets} constraint | Native subsets keyword (or the :> symbol) |
| Redefining properties to change types | Native redefines keyword (or the :>> symbol) |
Next Lesson
We will look at Ports. In v1, we had "Standard Ports," "Flow Ports," and "Proxy Ports." In v2, we just have Ports, and they are much simpler interaction points defined by a port def.