Skip to content

enhancement: group owned features into compartments in automatically laid-out %viz diagrams #1418

Closed

Description

@l-johnston

Feature request

Please provide an opt-in way to display eligible owned features as compartment rows inside their owning part definition/usage in automatically laid-out %viz tree diagrams, rather than drawing each feature as a separate node. Pilot-compatible --style=COMPMOST would be a useful spelling, but a native rendering option would also meet the need.

This is an enhancement request, not a specification-conformance claim or a report that all compartment support is missing.

Motivation

When several definitions each own attributes, parts, or ports, drawing every feature as a separate node quickly makes the diagram wide and difficult to read. Keeping feature names and types inside their owner's box would preserve useful detail without so many containment edges. The desired workflow is a notebook cell with automatic layout, without manually positioning each definition.

Minimal standalone reproduction

The following example is independently authored and requires only the standard library. Submit it in an OpenSysML Jupyter notebook cell:

package CompartmentDemo {
    part def Sensor {
        attribute label : ScalarValues::String;
        attribute reading : ScalarValues::Real;
    }
    part def Controller {
        attribute enabled : ScalarValues::Boolean;
        part sensor : Sensor;
    }
}

Then run each command in a separate cell:

%viz --view=tree CompartmentDemo::Sensor CompartmentDemo::Controller
%viz --view=tree --style=COMPMOST CompartmentDemo::Sensor CompartmentDemo::Controller

Observed in v0.10.1

Both commands complete successfully and produce an SVG with 6 nodes and 5 edges: the two part definitions and four owned features remain separate nodes. The second rendering's text representation explicitly notes:

not represented: style COMPMOST (show as many memberships in a compartment as possible) is not drawn

This appears consistent with the documented handling of unsupported pilot styles. Changing to --style=cameo does not provide the requested feature grouping either.

Requested behavior

With a compartment-grouping option enabled:

  • Show label : String and reading : Real in an attributes compartment of Sensor.
  • Show enabled : Boolean in an attributes compartment of Controller, and eligible part features such as sensor : Sensor in a parts compartment.
  • Preserve meaningful relationships between the displayed definitions, such as the composition relationship represented by sensor, while avoiding redundant standalone feature nodes and their containment edges.
  • Keep the current expanded-node rendering available; this need not change the default.
  • Ideally make the option usable directly from %viz without a declared view or explicit DiagramLayout positions.

Existing related work

Could the existing compartment-folding behavior be exposed as an automatic-layout rendering option? If a newer build already supports this workflow, guidance on the appropriate command would also be welcome.

Tested environment

  • OpenSysML CLI/native Jupyter kernel: v0.10.1
  • Build commit: 1c45b6e1749fc8adc9b82d4af22fbe180b56a0e2
  • Linux AMD64 dev container; Graphviz 2.43.0
  • Reproduced through the native Jupyter kernel; no API server or external model libraries required

Activity

  1. HuiJun commented on Oct 23, 2026

    @HuiJun
    Collaborator

    Thank you for submitting this request! I completely agree, we should provide this and as you pointed out, it would be really easy to do at this point. Unfortunately, it may not make the cut off for the release tomorrow, but we'll definitely have this out in a following nightly. PR links to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions