Repository navigation
[2397] Display requirement derivations as edges in the General View - #2413
AxelRICHARD merged 1 commit into
Conversation
e991ddc to
d52f2f4
Compare
|
Hello @kkkk1258999, thank your for providing this PR. SysON is an eclipse project and as such, you must sign the Eclipse ECA or I won't be able to merge this PR. Otherwise, it seems you followed our commit messages formatting rules, that's great! Regards, |
9e973cc to
9c031cc
Compare
SysML v2 has no dedicated metaclass for requirement derivation: a derivation is a ConnectionUsage annotated with the #derivation metadata of the RequirementDerivation standard library, or typed by DerivationConnections::Derivation. Nothing detected them, so they were never rendered in the General View, unlike satisfy relations. Displaying them also required fixing how the ends of a connector are resolved. The ends declared with the "end" keyword inside a connection body are imported as plain FeatureMemberships owning a feature with isEnd = true, while getConnectorEnd() only collected the ends owned through an EndFeatureMembership. Every such end was filtered out, leaving connectorEnd, relatedFeature, sourceFeature and targetFeature empty. KerML defines endFeature as the owned features having isEnd = true, an EndFeatureMembership being one syntactic form implying it, so both forms are now collected. That logic is duplicated between ConnectorImpl and ConnectorAsUsageImpl because of multiple inheritance, and both are updated consistently. Add three query services on MetamodelQueryElementService, exposed to AQL through ModelQueryAQLService: - isRequirementDerivation, which recognizes both forms of derivation; - getDerivationOriginalEnd and getDerivationDerivedEnd, which resolve the ends from the #original and #derive metadata carried by them, and fall back on the end order declared by DerivationConnections::Derivation when the ends are not annotated. Resolving the ends from their metadata rather than from their declaration order keeps the edge direction correct whatever order the ends are written in. Add RequirementDerivationEdgeDescriptionProvider, which renders a derivation from the derived requirement to the original one as a dashed edge labelled «derive» with an arrow toward the original requirement, so it can be told apart from the solid «satisfy» edge. Requirement derivations are excluded from the generic ConnectionUsage edge so that a single edge is displayed. Only the display of existing derivations is covered here. Creating a derivation from the diagram and n-ary derivations remain to be done. Bug: eclipse-syson#2397 Signed-off-by: kkkk1258999 <fishing_kaba@yahoo.co.jp>
9c031cc to
9041866
Compare
|
One note on the direct edit tool check that was failing: the «derive» label |
No, it's ok like that, thank you. |
|
Thank you @kkkk1258999 for this contribution, we appreciate! What would be great, is to provide (in a separate issue/PR) the edge tool allowing to create a derive Thank you again. Regards, |
Fixes #2397
Follows the approach agreed in the issue: correct the shared connector-end resolution, then add a dedicated derivation edge.
Shared fix: connector end resolution
The ends declared with the end keyword inside a connection body are imported as plain FeatureMemberships owning a feature with isEnd = true, while getConnectorEnd() only collected the ends owned through an EndFeatureMembership. Every such end was filtered out, so connectorEnd, relatedFeature, sourceFeature and targetFeature were all empty.
KerML defines endFeature as the owned features having isEnd = true, an EndFeatureMembership being one syntactic form implying it, so both forms are now collected. The logic is duplicated between ConnectorImpl and ConnectorAsUsageImpl because of multiple inheritance, and both have been updated consistently.
Requirement derivation edge
SysML v2 has no dedicated metaclass for requirement derivation: it is a ConnectionUsage annotated with #derivation, or typed by DerivationConnections::Derivation. Three query services were added on MetamodelQueryElementService and exposed to AQL through ModelQueryAQLService:
isRequirementDerivation, recognizing both forms;
getDerivationOriginalEnd / getDerivationDerivedEnd, resolving the ends from the #original and #derive metadata they carry, falling back on the end order declared by DerivationConnections::Derivation when the ends are not annotated.
Resolving the ends from their metadata rather than from their declaration order keeps the direction correct whatever order the ends are written in.
RequirementDerivationEdgeDescriptionProvider renders the derivation from the derived requirement to the original one, as a dashed edge labelled «derive» with an arrow toward the original requirement, so it is distinguishable from the solid «satisfy» edge. Derivations are excluded from the generic ConnectionUsage edge precondition so a single edge is rendered.
Regression coverage
ConnectorEndTest (metamodel):
ends owned through EndFeatureMembership resolve;
ends owned through a plain FeatureMembership resolve;
an owned feature with isEnd = false is not returned as an end.
Each case checks connectorEnd, relatedFeature, sourceFeature and targetFeature.
MetamodelQueryElementServiceTest:
a #derivation connection is recognized, a plain one is not;
the ends are resolved from their metadata, including when the derived end is declared first;
the end order fallback applies when the ends carry no metadata.
GVRequirementDerivationEdgeTests (General View):
a derivation between two displayed requirements renders one edge, directed from the derived requirement to the original one, labelled «derive», dashed, with an arrow toward the original requirement;
the same model with the ends declared in the reverse order renders the same edge in the same direction;
exactly one visible edge is rendered and its description id is the derivation edge, so the generic connection edge does not duplicate it.