Skip to content

ST6RI-797 PortConjugation elements have no elements listed in the JSON source field #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2024

Conversation

seidewitz
Copy link
Member

@seidewitz seidewitz commented Nov 8, 2024

This PR corrects a bug causing the source and conjugatedType fields of PortConjugation to not be set. This results in the JSON emitted by the SysML2JSON utility to produce empty values for these attributes. They should both be populated with the conjugatedPortDefinition of the PortConjugation.

PortConjugation is a specialization of the KerML Conjugation relationship. The Conjugation::conjugatedType property redefines Relationship::source. In KerML, a Conjugation may or may not be owned by its conjugatedType. If it is owned, then its owningType must be the same as its conjugatedType – but these are still two separate properties. In SysML, PortConjugation::conjugatedPortDefinition redefines Conjugation::owningType, and a PortConjugation must be owned by its conjugatedPortDefinition. But PortConjugation also inherits conjugatedType, which should be the same as conjugatedPortDefinition (i.e., the owningType), and, therefore, the value of source should also be the same as conjugatedPortDefinition.

In the Pilot Implementation, the Conjugation::getSource operation calls getConjugatedType to get the source of a Conjugation. However, when a Conjugation is parsed with an owningType, the conjugatedType property is not set during parsing. Instead, it is set by ConjugationAdapter::postProcess to the value of owningType. In this way, getSource, getConjugatedType and getOwningType all return the same value for a Conjugation with an owningType.

For a PortConjugation, there is additional post-processing required to set the originalPortDefinition of the PortConjugation to the owner of the conjugatedPortDefinition. This is done in PortConjugationAdapter::postProcess, which overrides ConjugationAdapter::postProcess. Unfortunately, PortConjugationAdapter::postProcess was not calling super.postProcess(), so the base Conjugation post-processing was not being carried out for a PortConjugation. As a result, the conjugatedType property was never set for a PortConjugation, so getConjugatedType just returned null (and, hence, getSource returned the empty list), even though conjugatedPortDefinition is non-null.

Adding the super.postProcess() call fixes the bug.

@seidewitz seidewitz added the bug Something isn't working label Nov 8, 2024
@seidewitz seidewitz added this to the 2024-10 milestone Nov 8, 2024
@seidewitz seidewitz self-assigned this Nov 8, 2024
@seidewitz seidewitz merged commit fddff6b into master Nov 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant