Repository navigation
Do not rely on derived pragmas to export relations + keep order of ore-many relations - #131
Merged
Merged
Conversation
This was referenced Sep 25, 2026
Member
Author
|
Linked PR: moosetechnology/Famix#1155 |
badetitou
approved these changes
Sep 28, 2026
badetitou
left a comment
Member
There was a problem hiding this comment.
I have minor comment that should not block this MR but if you have time please consider them before any merge
Comment on lines
+188
to
+196
|
|
||
| "A one-to-many relation is exported only on its many side: when we are on the single-valued side, it is never serialized." | ||
| (property isOneToManyRelation and: [ property isMultivalued not ]) ifTrue: [ ^ false ]. | ||
|
|
||
| "A many-to-many relation is serialized only on one side: the one whose name sorts before its opposite's. This avoids exporting the same relation twice while keeping the decision deterministic and independent of the export order." | ||
| (property isManyToManyRelation and: [ property name > property opposite name ]) ifTrue: [ ^ false ]. | ||
|
|
||
| "A one-to-one relation is exported when exporting the second entity of the relation to avoid futurs during import." | ||
| (property isOneToOneRelation and: [ (exportedEntities includes: values anyOne) not ]) ifTrue: [ ^ false ]. |
Member
There was a problem hiding this comment.
Maybe these lines could go before line
values isEmptyOrNil ifTrue: [ ^ false ].
Since it concerns the property state and not its values.
I understand shouldIgnoreProperty: could be updated in a later stage for the full update to process
Member
Author
There was a problem hiding this comment.
I was keeping this line before since I think it will exit faster in most cases. We have a ton of empty collections and nil values. So I though I'd keep the fastest exit first.
I'll merge like this and we can update it later if you really prefer it after
Co-authored-by: Benoit Verhaeghe <benoit@badetitou.fr>
jecisc
added a commit
to moosetechnology/Famix
that referenced
this pull request
Sep 28, 2026
This will be useful if we integrate this: moosetechnology/Fame#131
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.
The Fame exporter is exporting one side of a relation usually by using the derived pragmas. But this is not necessary because it pushes to the developer doing the MM the responsibility to make the export work while this should be the work of the exporter.
Also, in case of one-many relation, in most places of Famix we export the one side of the relation but this cause a lost of order in the multiple side.
I changed that. Relations are exported at most once, whatever their multiplicity:
The derived pragma is ignored on relations: a relation is exported according to these rules whatever its derived status. Only derived properties without an opposite (computed attributes) are still filtered out. Using derived on relations is deprecated and will be removed in a future step.
In future steps we plan to: