Skip to content

ST6RI-977 Add a virtual container for detached inferred elements - #823

Merged
seidewitz merged 4 commits into
masterfrom
ST6RI-977
Nov 4, 2026
Merged

seidewitz merged 4 commits into
masterfrom
ST6RI-977

Conversation

@adaussy

@adaussy adaussy commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

This PR implements a virtual container for elements attached to a model via implicit relationships.

Background

When an implicit relationship is created that targets, e.g., a library element, the target element is owned in it's owned context, such as a library model. However, there are also cases in which the target element of an implicit relationship is to be considered an owned related element of the implicit relationship.

  1. When an implied specialization has a feature chain for its general type, the relationship needs to own the feature that owns feature chaining relationships for the feature chain. (This includes the implicit cross subsetting for an end feature with an owned cross feature.)
  2. An implied binding connector is owned by an implicit owning membership or feature membership.
  3. The featuring type of a variable feature is owned by an implicit type featuring relationship.

However, since the owning implicit relationship does not actually exist in the abstract syntax tree (unless and until it is specifically inserted into the model), elements it is considered to own do not actually have any container or resource, as far as EMF is concerned. Previously, if such an element was used as the context of a library lookup, this failed silently: a detached feature chain got no implied general type at all, instead of Base::things, and transformBindingConnector needed an extra owner parameter to find the library general type of a binding connector.

Changes

  1. Added VirtualContainer, an adapter recording the source model element of the implied relationship that "owns" the virtually contained element.
  2. Added ElementUtil.getEffectiveContainer to return the real container when there is one and the virtual container otherwise.
  3. Added ElementUtil.getClosestElementInResource to walk these effective containers up to an element in a resource.
  4. Revised SysMLLibraryUtil.getLibraryElement to start its lookup from the closest element resource, so a detached element resolves library types like the element for which it was created, and transformBindingConnector no longer needs an owner parameter.

The implementation creates some elements of implied relationships before
the relationship that will own them: feature chains used as implied
generals and binding connectors created during transformation. Until
they are inserted in the model they have no container and no resource,
so library lookup fails silently from them: a detached feature chain
gets no general at all instead of Base::things, and
transformBindingConnector needs an extra owner parameter to find the
library general of a binding connector.

VirtualContainer is an adapter recording the model element for which
such an element is created. ElementUtil.getEffectiveContainer returns
the real container when there is one and the virtual container
otherwise, and ElementUtil.getClosestElementInResource walks these
effective containers up to an element in a resource.
SysMLLibraryUtil.getLibraryElement starts its lookup from that element,
so a detached element resolves library types like the element it was
created for, and transformBindingConnector no longer takes the owner.

Signed-off-by: Arthur Daussy <arthur.daussy@obeo.fr>
@seidewitz seidewitz changed the title ST6RI-977 - Add a virtual container for detached inferred elements ST6RI-977 Add a virtual container for detached inferred elements Oct 26, 2026
@AxelRICHARD AxelRICHARD added this to the 2026-10 milestone Oct 27, 2026
@AxelRICHARD
AxelRICHARD requested a review from seidewitz October 28, 2026 15:08
@seidewitz seidewitz self-assigned this Oct 31, 2026

@seidewitz seidewitz left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried merging this, but the update caused a regression, failing the test org.omg.sysml.interactive.tests.NestedResolutionTest.metadataValueThroughDependentImport, which was introduced in PR #825. This has user-visible consequences: spurious validation warnings that binding connection ends don't have compatible types.

It seems that the types of connection ends are not being computed correctly for the implied bindings of metadata feature values. I have not figured out why.

I have done a reverse merge of master into branch ST6RI-977, which then fails the one test. This needs to be fixed before the branch can be merged into master.

@adaussy

adaussy commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

I tried merging this, but the update caused a regression, failing the test org.omg.sysml.interactive.tests.NestedResolutionTest.metadataValueThroughDependentImport, which was introduced in PR #825. This has user-visible consequences: spurious validation warnings that binding connection ends don't have compatible types.

It seems that the types of connection ends are not being computed correctly for the implied bindings of metadata feature values. I have not figured out why.

I have done a reverse merge of master into branch ST6RI-977, which then fails the one test. This needs to be fixed before the branch can be merged into master.

I have fix the issue in the commit ST6RI-977 Ignore proxies for virtual containers

@seidewitz
seidewitz merged commit 3d912cd into master Nov 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants