Conversation
- Removed this from FunctionAdapter and ExpressionAdapter. - Added it back just in FeatureReferenceExpressionAdapter and InvocationExpressionAdapter.
- Derivations and operations for invocation and constructor expressions. - instantiatedType operation for operator and trigger invocation expressions.
validateFeatureReferenceResult validateConstructorExpressionNoDuplicateFeatureRedfinition validateConstructorExpressionOwnedFeatures validateInstantiationExpressionInstantiatedType validateInstantiationExpressionResult validateInvocationExpressionInstantiatedType validateInvocationExpressionNoDuplicateParameterRedefinition (updated) validateInvocationExpressionOwnedFeatures validateInvocationExpressionParameterRedefinition (updated)
|
I am reviewing this. I could not find any issues so far. But I found ConstructorExpression can be used for behavior as well as InvocationExpression. For example, Are these expressions having the same semantics? P.S. |
Yes, this is mentioned in the PR description:
|
sysml.library/Kernel Libraries/Kernel Function Library/BaseFunctions.kerml
Show resolved
Hide resolved
|
👍 Good for merge. I did not find any overlooked constructor expresssions that need a |
sysml/src/validation/05-State-based Behavior/5-State-based Behavior-1.sysml
Show resolved
Hide resolved
sysml/src/validation/05-State-based Behavior/5-State-based Behavior-1a.sysml
Show resolved
Hide resolved
|
Ed, thank you for your answer. I found a bit strange behavior of the validation. In KerML, the number of parameter could be checked: This causes an error of `Bound features should have conforming types". However, in SysML, it does not seem to be checked: Am I missing something? I found the parameter types are correctly checked. So |
I believe this is correct per the approved specification, but it is not particularly intuitive, so it is something we might want to address in the RTF. What is happening here is actually not a check on the number of parameters. Rather, the class In the case of |
|
Ed, thank you for the detailed explanation. I confirmed if I change |
- Updated TypeAdapter::getFeaturesRedefinedByType to add additional members before getting redefined features.
This PR implements resolutions to the following issues, as approved in KerML FTF2 Ballots #5 and #6 and SysML v2 FTF 2 Ballot #8:
Previously, an invocation expression where the invoked type was not a function acted as a constructor for an instance of the invoked type. The resulting usage was both typed by the invoked type and a subset of
Performances::evaluations. But, if the invoked type was a data type or structure, then this was a semantic inconsistency, becausePerformance(a supertype ofevaluations) is disjoint withDataValueandObject. The resolution to KERML_-132 fixes this by introducing a new kind of constructor expression and requiring that the invoked type of an invocation expression be a behavior or function.Abstract Syntax
InstantiationExpressionInvocationExpressionandConstructorExpression.instantiatedType, which is theTypeinvoked/instantiated by the expression.instantiatedTypeof any kind ofInstantiationExpression, other than anOperatorExpressionorTriggerInvocationExpression(in SysML), is parsed as a member of the expression. (There are special derivation rules for theinstantiatedTypeof anOperatorExpressionorTriggerInvocationExpression.)InstantiationExpressionmust own itsresultparameter.InvocationExpressionInvocationExpressionis required to specialize theinstantiatedType, as before.instantiatedTypeof anInvocationExpressionmust be aBehavior, normally aFunction.instantiatedTypeis aBehaviorthat is not aFunction, then theInvocationExpressionis still typed by theBehavior, with itsresultbound to the expression itself. This allows non-FunctionBehaviorsto still be essentially "constructed" using anInvocationExpression, as before. (This does not cause semantic problems, because it is acceptable to specialize aPerformanceof theBehaviorto anEvaluationthat returns itself.)argumentsof anInvocationExpressionare parsed asFeatureValuesofownedFeaturesof the expression itself, as before.ConstructorExpressionInvocationExpressionswith constructor semantics.ConstructorExpressionis required to specialize theinstantiatedType.argumentsof aConstructorExpressionare parsed asFeatureValuesofownedFeaturesof theresultof theConstructorExpression. (In this way, a value of theinstantiatedTypeis "constructed" as theresultof theConstructorExpression, while the expression itself can still be typed as anEvaluation.)FeatureReferenceExpressionFeatureReferenceExpressionis also updated with a new validation constraint requiring that it own itsresultparameter.Note. The Pilot Implementation previously inserted an owned
resultparameter for all kinds of expressions. Now this is only done forInstantiationExpressionsandFeatureReferenceExpressions.Concrete Syntax
The concrete syntax for a constructor expression is similar to that of an invocation expression, but preceded by the keyword
new.Model Libraries
Kernel Semantic Library
Performances– AddconstructorEvaluationsas the base feature of allConstructorExpressions.constructorEvaluationsis a specialization ofevaluationsthat restricts the multiplicity of itsresultparameter to1..1, requiring aconstructorEvaluationto result in a single value.Triggers– Use the new syntax to construct the result values forTriggerWhenandTriggerAt.SysML Domain Libraries
SampleFunctions– Use the new syntax to construct the result value for the calculation definitionSample.RiskMetadata– Use the new syntax to construct the enumerated values of the enumeration definitionRiskLevel.MeasurementReferences– Use the new syntax to construct the value of the attribute usageone.