Skip to content

ST6RI-940 ResourceSetModelLibraryProvider Implementation does not take into account the root namespace#771

Merged
seidewitz merged 2 commits into
masterfrom
ST6RI-940
Jun 18, 2026
Merged

ST6RI-940 ResourceSetModelLibraryProvider Implementation does not take into account the root namespace#771
seidewitz merged 2 commits into
masterfrom
ST6RI-940

Conversation

@AxelRICHARD

@AxelRICHARD AxelRICHARD commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This PR fixes the ResourceSetModelLibraryProvider Implementation to take into account the root namespace.

Background

The standalone ResourceSetModelLibraryProvider did not correctly resolve qualified names for elements stored in standard SysML/KerML model library resources when those resources followed the structure required by the SysML/KerML specification. The previous implementation attempted to resolve a qualified name such as Base::Anything by matching the first segment (Base) directly against each root object contained in an EMF Resource. This worked only if the named library package itself was the direct root object of the resource. However, this is not the structure defined by the specification for model interchange and model libraries.

According to KerML and SysML, a model interchange file represents a single root namespace. This root namespace is implicit, unnamed, and has no owner. The actual model elements, including top-level library packages such as Base, are owned members of that root namespace.

Therefore, in a conforming resource, the structure is:

Resource
  Root Namespace              // implicit, unnamed
    OwningMembership
      Library Package "Base"  // top-level element
        OwningMembership
          Type "Anything"

The old lookup logic expected this instead:

Resource
  Library Package "Base"
    Type "Anything"

As a result, resolving Base::Anything failed for correctly structured resources, because the provider compared Base with the unnamed root namespace and stopped before inspecting the root namespace memberships.

Instead, Base::Anything must be resolved by entering the resource root namespace, then matching Base among its owned memberships, then matching Anything inside the Base namespace.

Changes

The model library provider now treats the resource root objects as root namespaces, not as named elements to be matched against the first qualified name segment.

The lookup algorithm:

  1. Iterates over resource contents.
  2. Considers only root objects that are Namespace instances.
  3. Resolves the first qualified-name segment against the namespace's owned memberships.
  4. Continues recursively through member elements that are themselves namespaces.
  5. Matches each segment against membership names, membership short names, declared names, and declared short names, preserving alias and short-name behavior.
  6. Ignore non-namespace root elements for qualified-name lookup, because an element without an owning namespace has no valid qualified name according to the metamodel rules.

Fix ResourceSetModelLibraryProvider Implementation to take into account
the root namespace

Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
@AxelRICHARD AxelRICHARD added this to the 2026-05 milestone Jun 17, 2026
@AxelRICHARD AxelRICHARD added the bug Something isn't working label Jun 17, 2026
@AxelRICHARD AxelRICHARD marked this pull request as ready for review June 17, 2026 08:08
@seidewitz seidewitz changed the title ST6RI-940 Fix ResourceSetModelLibraryProvider ST6RI-940 ResourceSetModelLibraryProvider Implementation does not take into account the root namespace Jun 17, 2026
@seidewitz seidewitz self-assigned this Jun 17, 2026
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
@seidewitz seidewitz merged commit 6059ea8 into master Jun 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants