Repository navigation
[Feature]: Move general UML query extension methods from SysML2.NET, EORSADB and mycelium into uml4net.Extensions #511
Description
What type of issue is this?
- Bug report
- Feature request
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of the uml4net
- I have searched open and closed issues to ensure it has not already been reported
Description
SysML2.NET, EORSADB and the mycelium projects (forge, sdk, hypha) each define extension methods on uml4net types in their own code generator. A number of them ask a general question about a UML model and have nothing to do with the project that hosts them. Several exist in more than one project. They belong in uml4net.Extensions, so that they are written, tested and fixed once.
The table lists the candidates. For each one to decide: add it to uml4net.Extensions (with a test, and a Handlebars helper where a template needs it), or reject it with a reason.
Class
-
IClass.QueryAllNonDerivedProperties,QueryAllNonDerivedNonRedefinedProperties(SysML2.NET): all properties, without the derived ones, and without those that are redefined in the class.uml4net.HandleBarshas helpers with these names that do the work inline; there is no extension method behind them. The twoCount...variants in SysML2.NET are aCounton the result and are not needed. -
IClass.QueryIsSubclassOf(IClass)(SysML2.NET): true when the other class is among the general classifiers. -
IClass.QueryDerivesFrom(string)(EORSADB, mycelium-forge): the same question, by class name. To decide whether one method with two overloads covers both. -
IClass.QueryAllSuperClasses(EORSADB): the class itself and all its superclasses. OverlapsIClassifier.QueryAllGeneralClassifiers; to check whether it adds anything. -
IClass.QueryConcreteAncestors,HasConcreteBase(EORSADB): the non-abstract ancestors of a class. -
IClass.QueryAllOppositeReferencesToMe(EORSADB, mycelium-forge): every reference property in the model that is typed by this class. -
IClass.QueryOwnedManyToManyProperties(EORSADB, mycelium-forge): the owned properties that are part of a many-to-many relationship.
Property and Operation
-
IProperty.QueryIsManyToMany(EORSADB): uml4net hasQueryIsMemberOfManyToMany. To compare the two; EORSADB also treats a multi-valued reference property without an opposite as many-to-many. -
IProperty.QueryIsEnumPropertyWithDefaultValue(SysML2.NET, mycelium-forge): the property is typed by an enumeration and its default value is an enumeration literal. -
IProperty.QueryPropertyIsPartOfNonDerivedCompositeAggregation(SysML2.NET): the property, or its opposite, is composite and not derived. -
IProperty.QueryOwnedConstraints,IOperation.QueryOwnedConstraints(SysML2.NET): the constraints that apply to the property or operation.
Package and Element
-
XmiReaderResult.QueryContainedAndImported(rootName)(SysML2.NET): the packages under a root and the packages they import. OverlapsIPackage.QueryAllNestedAndImportedPackages; to check whether it adds anything. -
IElement.QueryAllElementComments(EORSADB): the comments of an element. To compare withQueryDocumentationandQueryRawDocumentation. -
IElement.QueryAllElementCommentsIncludingEA(EORSADB): the comments plus the Enterprise Architect documentation. Belongs inuml4net.xmi.Extensions.EnterpriseArchitect. -
IElement.QueryDocumentationText,QuerySummary(maxLength)(mycelium-hypha): the documentation as one clean paragraph, and its first sentence truncated to a length.
Already in uml4net
IConstraint.QueryConstraintBody and IOperation.QueryBodyConditionText of mycelium-hypha were added in #506. The copies in mycelium-hypha can be removed when it moves to a version that has them.
Out of scope
Kept apart on purpose, each a decision of its own: the C# naming code (ReservedCSharpNameMapper, the property name methods), the SQL mapping methods that EORSADB and mycelium-forge share, and the duplicated Handlebars helpers.
Notes on how this list was made:
- About half of the methods were judged by reading the body, the others by signature and documentation comment.
- "In two projects" means the same name and purpose. The implementations were not compared line by line and may differ.
- The downstream projects reference
uml4net.HandleBars8.4.0 and other packages at 8.6.0, so they can only switch over after upgrading to the version that contains these methods.
Steps to Reproduce
Not applicable.
System Configuration
- uml4net version:
developmentbranch, after 9.1.0 - Environment (Operating system, version and so on): not applicable
- .NET Framework version: not applicable
- Additional information: related to [Add] QueryConstraintBody and QueryBodyConditionText extension methods #506 and [Bug]: Five faulty Handlebars helpers in uml4net.HandleBars (Property.QueryIsSubsetted always true, and four more) #508
Activity
samatstariongroup commentedon Oct 11, 2026
Outcome of the review
Every implementation of the candidates was read in full, with its call sites, and compared with what
uml4net.Extensionshas.Rules that were agreed
uml4net.HandleBars.Class
QueryAllNonDerivedPropertiesClass.QueryAllNonDerivedPropertiescalls itQueryAllNonDerivedNonRedefinedPropertiesCountAllNonDerived...(two)Counton the resultQueryIsSubclassOf(IClass)QueryIsSubclassOf(IClass), false for the class itself (the SysML2.NET version returns true for it, and is not called)QueryDerivesFrom(string)QueryIsSubclassOf(string name); matches on the name onlyIClassifier.QueryConformsTo(IType), the operationClassifier::conformsToof the specification, true for the classifier itselfQueryAllSuperClassesQueryAllGeneralClassifiers().OfType<IClass>()QueryConcreteAncestors,HasConcreteBaseQueryAllGeneralClassifiersQueryAllOppositeReferencesToMeQueryReferencingProperties, with the behaviour of mycelium-forge (nested and imported packages, no failure without a root package)QueryOwnedManyToManyPropertiesProperty and Operation
QueryIsManyToManyQueryIsMemberOfManyToManyQueryIsEnumPropertyWithDefaultValueQueryPropertyIsPartOfNonDerivedCompositeAggregationQueryIsContainmentandQueryIsContainedIProperty.QueryOwnedConstraintsconstrainedElementholds the property. The lookup by the namederive{Class}{Property}is a SysML v2 convention and stays in SysML2.NET.IOperation.QueryOwnedConstraintsoperation.OwnedRulePackage and Element
QueryContainedAndImportedQueryAllNestedAndImportedPackagescovers it. The SysML2.NET version follows imports one level, and for a nested imported package adds the tree of its parent; switching (53 call sites) can change the set of packages.QueryAllElementCommentsQueryAnnotatingComments: the comments that annotate the element throughComment::annotatedElement, owned by it or not.QueryDocumentationandQueryRawDocumentationdo not change.QueryAllElementCommentsIncludingEAQueryDocumentationTextQueryRawDocumentationreturns the comments joined on one lineQuerySummary(maxLength)Correction to the description
SysML2.NET and mycelium-forge reference uml4net packages at 8.4.0 and 8.6.0. EORSADB references
uml4net.Reporting5.2.2.[Add] Class and Classifier query extension methods and their Handleba…
[Add] Property query extension methods and their Handlebars helpers; …
[Add] Element query extension methods for annotating comments and a d…
samatstariongroup commentedon Oct 11, 2026
All three groups are merged: #515 (Class), #516 (Property and Operation) and #517 (Package and Element). Every candidate in the description has a verdict in the comment above: eleven extension methods and ten Handlebars helpers were added, the others were rejected with a reason.
Left for later: the entries for the ten helpers on the wiki page, to be added when a version with them is released; and the switch-over of SysML2.NET, EORSADB and the mycelium projects, which needs an upgrade of their uml4net packages first.