Skip to content

[Feature]: Move general UML query extension methods from SysML2.NET, EORSADB and mycelium into uml4net.Extensions #511

Closed

Description

@samatstariongroup

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.HandleBars has helpers with these names that do the work inline; there is no extension method behind them. The two Count... variants in SysML2.NET are a Count on 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. Overlaps IClassifier.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 has QueryIsMemberOfManyToMany. 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. Overlaps IPackage.QueryAllNestedAndImportedPackages; to check whether it adds anything.
  • IElement.QueryAllElementComments (EORSADB): the comments of an element. To compare with QueryDocumentation and QueryRawDocumentation.
  • IElement.QueryAllElementCommentsIncludingEA (EORSADB): the comments plus the Enterprise Architect documentation. Belongs in uml4net.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.HandleBars 8.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

Activity

  1. samatstariongroup commented on Oct 11, 2026

    @samatstariongroup
    MemberAuthor

    Outcome of the review

    Every implementation of the candidates was read in full, with its call sites, and compared with what uml4net.Extensions has.

    Rules that were agreed

    • A method is adopted when two projects use it today, or when one project has it and it asks a pure UML question without project knowledge.
    • Where implementations differ, the UML 2.5.1 specification decides; where it is silent, the behaviour most callers rely on.
    • Each adopted method gets a Handlebars helper in uml4net.HandleBars.
    • Delivery is one pull request per group. The downstream projects are not changed; what they have to change is recorded here.

    Class

    Candidate Verdict In uml4net
    QueryAllNonDerivedProperties adopt same name; the existing helper Class.QueryAllNonDerivedProperties calls it
    QueryAllNonDerivedNonRedefinedProperties adopt same name, not sorted; the helper sorts by name
    CountAllNonDerived... (two) reject a Count on the result
    QueryIsSubclassOf(IClass) adopt, changed QueryIsSubclassOf(IClass), false for the class itself (the SysML2.NET version returns true for it, and is not called)
    QueryDerivesFrom(string) adopt QueryIsSubclassOf(string name); matches on the name only
    (new) add IClassifier.QueryConformsTo(IType), the operation Classifier::conformsTo of the specification, true for the classifier itself
    QueryAllSuperClasses reject equals QueryAllGeneralClassifiers().OfType<IClass>()
    QueryConcreteAncestors, HasConcreteBase reject one project, three calls, a one-line filter over QueryAllGeneralClassifiers
    QueryAllOppositeReferencesToMe adopt, renamed QueryReferencingProperties, with the behaviour of mycelium-forge (nested and imported packages, no failure without a root package)
    QueryOwnedManyToManyProperties adopt same name, sorted by name

    Property and Operation

    Candidate Verdict In uml4net
    QueryIsManyToMany reject identical to QueryIsMemberOfManyToMany
    QueryIsEnumPropertyWithDefaultValue adopt the SysML2.NET version: the default is an instance value that refers to an enumeration literal. The mycelium-forge version also accepts a string literal; its output can change for such models.
    QueryPropertyIsPartOfNonDerivedCompositeAggregation adopt built on QueryIsContainment and QueryIsContained
    IProperty.QueryOwnedConstraints adopt half the rules of the owning class whose constrainedElement holds the property. The lookup by the name derive{Class}{Property} is a SysML v2 convention and stays in SysML2.NET.
    IOperation.QueryOwnedConstraints reject returns operation.OwnedRule

    Package and Element

    Candidate Verdict In uml4net
    QueryContainedAndImported reject QueryAllNestedAndImportedPackages covers 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.
    QueryAllElementComments adopt, rewritten QueryAnnotatingComments: the comments that annotate the element through Comment::annotatedElement, owned by it or not. QueryDocumentation and QueryRawDocumentation do not change.
    QueryAllElementCommentsIncludingEA reject depends on a method that uml4net no longer has; the Enterprise Architect reader adds that documentation as owned comments
    QueryDocumentationText reject QueryRawDocumentation returns the comments joined on one line
    QuerySummary(maxLength) adopt first sentence of the documentation, truncated

    Correction to the description

    SysML2.NET and mycelium-forge reference uml4net packages at 8.4.0 and 8.6.0. EORSADB references uml4net.Reporting 5.2.2.

  2. samatstariongroup commented on Oct 11, 2026

    @samatstariongroup
    MemberAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions