Skip to content

Comments

ST6RI-881 Conditional computation of baseType of semantic metadata doesn't work#701

Merged
seidewitz merged 3 commits intomasterfrom
ST6RI-881
Oct 14, 2025
Merged

ST6RI-881 Conditional computation of baseType of semantic metadata doesn't work#701
seidewitz merged 3 commits intomasterfrom
ST6RI-881

Conversation

@seidewitz
Copy link
Member

This PR corrects the evaluation of the feature value expression of the baseType of semantic metadata.

Consider the following KerML model:

class C;
struct S;

metaclass M :> Metaobjects::SemanticMetadata {
  :>> annotatedElement : KerML::Class
  :>> baseType = 
      if annotatedElement istype KerML::Structure ? 
          S meta SysML::Type else C meta SysML::Type;
}

#M struct T;

The structure T should have an implicit specialization to the base structure S, but, instead, it previously just received an implied specialization to Objects::Object. This is because the evaluation of the feature value expression for the baseType feature was computed using the annotatedElement T as the target, rather than the annotating metadata feature (where annotatedElement is a feature). The PR corrects this.

@seidewitz seidewitz added this to the 2025-09 milestone Oct 8, 2025
@seidewitz seidewitz self-assigned this Oct 8, 2025
@seidewitz seidewitz merged commit bf163ed into master Oct 14, 2025
2 checks passed
@gke3
Copy link

gke3 commented Nov 10, 2025

Does not work as expected. @seidewitz, please confirm is our sample is correct.
issue

part def C;
attribute def S;

metadata def <m> M :> Metaobjects::SemanticMetadata {
  :> annotatedElement : SysML::PartDefinition;
  :> annotatedElement : SysML::AttributeDefinition;
  :>> baseType = 
      if annotatedElement istype SysML::PartDefinition ? 
          C meta SysML::PartDefinition else S meta SysML::AttributeDefinition;
}

#m part def tPart;
#m attribute def tAttribute;

@seidewitz
Copy link
Member Author

@gke3
The sample is correct, and it works for me, both in the Eclipse and Jupyter deployments of 2025-10.

Try this:

part p {
    protected attribute x;
}
attribute y = p.x; // ERROR:Couldn't resolve reference to Element 'x'.

If you don't get an error, then you don't have 2025-10 installed.

@TomasJuknevicius
Copy link

@seidewitz
Howdy,
You were right, the installation had a problem that it had several versions of the components deployed. Once we reinstalled from a clean slate, it started to work.
It seems to work properly - we tried both a simple type test condition and slightly more complicated ones (such as if annotatedElement.isComposite).
Congrats; this one is done.
Now UAFv2 can move on - till they run into their more complicated cases (the ones requiring more complex conditions, model level evaluable tweaking etc)

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