You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that I am running the latest version of the SysML2.NET
I have searched open and closed issues to ensure it has not already been reported
Description
MetadataFeatureExtensions.ComputeSyntaxElementOperation is currently stubbed because the spec body is literally No OCL; the operation requires reflective metamodel infrastructure that the SDK does not yet provide. Issue #154 left this method deferred with a NotSupportedException and a code comment pointing here.
The intent is to mirror the SysML 2 Pilot Implementation (Java) mechanism — ElementAdapter.getMetaclassFeature() + EvaluationUtil.getMetaclassReferenceOf() — adapted to .NET, using a hybrid codegen + runtime cache design.
What has to be done
Three components, suggested as three sequential PRs:
Codegen the standard library skeleton — new generator and Handlebars template under SysML2.NET.CodeGenerator/ that read the existing XMI (Resources/KerML_only_xmi.uml, Resources/SysML_only_xmi.uml) and emit SysML2.NET/Core/AutoGenStandardLibrary/StandardLibrary.cs. Output: a static StandardLibrary.Root exposing a real LibraryPackage graph (KerML::Root, KerML::Core, KerML::Kernel, SysML::Systems, plus Metaobjects, Base, etc.) containing one named metaclass node per metaclass declared in the XMI. Wired with OwningMembership so the existing NamespaceExtensions.ComputeResolveGlobalOperation resolves qualified names like "KerML::Kernel::Class" out of the box. Out of scope: properties, operations, constraints, OCL bodies.
Reflection cache + name resolver under a new SysML2.NET/Core/Reflection/:
MetaclassFeatureCache.cs — ConditionalWeakTable<IElement, IMetadataFeature> providing GetOrCreate(IElement) that lazily builds a shadow MetadataFeature wired with a FeatureTyping to the library Metaclass and an Annotation back to the originating element. Mirrors the pilot's ElementAdapter.getMetaclassFeature().
MetaclassNameResolver.cs — maps a POCO's runtime type name to a library IMetaclass by trying the same four prefixes used in the pilot (KerML::Root::, KerML::Core::, KerML::Kernel::, SysML::Systems::), anchoring ResolveGlobal at StandardLibrary.Root.
Implement ComputeSyntaxElementOperation at SysML2.NET/Extend/MetadataFeatureExtensions.cs:191 — replace the stub with the pilot's getMetaclassReferenceOf algorithm: for each annotatedElement, return the first one whose cached metaclass-feature is reference-equal to the subject. Remove [ExcludeFromCodeCoverage], keep the <remarks> block verbatim, drop the deferred-implementation comment. Update the fixture to replace VerifyComputeSyntaxElementOperation_ThrowsNotSupportedException with a real roundtrip identity test.
Checklist
PR 1: StandardLibraryGenerator + StandardLibrary.hbs + generated StandardLibrary.cs + smoke test asserting StandardLibrary.Root exposes the expected metaclass count and ResolveGlobal("KerML::Kernel::Class") returns a non-null IMetaclass
PR 2: MetaclassFeatureCache.cs + MetaclassNameResolver.cs + roundtrip identity unit test
PR 3: replace the ComputeSyntaxElementOperation stub in MetadataFeatureExtensions.cs:191; update MetadataFeatureExtensionsTestFixture.cs; tick the corresponding item on issue [Feature]: Implement MetadataFeatureExtensions #154
Out of scope (intentional follow-ups)
A real .kerml / .sysml text-file parser for user-loaded libraries (the codegen-emitted standard library covers only the standard library).
MetadataAccessExpression.ownedElement and other reflective stubs — MetaclassFeatureCache unblocks them, but each needs its own PR with the right OCL translation.
What type of issue is this?
Prerequisites
Description
MetadataFeatureExtensions.ComputeSyntaxElementOperationis currently stubbed because the spec body is literallyNo OCL; the operation requires reflective metamodel infrastructure that the SDK does not yet provide. Issue #154 left this method deferred with aNotSupportedExceptionand a code comment pointing here.The intent is to mirror the SysML 2 Pilot Implementation (Java) mechanism —
ElementAdapter.getMetaclassFeature()+EvaluationUtil.getMetaclassReferenceOf()— adapted to .NET, using a hybrid codegen + runtime cache design.What has to be done
Three components, suggested as three sequential PRs:
Codegen the standard library skeleton — new generator and Handlebars template under
SysML2.NET.CodeGenerator/that read the existing XMI (Resources/KerML_only_xmi.uml,Resources/SysML_only_xmi.uml) and emitSysML2.NET/Core/AutoGenStandardLibrary/StandardLibrary.cs. Output: a staticStandardLibrary.Rootexposing a realLibraryPackagegraph (KerML::Root,KerML::Core,KerML::Kernel,SysML::Systems, plusMetaobjects,Base, etc.) containing one named metaclass node per metaclass declared in the XMI. Wired withOwningMembershipso the existingNamespaceExtensions.ComputeResolveGlobalOperationresolves qualified names like"KerML::Kernel::Class"out of the box. Out of scope: properties, operations, constraints, OCL bodies.Reflection cache + name resolver under a new
SysML2.NET/Core/Reflection/:MetaclassFeatureCache.cs—ConditionalWeakTable<IElement, IMetadataFeature>providingGetOrCreate(IElement)that lazily builds a shadowMetadataFeaturewired with aFeatureTypingto the libraryMetaclassand anAnnotationback to the originating element. Mirrors the pilot'sElementAdapter.getMetaclassFeature().MetaclassNameResolver.cs— maps a POCO's runtime type name to a libraryIMetaclassby trying the same four prefixes used in the pilot (KerML::Root::,KerML::Core::,KerML::Kernel::,SysML::Systems::), anchoringResolveGlobalatStandardLibrary.Root.Implement
ComputeSyntaxElementOperationatSysML2.NET/Extend/MetadataFeatureExtensions.cs:191— replace the stub with the pilot'sgetMetaclassReferenceOfalgorithm: for eachannotatedElement, return the first one whose cached metaclass-feature is reference-equal to the subject. Remove[ExcludeFromCodeCoverage], keep the<remarks>block verbatim, drop the deferred-implementation comment. Update the fixture to replaceVerifyComputeSyntaxElementOperation_ThrowsNotSupportedExceptionwith a real roundtrip identity test.Checklist
StandardLibraryGenerator+StandardLibrary.hbs+ generatedStandardLibrary.cs+ smoke test assertingStandardLibrary.Rootexposes the expected metaclass count andResolveGlobal("KerML::Kernel::Class")returns a non-nullIMetaclassMetaclassFeatureCache.cs+MetaclassNameResolver.cs+ roundtrip identity unit testComputeSyntaxElementOperationstub inMetadataFeatureExtensions.cs:191; updateMetadataFeatureExtensionsTestFixture.cs; tick the corresponding item on issue [Feature]: Implement MetadataFeatureExtensions #154Out of scope (intentional follow-ups)
.kerml/.sysmltext-file parser for user-loaded libraries (the codegen-emitted standard library covers only the standard library).MetadataAccessExpression.ownedElementand other reflective stubs —MetaclassFeatureCacheunblocks them, but each needs its own PR with the right OCL translation.System Configuration
SysML2.NET/Extend/MetadataFeatureExtensions.csorg.omg.sysml/src/org/omg/sysml/delegate/invocation/MetadataUsage_syntaxElement_InvocationDelegate.java,org.omg.sysml/src/org/omg/sysml/util/EvaluationUtil.java(lines 285–294),org.omg.sysml/src/org/omg/sysml/util/ElementUtil.java(lines 304–324),org.omg.sysml/src/org/omg/sysml/adapter/ElementAdapter.java(lines 92–109)MetadataFeatureExtensions.ComputeSyntaxElementOperationitem on issue [Feature]: Implement MetadataFeatureExtensions #154