Systems-Modeling / SysML-v2-Pilot-Implementation

Proof-of-concept pilot implementation of the SysML v2 textual notation and visualization
GNU Lesser General Public License v3.0
114 stars 23 forks source link

ST6RI-690/692/693/694 Various derivation implementations are incorrect #490

Closed seidewitz closed 11 months ago

seidewitz commented 11 months ago

This pull request fixes bugs in the implementation of several derived property computations.

  1. ST6RI-690 Connector::connectorEnd implementation is incorrect. The KerML specification defines the derivation for Type::endFeature to be all features of a Type that have isEnd = true. The property Connector::connectorEnd redefines endFeature and inherits the same derivation. This was implemented correctly in Type_endFeature_SettingDelegate, but Connector_connectorEnd_SettingDelegate had a separate derivation that only returned owned end features.
  2. _ST6RI-692 AssignmentActionUsage_referentSettingDelegate is incorrect. The implementation in this setting delegate presumed that the referent of an AssignmentActionUsage would be the first non-parameter member of the action. This is different than the definition in the SysML specifiation (which is that the referent is the first Feature that is the memberElement of an ownedMembership that is not an OwningMembership), and it did not work properly when the referent was a parameter of a containing action rather than the AssignmentActionUsage itself.
  3. _ST6RI-693 IfActionUsage_ifArgumentSettingDelegate is incorrect. The implementation of IfActionUsage_ifArgument_SettingDelegate presumed that the ifArgument expression was a bound FeatureValue of the IfActionUsage::ifTest parameter. However, this is not correct. The ifArgument is not parsed using a FeatureValue, but, rather, the argument Expression simply redefines the ifTest.
  4. ST6RI-694 Derivations of sourceType, targetType, sourceFeature and targetFeature are incorrect. The utility methods TypeUtil::getSourceTypeOf, TypeUtil::addTargetTypes, ConnectorUtil::getSourceFeatureOf and ConnectorUtil::addTargetFeatures did not correctly implement the derivations in the specification of Association::sourceType/targetType and Connector::sourceFeature/targetFeature.

The PR also changes existing calls in the code of Connector::getConnectorEnd to TypeUtil::getOwnedEndFeatureOf, so that they produce functionally the same result as before the change to getConnectorEnd as described in item 1 above.

seidewitz commented 11 months ago

@himi Please note the change to Connector::getConnectorEnd from returning just owned ends to returning both owned and inherited ends. I changed all calls to getConnectorEnd in the PlantUML code to instead use TypeUtil.getOwnedEndFeaturesOf in order to preserve the existing functionality.