Skip to content

Commit

Permalink
Fixed transformation of generalization sets
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Nov 15, 2024
1 parent 266921a commit 22e219c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,28 @@ Class {

{ #category : 'transforming' }
OntoUMLTransformComposition >> createComposition [

| composition |
composition := OPUMLAssociation new.
composition name: transformer name.
self createCompositionEndFor: composition withEndType: transformed general withOpposingEnd: transformed specific navigable: false.
self createCompositionEndFor: composition withEndType: transformed specific withOpposingEnd: transformed general navigable: true.
composition memberEnds addAll: composition ownedEnds.
^ composition.

composition memberEnds add: (self
createCompositionEndFor: composition
withEndType: transformed general
withOpposingEnd: transformed specific
navigable: false).
composition memberEnds add: (self
createCompositionEndFor: composition
withEndType: transformed specific
withOpposingEnd: transformed general
navigable: true).
self assert: composition memberEnds size = 2 description: [
'Generated association has only 1 end. '
, (transformer transformed generalizations size = 1
ifTrue: [
' Might be caused by generalization set with only 1 generalization' ]
ifFalse: [ '' ]) ].
^ composition
]

{ #category : 'transforming' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ Class {

{ #category : 'transforming' }
OntoUMLTransformGeneralization >> transform [

| generalization |
generalization := OPUMLGeneralization new.
generalization specific: (controller getTransfomedElementFrom: transformed specific).
generalization general: (controller getTransfomedElementFrom: transformed general).
self copyCommentsFrom: transformed to: generalization.
generalization specific:
(controller getTransfomedElementFrom: transformed specific).
generalization general:
(controller getTransfomedElementFrom: transformed general).
self copyCommentsFrom: transformed to: generalization.
controller addElementToTransformedModel: generalization.
^ generalization.
^ generalization
]
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,25 @@ OntoUMLTransformGeneralizationSet >> setGeneralProperties [

{ #category : 'private - transforming - composition' }
OntoUMLTransformGeneralizationSet >> setName [
((transformer name ifNil: [ '' ]) endsWith: 'XOR') ifTrue: [ ^ self. ].
transformer name: (transformer transformed name ifNil: [ transformer general name ]) , ' - XOR'.

((transformer name ifNil: [ '' ]) endsWith: 'XOR') ifTrue: [ ^ self ].
transformer name:
(transformer transformed name ifNil: [ transformer general name ])
, ' - XOR'
]

{ #category : 'transforming' }
OntoUMLTransformGeneralizationSet >> transform [
| selection |
transformer transformed isDisjoint ifTrue: [ ^ self transformDisjointGeneralization. ].

| selection |
transformer transformed isDisjoint ifTrue: [
^ self transformDisjointGeneralization ].
selection := self getSelection.
(selection = 'Gen') ifTrue: [ ^ self transformAsGeneralization. ].
(selection = 'GenAndComp') ifTrue: [ ^ self transformAsGeneralizationAndComposition. ].
(selection = 'Comp') ifTrue: [ ^ self transformAsComposition. ].
^ nil.
selection = 'Gen' ifTrue: [ ^ self transformAsGeneralization ].
selection = 'GenAndComp' ifTrue: [
^ self transformAsGeneralizationAndComposition ].
selection = 'Comp' ifTrue: [ ^ self transformAsComposition ].
^ nil
]

{ #category : 'transforming' }
Expand Down

0 comments on commit 22e219c

Please sign in to comment.