diff --git a/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformComposition.class.st b/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformComposition.class.st index 316698f..1e5ef5d 100644 --- a/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformComposition.class.st +++ b/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformComposition.class.st @@ -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' } diff --git a/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformGeneralization.class.st b/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformGeneralization.class.st index 4c972d5..ef6e695 100644 --- a/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformGeneralization.class.st +++ b/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformGeneralization.class.st @@ -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 ] diff --git a/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformGeneralizationSet.class.st b/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformGeneralizationSet.class.st index 0098ead..5190a05 100644 --- a/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformGeneralizationSet.class.st +++ b/src/OpenPonk-OntoUML-Transformations/OntoUMLTransformGeneralizationSet.class.st @@ -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' }