Repository navigation
[Add] Class and Classifier query extension methods and their Handlebars helpers; refs #511 - #515
Merged
Merged
Conversation
|
4 of 20 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Refs #511 (group 1 of 3: Class)
Changes
New extension methods in
uml4net.Extensions:IClass.QueryAllNonDerivedProperties(): the properties ofQueryAllPropertiesthat are not derived.IClass.QueryAllNonDerivedNonRedefinedProperties(): as above, without the properties that are redefined in the context of the class.IClass.QueryIsSubclassOf(IClass)andIClass.QueryIsSubclassOf(string): whether the class is a direct or indirect subclass. A class is not a subclass of itself. The overload that takes a name compares on the name only, case-sensitive.IClassifier.QueryConformsTo(IType): the operationClassifier::conformsToof UML 2.5.1, true for the classifier itself and for its direct and indirect general classifiers.IClass.QueryReferencingProperties(): the owned attributes in the model that are typed by the class, searched in the root package, its nested packages and the packages these import. Empty for a class without a root package.IClass.QueryOwnedManyToManyProperties(): the owned attributes for whichQueryIsMemberOfManyToManyis true, ordered by name.New Handlebars helpers in
uml4net.HandleBars:Class.QueryAllNonDerivedNonRedefinedProperties, ordered by nameClass.QueryIsSubclassOf, with a class or a class name as second argumentClass.QueryReferencingPropertiesClass.QueryOwnedManyToManyPropertiesClassifier.QueryConformsToThe existing helper
Class.QueryAllNonDerivedPropertiesnow calls the new extension method. Its result is unchanged.Where the methods come from
QueryAllNonDerivedPropertiesQueryAllNonDerivedNonRedefinedPropertiesQueryIsSubclassOf(IClass)QueryIsSubclassOf(string)QueryDerivesFrom)QueryConformsToQueryReferencingPropertiesQueryAllOppositeReferencesToMe)QueryIsReferenceProperty.QueryOwnedManyToManyPropertiesSysML2.NET registers a helper
Class.QueryAllNonDerivedNonRedefinedPropertiesof its own. After upgrading, its registration replaces the one of uml4net if it is made later, so its output does not change until it removes its own.Tests
ClassExtensionsTestFixture: six tests for the new methods, againstUML.xmi, including the null and empty arguments.ClassifierExtensionsTestFixture: two tests forQueryConformsTo.ClassHelperTestFixtureandClassifierHelperTestFixture: one test for each new helper, including a wrong context and a wrong number of arguments.Not in this pull request
🤖 Generated with Claude Code