Repository navigation
[Feature]: Function::isModelLevelEvaluable — generate the Kernel Functions Library membership set #364
Description
Description
FunctionExtensions.ComputeIsModelLevelEvaluable(this IFunction) in
SysML2.NET/Extend/FunctionExtensions.cs:69 is a NotSupportedException stub. It has no OCL
derivation — per KerML 1.0 §8.3.4.7.4 (normative) it is a Kernel Functions Library membership
test:
Certain
Functionsfrom the Kernel Functions Library are considered to have
isModelLevelEvaluable = true. For all otherFunctionsit is false.
The set is KerML 1.0 Table 5 (§8.2.5.8.1) + Table 7 (§8.2.5.8.2) — 39 operator symbols, 3 of them
marked No. Do not hardcode the names: 36 of the 39 rows are derivable from sources the code
generator already reads.
Derivation
- Operator symbols from the grammar —
Resources/KerML-textual-bnf.kebnf, token rules
ConditionalBinaryOperator,BinaryOperator,UnaryOperator,ClassificationTestOperator,
CastOperator,MetaclassificationTestOperator,MetaCastOperator, plus the inline
operator = 'if' | 'all' | '[' | ','assignments. → 35 symbols. - The 4 remaining operators from the XMI —
IndexExpression,FeatureChainExpression,
CollectExpressionandSelectExpressiondo not assignoperatorin the grammar; it is an OCL
constraint body inResources/KerML_only_xmi.uml:operator = '#'(:5937),'.'(:5761),
'collect'(:5692),'select'(:5633). → 39 total. - Symbol → library function — from
Resources/sysml.library.kpar/Kernel_Function_Library-1.0.0.kpar: the first package declaring a
Functionwith thatdeclaredName, probed in the orderBaseFunctions,DataFunctions,
ControlFunctions. That order is not invented — it is the OCL at
Resources/KerML_only_xmi.uml:5671, already implemented at
SysML2.NET/Extend/OperatorExpressionExtensions.cs:63. It resolves the==/===collision
(both are declared inBaseFunctionsandDataFunctions) toBaseFunctions, matching
Table 5. - Subtract the 3 curated exclusions — the only No rows:
BaseFunctions::'all'(type extent),
BaseFunctions::'['andDataFunctions::'~'(abstract, no default definition in the library; see
the notes atResources/KerML-textual-bnf.kebnf:1178and:1064).isAbstractdoes not
discriminate —BaseFunctions::'=='is abstract and is evaluable — so these three must be an
explicit list with a spec citation each.
This derivation is deliberately narrower than "every Function in the three packages": max, min,
reduce, forAll, selectOne, minimize etc. are declared there but are not operator terminals,
and fall out automatically.
Generator must validate (fail generation on mismatch)
- Every derived qualified name resolves to a
Functionin the Kernel Function Library. - Steps 1–3 yield exactly 39 symbols — any other count means spec or library drift.
- The exclusion list has 3 entries and every entry is present in the derived set.
'^'and'**'are separateFunctiondeclarations inDataFunctionseven though Table 5
collapses them into one row; both belong in the emitted set.
Output
A frozen set of qualified names in an AutoGen file (alongside
SysML2.NET/LexicalRules/AutoGenLexicalRules/), consumed by ComputeIsModelLevelEvaluable via
functionSubject.qualifiedName. Scope is the evaluable set only — the full operator → function map
is #365's concern.
Notes
SysML2.NET.CodeGenerator/Grammar/ already carries the KEBNF object model (TerminalElement,
Alternatives, TextualNotationRule) and GrammarLoader, and UmlCoreLexicalRulesGenerator
already emits from this rule shape. Reading .kermlx is the one new capability —
SysML2.NET.CodeGenerator references uml4net.xmi only, not SysML2.NET.Serializer.Xmi.
Impact
Completes the runtime behaviour of
InvocationExpressionExtensions.ComputeRedefinedModelLevelEvaluableOperation
(SysML2.NET/Extend/InvocationExpressionExtensions.cs:57), which compiles today but throws through
function.isModelLevelEvaluable.
Checklist
- Generator: extract operator terminals from the KEBNF token rules
- Generator: extract the 4 XMI
operator = '…'constraint operators - Generator: read
Kernel_Function_Library-1.0.0.kpar, map symbol → qualified name via the OCL probe order - Generator: curated 3-entry exclusion list + the drift validations above
- Handlebars template + emitted
AutoGenfile -
bool ComputeIsModelLevelEvaluable(this IFunction) -
SysML2.NET.Tests/Extend/FunctionExtensionsTestFixture.cs
System Configuration
- SysML2.NET version: 0.19.0
- Source files:
SysML2.NET/Extend/FunctionExtensions.csSysML2.NET.CodeGenerator/Generators/UmlHandleBarsGenerators/
Activity
[-][Feature]: Function::isModelLevelEvaluable — Kernel Functions Library membership test[/-][+][Feature]: Function::isModelLevelEvaluable — generate the Kernel Functions Library membership set[/+]Fix #364
Fix #364 (#366)