Complete table view examples
Each example on this page is a small model and a complete table view for the Syside VS Code Extension, showing one way to build a view. Download an example as a ZIP archive or copy its source from the page.
The examples import the SysideViews library, which is not included in the downloads. Open an example from the SysMLv2 Views panel.
Combine several kinds of column
A small rover model rendered as a table with six columns, each of a different kind.
TableViewOverview.sysml
// Example: Table View Overview
package Rover {
part def Chassis {
doc
/* Structural frame carrying every subsystem. */
attribute mass;
}
part def Battery {
doc
/* Removable pack behind the rear axle. */
attribute capacity;
attribute mass;
}
part def Camera {
attribute mass;
}
part def Wheel {
attribute diameter;
attribute mass;
}
} // package Rover
package RoverContext {
private import Rover::*;
part def RoverAssembly {
part chassis : Chassis {
attribute :>> mass = 8.2;
}
part battery : Battery {
attribute :>> capacity = 5000.0;
attribute :>> mass = 1.4;
}
part navCamera : Camera;
part leftWheel : Wheel {
attribute :>> diameter = 0.35;
attribute :>> mass = 0.6;
}
part rightWheel : Wheel {
attribute :>> diameter = 0.35;
attribute :>> mass = 0.7;
}
}
} // package RoverContext
package RoverViews {
private import SysideViews::*;
view overviewTable : SV::TVD::TableView {
expose RoverContext::RoverAssembly::*;
attribute :>> maxRowHeight = 150;
view Part :> columnViews {
attribute :>> featureRepresentation :> ColRep::declaredName;
attribute :>> columnWidth = 120;
}
view Definition :> columnViews {
:>> columnFeature = DefinitionsFirst(baseViewElement);
attribute :>> featureRepresentation :> ColRep::declaredName;
}
view 'Mass (kg)' :> columnViews {
:>> columnFeature = NamedUsage(
baseViewElement,
"mass",
NameType::name,
UsageKind::attributeUsage
);
attribute :>> featureRepresentation :> ColRep::featureValue;
attribute :>> defaultValue = "(unset)";
}
view Attributes :> columnViews {
:>> columnFeature = UsageList(baseViewElement, UsageKind::attributeUsage);
attribute :>> featureRepresentation :> ColRep::name;
}
view Documentation :> columnViews {
:>> columnFeature = DefinitionsFirst(baseViewElement);
attribute :>> featureRepresentation :> ColRep::specificDocumentation;
attribute :>> defaultValue = "n/a";
attribute :>> TableViewDefinitions::TableView::columnViews::columnWidth = 160;
}
view 'Qualified Name' :> columnViews;
:>> TableViewDefinitions::TableView::columnOrder = (
Part, Definition, 'Mass (kg)', Attributes, Documentation, 'Qualified Name',
);
}
} // package RoverViews
Show a requirement hierarchy
A small requirement hierarchy opens as an expanded, collapsible
hierarchical table. The rows are the
requirement usages, nested as the model nests them, inherited requirements included,
and the first column carries the nesting. The ID and Description columns reach each
row’s definition with DefinitionsFirst(baseViewElement) and show its short name and
documentation. The view exposes RequirementContext::*::**, so the context itself is
not a row.
HierarchicalTableOverview.sysml
// Example: Hierarchical table overview
package DroneRequirements {
requirement def <'MISS-001'> MissionPerformance {
doc
/* The drone shall complete the delivery mission. */
}
requirement def <'SYS-001'> CruisingSpeed {
doc
/* The drone shall reach a cruising speed of at least 60 km/h. */
}
requirement def <'SYS-002'> OperationalRange {
doc
/* The drone shall have a minimum operational range of 30 km. */
requirement battery : BatteryCapacity;
}
requirement def <'SUB-001'> MotorPower {
doc
/* Each motor shall output at least 150 W continuously. */
}
requirement def <'SUB-002'> BatteryCapacity {
doc
/* The battery shall store at least 1 500 Wh of usable energy. */
}
item def RequirementContext {
requirement droneSystem : MissionPerformance {
requirement speed : CruisingSpeed {
requirement motor : MotorPower;
}
requirement range : OperationalRange {}
}
}
} // package DroneRequirements
package DroneRequirementsViews {
private import SysideViews::*;
view requirementsTree : TVD::HierarchicalTableView {
expose DroneRequirements::RequirementContext::*::**;
attribute :>> defaultCollapse = false;
view Name :>> hierarchicalColumn {
attribute :>> featureRepresentation :> ColRep::declaredName;
attribute :>> columnWidth = 188;
}
view ID :> columnViews {
:>> columnFeature = DefinitionsFirst(baseViewElement);
attribute :>> featureRepresentation :> ColRep::declaredShortName;
attribute :>> columnWidth = 110;
}
view Description :> columnViews {
:>> columnFeature = DefinitionsFirst(baseViewElement);
attribute :>> featureRepresentation :> ColRep::specificDocumentation;
attribute :>> defaultValue = "n/a";
attribute :>> columnWidth = 247;
}
:>> columnOrder = (Name, ID, Description);
}
} // package DroneRequirementsViews
Fan rows out twice over
Two chained UsageFan anchors fan rows out twice over: each part fans out into one row per port, and each
port fans on into one row per attribute. Cells above a fan are merged across the
fanned-out rows it produced, columns chain off either anchor, and a port with no
attributes shows the first fan-out level applying while the second comes up empty.
FanningOutRows.sysml
// Example: Fanning Out Rows
package PumpStation {
port def FluidPort {
attribute maxPressure;
attribute temperature;
}
port def DrainPort;
part def Station {
part pump {
port inlet : FluidPort {
attribute :>> maxPressure = 5.0;
attribute :>> temperature = 65.0;
}
port outlet : FluidPort;
}
part gauge {
port drain : DrainPort;
}
}
} // package PumpStation
package PumpStationViews {
private import SysideViews::*;
view portsTable : SV::TVD::TableView {
expose PumpStation::Station::*;
ports = UsageFan(baseViewElement, UsageKind::portUsage);
portAttributes = UsageFan(ports, UsageKind::attributeUsage);
view Part :> columnViews {
attribute :>> featureRepresentation :> ColRep::declaredName;
}
view Port :> columnViews {
:>> columnFeature = ports;
attribute :>> featureRepresentation :> ColRep::declaredName;
}
view 'Max Pressure' :> columnViews {
:>> columnFeature = NamedUsage(
ports,
"maxPressure",
NameType::name,
UsageKind::attributeUsage
);
attribute :>> featureRepresentation :> ColRep::featureValue;
attribute :>> defaultValue = "(unset)";
}
view Attribute :> columnViews {
:>> columnFeature = portAttributes;
attribute :>> featureRepresentation :> ColRep::name;
}
view Value :> columnViews {
:>> columnFeature = portAttributes;
attribute :>> featureRepresentation :> ColRep::featureValue;
attribute :>> defaultValue = "(unset)";
}
}
} // package PumpStationViews
Fan tree rows out
A hierarchical table combined with a
fan-out: an anchored UsageFan, shared by an
attribute-name and an attribute-value column, fans each part row out into one row
per attribute, including those the part inherits from its definition. A fanned tree
row becomes several fanned-out rows at the same tree position, with its child rows
hanging off the last of them. The definitions bind their values with
default, so each value can be edited from the part’s row.
FanOutInAHierarchicalTable.sysml
// Example: Fan-out in a hierarchical table
package Transmission {
part def Shaft {
attribute diameter default 32.0;
attribute length default 480.0;
}
part def Gearbox {
attribute ratio default 3.2;
attribute mass default 12.5;
part output : Shaft;
}
part def Driveline {
part gearbox : Gearbox;
}
}
package TransmissionViews {
private import SysideViews::*;
view drivelineAttributes : TVD::HierarchicalTableView {
expose Transmission::Driveline::*::**;
attribute :>> defaultCollapse = false;
attrs = UsageFan(baseViewElement, UsageKind::attributeUsage);
view Part :>> hierarchicalColumn {
attribute :>> featureRepresentation :> ColRep::declaredName;
}
view Attribute :> columnViews {
:>> columnFeature = attrs;
attribute :>> featureRepresentation :> ColRep::declaredName;
}
view Value :> columnViews {
:>> columnFeature = attrs;
attribute :>> featureRepresentation :> ColRep::featureValue;
}
}
}
Show each usage beside its definition
A hierarchical table whose rows are the
usages of a hybrid drivetrain, each beside the definition it is typed by. Rows are
features, so frontDrive and rearDrive
are two rows although both are typed by Motor. The Definition column navigates
to each row’s definition with DefinitionsFirst(baseViewElement), and
Owner(baseViewElement) names the definition each feature is declared in, such as
Cylinder for piston. The view exposes Hybrid::*::**, so Hybrid itself is not
a row and every row has a definition to show.
AccessingHierarchyUsages.sysml
// Example: Usages and their definitions
package Drivetrain {
part def Piston;
part def Cylinder {
part piston : Piston;
}
part def Engine {
part cyl : Cylinder;
}
part def Motor;
part def Hybrid {
part combustion : Engine;
part frontDrive : Motor;
part rearDrive : Motor;
}
}
package DrivetrainViews {
private import SysideViews::*;
view drivetrainTree : TVD::HierarchicalTableView {
expose Drivetrain::Hybrid::*::**;
attribute :>> defaultCollapse = false;
view Usage :>> hierarchicalColumn {
attribute :>> featureRepresentation :> ColRep::declaredName;
}
view Definition :> columnViews {
:>> columnFeature = DefinitionsFirst(baseViewElement);
attribute :>> featureRepresentation :> ColRep::declaredName;
}
view 'Declared In' :> columnViews {
:>> columnFeature = Owner(baseViewElement);
attribute :>> featureRepresentation :> ColRep::name;
}
}
}
Download all examples
Every example on this page in a single archive, one folder per example: