Hi there,
I have been experimenting with the latest Syside releases, currently Syside Modeler 0.8.7 and CLI 0.8.6.
I am trying to understand how to generate recognizable classic diagrams from SysML v2 views, especially use case, state, and sequence diagrams. I have read the documentation on SysML v2 Views and also the release post Biggest Syside Release: Views support, more diagrams and new automation features. Based on those materials, I expected that these kinds of diagrams should at least be possible in principle.
To make this concrete, I created a very small academic example: a lamp that can be turned on and off. The repository is here:
I’ve split the model into model.sysml and view.sysml:
model.sysml
package ExampleModel {
doc
/* Minimal SysML v2 reference model for checking current tool support
* for structure, use cases, sequence-style interaction, and state behavior.
*
* The model is intentionally small and stable.
* It is designed for parser, formatter, and view-rendering experiments rather than domain depth.
*/
part def User;
part def Button;
part def Lamp;
part def LampSystem {
doc
/* Structural context for the example.
* The system is decomposed into one user, one button, and one lamp.
*/
part user : User;
part button : Button;
part lamp : Lamp;
}
part lampSystem : LampSystem;
use case 'operate lamp' {
doc
/* Top-level use case for the example.
* This use case is intentionally simple.
* Actor placement and child use case rendering can therefore be compared across tools.
*/
subject lamp : Lamp;
actor user : User;
use case 'turn lamp on';
use case 'turn lamp off';
}
use case def TurnLampOnSequence {
doc
/* Minimal interaction-style example.
* The user presses the button.
* The lamp receives the command.
* The user then observes that the lamp is on.
*
* This element is included to test whether a tool only parses event occurrences and messages.
* It also tests whether a tool can render them as a recognizable sequence-style view.
*/
subject lamp : Lamp {
event occurrence commandReceived;
then
event occurrence lampTurnedOn;
}
actor user : User {
event occurrence pressesButton;
then
event occurrence observesLampOn;
}
message from user.pressesButton to lamp.commandReceived;
then message from lamp.lampTurnedOn to user.observesLampOn;
}
action def TurnOn;
action def TurnOff;
state def LampStates {
doc
/* Minimal state machine definition for the example.
* The lamp begins in Off.
* It transitions to On on TurnOn.
* It transitions back to Off on TurnOff.
*/
}
state lampStates : LampStates {
entry;
then off;
state off;
transition off accept TurnOn then on;
state on;
transition on accept TurnOff then off;
}
}
views.sysml
package ExampleView {
doc
/* Views for the minimal lamp example.
* These are intended to produce the most diagram-like renderings currently
* available from the tool, rather than generic exposed-element trees.
*/
private import Views::asTreeDiagram;
view lampSystemContextDiagram {
doc
/* Expected result:
* A compact structural context diagram rooted at lampSystem, showing
* user, button, and lamp as contained parts.
*/
expose ExampleModel::lampSystem;
attribute fileName = "lamp-system-context";
attribute fileType = "PNG";
}
view lampUseCaseDiagram {
doc
/* Expected result:
* A top-level use case diagram centered on 'operate lamp', with User
* shown as actor and the child use cases visible.
*/
expose ExampleModel::'operate lamp';
render asTreeDiagram;
attribute fileName = "lamp-use-case";
attribute fileType = "PNG";
}
view lampTurnOnSequenceDiagram {
doc
/* Expected result:
* A sequence-style interaction showing the actor User, the subject Lamp,
* and the two messages in temporal order.
*/
expose ExampleModel::TurnLampOnSequence;
attribute fileName = "lamp-turn-on-sequence";
attribute fileType = "PNG";
}
view lampStateTransitionDiagram {
doc
/* Expected result:
* A state transition diagram showing only the states off and on and the
* transitions triggered by TurnOn and TurnOff.
*/
expose ExampleModel::lampStates;
filter (
as SysML::StateUsage hastype SysML::StateUsage or
as SysML::TransitionUsage hastype SysML::TransitionUsage
);
attribute fileName = "lamp-state-transition";
attribute fileType = "PNG";
}
}
For automatization, I’ve ceated a Taskfile.yml:
Taskfile.yml
version: "3"
tasks:
default:
desc: Show available tasks
cmds:
- task --list
silent: true
check:
desc: Validate the lamp example files
cmds:
- syside check model/model.sysml model/view.sysml
format:
desc: Format the lamp example files
cmds:
- syside format model/model.sysml model/view.sysml
clean:
desc: Remove generated view output
cmds:
- powershell -NoProfile -Command "if (Test-Path output/views) { Remove-Item output/views -Recurse -Force }"
view-context:
desc: Render the lamp context diagram
cmds:
- syside viz view model/model.sysml model/view.sysml --qualified-name ExampleView::lampSystemContextDiagram --output-dir output/views
view-usecase:
desc: Render the lamp use case diagram
cmds:
- syside viz view model/model.sysml model/view.sysml --qualified-name ExampleView::lampUseCaseDiagram --output-dir output/views
view-state:
desc: Render the lamp state transition diagram
cmds:
- syside viz view model/model.sysml model/view.sysml --qualified-name ExampleView::lampStateTransitionDiagram --output-dir output/views
view-sequence:
desc: Render the lamp sequence diagram
cmds:
- syside viz view model/model.sysml model/view.sysml --qualified-name ExampleView::lampTurnOnSequenceDiagram --output-dir output/views
views:
desc: Render all lamp diagrams
cmds:
- task: view-context
- task: view-usecase
- task: view-state
- task: view-sequence
To create the different view, I use:
- To render the lamp context diagram using
syside viz view model/model.sysml model/view.sysml --qualified-name ExampleView::lampSystemContextDiagram --output-dir output/views
- To render the lamp use case diagram
syside viz view model/model.sysml model/view.sysml --qualified-name ExampleView::lampUseCaseDiagram --output-dir output/views
- To render the lamp state transition diagram
syside viz view model/model.sysml model/view.sysml --qualified-name ExampleView::lampStateTransitionDiagram --output-dir output/views
- To render the lamp sequence diagram
syside viz view model/model.sysml model/view.sysml --qualified-name ExampleView::lampTurnOnSequenceDiagram --output-dir output/views
My main issue is that the outputs look more like generic exposed model views than the classic diagrams I was trying to produce.
In particular:
- the use case diagram exposes internal structure that I would not expect in a communication-oriented use case diagram
- the state diagram still shows inherited/internal action structure that I was trying to filter out
- the sequence example parses, but the rendering does not resemble a usable sequence diagram
So my questions are:
- Am I modeling the views in the wrong way?
- Are there recommended patterns for getting more recognizable use case, sequence, and state diagrams out of Syside today?
- Should I be using specific standard view definitions such as
SequenceVieworStateTransitionViewinstead of plainviewwithexpose? - Do you have examples of how you are generating more polished diagrams from Syside in practice?
I would appreciate any guidance, example repositories, or pointers to working patterns.
Thanks in advance.












