Skip to content

[Add] Property query extension methods and their Handlebars helpers; refs #511 - #516

Merged
samatstariongroup merged 1 commit into
developmentfrom
GH511-property-queries
Oct 11, 2026
Merged

samatstariongroup merged 1 commit into
developmentfrom
GH511-property-queries

Conversation

@samatstariongroup

Copy link
Copy Markdown
Member

Refs #511 (group 2 of 3: Property and Operation)

Changes

New extension methods in uml4net.Extensions:

  • IProperty.QueryIsEnumPropertyWithDefaultValue(): the property is typed by an enumeration and its default value is an instance value that refers to an enumeration literal.
  • IProperty.QueryIsPartOfNonDerivedCompositeAggregation(): the property is composite and not derived, or its opposite is.
  • IProperty.QueryConstraints(): the rules of the namespace that owns the property which have the property as constrained element, in the order of the owned rules.

New Handlebars helpers in uml4net.HandleBars, each with the property as its one argument:

  • Property.QueryIsEnumPropertyWithDefaultValue
  • Property.QueryIsPartOfNonDerivedCompositeAggregation
  • Property.QueryConstraints

Where the methods come from

uml4net Source Difference with the source
QueryIsEnumPropertyWithDefaultValue SysML2.NET and mycelium-forge The behaviour of SysML2.NET. mycelium-forge also returns true for a default value that is a string literal; UML 2.5.1 gives the default of an enumeration as an instance value that refers to the literal.
QueryIsPartOfNonDerivedCompositeAggregation SysML2.NET (QueryPropertyIsPartOfNonDerivedCompositeAggregation) renamed, same behaviour
QueryConstraints SysML2.NET (QueryOwnedConstraints) Renamed, since the property does not own the constraints. The owner may be any namespace, where the source requires a class. The source also returns the constraint named derive{Class}{Property} when no constraint has the property as constrained element; that is a naming convention of the SysML v2 model and stays in SysML2.NET.

Rejected, as recorded in #511: IProperty.QueryIsManyToMany of EORSADB (identical to QueryIsMemberOfManyToMany) and IOperation.QueryOwnedConstraints of SysML2.NET (returns operation.OwnedRule).

A deviation from the plan in #511

The comment in #511 says QueryIsPartOfNonDerivedCompositeAggregation would be built on QueryIsContainment and QueryIsContained. It is not. QueryIsContainment also returns true when the association of the property has a composite owned end, which would change the result for SysML2.NET. The method follows the source: it looks at Property::isComposite of the property and of its opposite.

Tests

  • PropertyExtensionsTestFixture: three tests, against UML.xmi and against elements built in the test, including the null argument.
  • PropertyHelperTestFixture: one test for each new helper, including a wrong argument and a wrong number of arguments.
  • Full suite: all 1,166 tests pass on this branch.

Not in this pull request

🤖 Generated with Claude Code

@sonarqubecloud

Copy link
Copy Markdown

@samatstariongroup
samatstariongroup merged commit d9c1d0a into development Oct 11, 2026
8 checks passed
@samatstariongroup
samatstariongroup deleted the GH511-property-queries branch October 12, 2026 16:40
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.

1 participant