Closed seidewitz closed 2 years ago
I pushed some small fixes to show aliases in compartments. I noticed that it's still lacking to show aliases in titles. I will deal with it in the separate PR.
I also changed PlantUML visualizer to use Element.getElementId() rather than generating IDs by itself.
This pull request implements updates to Root elements of the abstract syntax, per the 2022-04 baseline metamodel. It also makes updates to the implementation of invocation expressions, indirectly necessitated by the abstract syntax update.
Abstract Syntax
Element (updated)
identifier
has been renamed toelementId
.humanId
has been renamed toshortName
.name
is no longer derived.Membership (updated)
memberShortName
property has been added, allowing alias short names.memberElementId
property has been added, derived as theelementId
of thememberElement
.ownedMemberElement
andeffectiveMemberName
properties have been removed.OwningMembership (new)
ownedMembers
of a Namespace are related to the Namespace using OwningMembership, while aliasmembers
are related using the Membership superclass.memberElement
property fromMembership
is redefined inOwningMembership
as a compositeownedMemberElement
property. Previously, a Membership owning itsmemberElement
also had anownedMemberElement
property. Now, an OwningMembership has only theowningMemberElement
, which is also itsmemberElement
when considered as an instance of the Membership superclass.memberName
,memberShortName
andmemberElementId
are redefined toownedMemberName
,ownedMemberShortName
andownedMemberElementId
, respectively, and are derived as theeffectiveName
,shortName
andelementId
of theownedMemberElement
.FeatureValue and ElementFilterMembership (updated)
FeatureValue and ElementFilterMembership are now subclasses of OwningMembership rather than Membership. These kinds of Membership already owned their
memberElements
.FeatureMembership (updated)
FeatureMembership is now a subclass of OwningMembership. Previously, it was possible (in KerML) to have a non-owning FeatureMembership. However, this is really no longer necessary, since TypeFeaturing relationships can be used to give a Feature domain Types in addition to the
owningType
it gets from itsowningFeatureMembership
(if any).The
memberFeature
property has been removed. TheownedMemberFeature
property redefines theownedMemberElement
property from OwningMembership.All subclasses of FeatureMembership (EndMembership, ParameterMembership, ReturnParameterMembership, ResultExpressionMembership and various specializations in the SysML abstract syntax) already required ownership (redefining
ownedMemberFeature
), so no change is needed for them (except that the redundantmemberParameter
property is removed from ParameterMembership).Concrete Syntax
Name resolution
The name resolution algorithm in
org.omg.sysml.kerml.xtext.KerMLScope
has been updated so thatmemberNames
andmemberShortNames
are handled identically (except for one special case, which already existed, when thename
of anownedMemberElement
is used instead of itseffectiveName
, to avoid circular name resolution when computing theeffectiveName
).Invocation expressions
Named-argument notation. In an InvocationExpression using named-argument notation (such as
F(x = 1, y = 2)
), the argument expressions (e.g.,1
and2
) were previously related to the InvocationExpression using FeatureMemberships whosememberNames
were the argument names (e.g.,x
andy
). ThesememberNames
were then used during subsequent semantic transformation on the InvocationExpression to match the argument expressions to parameters of the invoked function (e.g.,F
). However, this parsing is no longer possible, because FeatureMembership is now an OwningMembership whoseownedMemberName
is derived and cannot be set during parsing.A new parsing was been implemented for the named-argument notation in which each argument parses as a parameter with an explicit redefinition of the named Function parameter and with the argument Expression as its FeatureValue. For example,
F(x = 1, y = 2)
now parses essentially just like it would if written using FeatureValues in theexpr
notation (calc
in SysML notation), as follows:Additional validation checks have been added for InvocationExpressions using the named-argument notation (i.e., those for which the parameters have explicit redefinitions), validating that each argument name is a valid Function parameter name and that each Function parameter is named at most once.
expr
notation with implicit parameter redefinitions. For example,F(1,2)
parses essentially the same as{ ... }
) has also been updated. A body expression now parses to a FeatureReferenceExpression with the body of the body expression as both anownedFeature
and thereferent
of the FeatureRefernceExpression. The result of the FeatureReferenceExpression is thus bound to the the body Expression itself (not its result), which gives the correct value when this is further bound to a parameter with an Evaluation type (e.g., themapper
parameter for thecollect
Function). For example,{in x : Integer; x + 1}
now maps essentially likeThis parsing should now also be correct for all valid uses of body expressions, whereas the previous parsing (without the wrapping FeatureReferenceExpression) was really only correct in certain special cases.
Kernel Library
expr
features on various Functions in theControlFunctions
package have now all been marked asin
parameters, which work consistently with the new parsings for InvocationExpressions, as described above. (Previously, these features were not parameters and were handled as special cases for the invocations of these Functions.)