Conversation
- The featureMemberships of a type should only include inheritedMemberships whose owningType is a direct or indirect supertype.
- Added filter that owningType is a supertype. - There is a slight performance degradation.
Member
|
It tool much time to understand what the critical issue, but now I think I can understand. We need to properly filter And get owningType of thier featureMembership with the following code: And then I obtained: They are correct! |
Member
|
Just FYI, before this fix, I got: |
himi
approved these changes
Apr 2, 2026
seidewitz
added a commit
that referenced
this pull request
Apr 2, 2026
ST6RI-925 Problem with deriveTypeFeatureMembership (KERML11-191)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proactively implements the resolution to the following issue, which the KerML 1.1 RTF has elevated to be a "blocker" issue.
Background
Currently (as of KerML 1.0), the OCL for
deriveTypeFeatureMembershipisThe intent here is clearly to not include imported feature memberships. The problem is that
inheritedMembershipdoes include imported feature memberships from supertypes. SinceType::featureis derived fromfeatureMembership, this means that a type may get features that are not owned features of any of its supertypes, which may have owning types incompatible with the inheriting type.Overview
The proposed change to the OCL is to simply further filter the inherited feature memberships with
select(mem | self.specializes(mem.owningType)). The implementation inType_featureMembership_SettingDelegatecould be similarly updated with such a filter. However, doing this naively has a notable negative effect on performance. This is becausespecializesis implemented by computing theallSupertypestransitive closure and then checking against that. And the set ofallSupertypesgets recomputed on each call tospecializes.The performance problem can be mitigated by computing
allSupertypesonce, outside the filtering loop, and then usingallSupertypes.containsrather thanthis.specializes. With this change (and caching), the performance is essentially effected by the change.Changes
Type_featureMembership_SettingDelegate– RevisedbasicGetto simply callTypeUtil.getFeatureMembershipOf.TypeUtil– AddedgetFeatureMembershipOfto provide access toTypeAdapter.getFeatureMembership.TypeAdapter– ImplementedgetFeatureMembershipas discussed above. Implementing this in the adapter allows the computedfeatureMembershipto be cached (alongsideinheritedMembership).