Skip to content

Comments

ST6RI-884 Model-level evaluation conformance#718

Merged
seidewitz merged 5 commits intomasterfrom
ST6RI-884
Nov 29, 2025
Merged

ST6RI-884 Model-level evaluation conformance#718
seidewitz merged 5 commits intomasterfrom
ST6RI-884

Conversation

@seidewitz
Copy link
Member

@seidewitz seidewitz commented Nov 27, 2025

This PR improves the conformance of the implementation of the evaluation of model-level evaluable expressions with the SysML 2.0 specification.

Changed library function implementations

The following functions had been implemented as model-level evaluable, but they are not specified as model-level evaluable for SysML 2.0. They are no longer considered model-level evaluable in the implementation, and their implementation has been moved from org.omg.sysml.expressions.functions to org.omg.sysml.execution.expressions.functions.

  • NumericalFunctions::prod
  • NumericalFunctions::sum
  • SequenceFunctions::excludes
  • SequenceFunctions::includes
  • SequenceFunctions::isEmpty
  • SequenceFunctions::notEmpty
  • SequenceFunctions::size
  • StringFunctions::Length
  • StringFunctions::Substring

New library function implementations

The following functions have now been implemented as model-level evaluable, per the specification. Unfortunately, a problem with the current specification of the model-level evaluablity of body expressions (see KERML11-178) prevents them from be used in useful cases in model-level expressions. However, they can now be used in non-model-level evaluable expressions.

  • ControlFunctions::collect
  • ControlFunctions::select

- Moved implementations of all functions not considered model-level per
the specification from org.omg.sysml.expressions.functions to
org.omg.sysml.execution.expressions.functions.

- Only library functions registered with the INSTANCE of
org.omg.sysml.expressions.ModelLevelEvaluableLibraryFunctionFactory are
now considered model-level evaluable.
- Moved SequenceFunction tests out of ModelLevelEvaluationTest, because
SequenceFunctions are not currently model-level evaluable per the spec.

- Added tests for evaluation of expressions using ControlFunctions
collect and select. These functions are model-level evaluable, but
cannot be usefully used because of problem with model-level evaluability
of body expressions with result expressions that reference parameters.

- Added a few tests for collect and select into ModelLevelEvaluationTest
just to confirm that they the functions themselves are considered
model-level evaluable.
@seidewitz seidewitz self-assigned this Nov 27, 2025
@seidewitz seidewitz added this to the 2025-11 milestone Nov 27, 2025
@seidewitz seidewitz requested a review from himi November 27, 2025 19:10
@himi
Copy link
Member

himi commented Nov 28, 2025

I found StringFunctions::length and size should be Length and Substring. Also SequenceFunctions::size is missing in your description. I checked they could not be used in metadata since they are no longer model-level evaluable.

@himi
Copy link
Member

himi commented Nov 28, 2025

I confirmed collect can be used:

@MD { test = ControlFunctions::collect((1, 2, 3), true); }

But as you said, it's pity that I could not use:

@MD { test = ControlFunctions::collect((1, 2, 3), { in x; x * 2 }); }

@seidewitz
Copy link
Member Author

I found StringFunctions::length and size should be Length and Substring. Also SequenceFunctions::size is missing in your description. I checked they could not be used in metadata since they are no longer model-level evaluable.

Thanks for catching this. I have fixed the description.

@himi
Copy link
Member

himi commented Nov 29, 2025

Thank you for fixing the description. (But SequenceFunction::size is not correctly quoted)

@seidewitz seidewitz merged commit aa410d3 into master Nov 29, 2025
2 checks passed
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.

2 participants