Skip to content

Commit

Permalink
Moved to Tonel 3
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jun 18, 2024
1 parent 8c47ab7 commit b07b60b
Show file tree
Hide file tree
Showing 20 changed files with 254 additions and 219 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #BaselineOfOntoUMLTransformationFramework,
#superclass : #BaselineOf,
#category : #BaselineOfOntoUMLTransformationFramework
#name : 'BaselineOfOntoUMLTransformationFramework',
#superclass : 'BaselineOf',
#category : 'BaselineOfOntoUMLTransformationFramework',
#package : 'BaselineOfOntoUMLTransformationFramework'
}

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfOntoUMLTransformationFramework >> baseline: spec [
<baseline>
spec
Expand Down
2 changes: 1 addition & 1 deletion src/BaselineOfOntoUMLTransformationFramework/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfOntoUMLTransformationFramework }
Package { #name : 'BaselineOfOntoUMLTransformationFramework' }
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
Class {
#name : #OntoUMLAssociationTransformer,
#superclass : #OntoUMLTransformer,
#category : #'OntoUML-TransformationFramework-Transformers'
#name : 'OntoUMLAssociationTransformer',
#superclass : 'OntoUMLTransformer',
#category : 'OntoUML-TransformationFramework-Transformers',
#package : 'OntoUML-TransformationFramework',
#tag : 'Transformers'
}

{ #category : #accessing }
{ #category : 'accessing' }
OntoUMLAssociationTransformer class >> defaultTransformation [
^ OntoUMLTransformAssociation.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLAssociationTransformer class >> getTransformation: aAssocitaion [
| stereotypeClass |
stereotypeClass := OntoUMLModelQuery getStereotypeClass: aAssocitaion.
^ super getTransformation: stereotypeClass.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLAssociationTransformer class >> initializeTransformationIndex [
transformationIndex := Dictionary new.
transformationIndex add: (OntoUMLSubQuantityOf -> OntoUMLTransformSubQuantityOf).
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLAssociationTransformer >> transform [
transformed memberEnds first type = transformed memberEnds second type ifTrue: [ ^nil. ].
^ (self class getTransformation: transformed) transform: transformed withController: controller withTransformer: self.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
Class {
#name : #OntoUMLClassTransformer,
#superclass : #OntoUMLTransformer,
#category : #'OntoUML-TransformationFramework-Transformers'
#name : 'OntoUMLClassTransformer',
#superclass : 'OntoUMLTransformer',
#category : 'OntoUML-TransformationFramework-Transformers',
#package : 'OntoUML-TransformationFramework',
#tag : 'Transformers'
}

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLClassTransformer class >> defaultTransformation [
^ OntoUMLTransformClass.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLClassTransformer class >> getTransformation: aClass [
| stereotypeClass |
stereotypeClass := OntoUMLModelQuery getStereotypeClass: aClass.
^ super getTransformation: stereotypeClass.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLClassTransformer class >> initializeTransformationIndex [
transformationIndex := Dictionary new.
"Currently there are no class specific transformations."
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLClassTransformer >> transform [
^ (self class getTransformation: transformed) transform: transformed withController: controller withTransformer: self.
]
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
Class {
#name : #OntoUMLGeneralizationSetTransformer,
#superclass : #OntoUMLTransformer,
#name : 'OntoUMLGeneralizationSetTransformer',
#superclass : 'OntoUMLTransformer',
#instVars : [
'generalizations',
'name'
],
#classInstVars : [
'savedTransformation'
],
#category : #'OntoUML-TransformationFramework-Transformers'
#category : 'OntoUML-TransformationFramework-Transformers',
#package : 'OntoUML-TransformationFramework',
#tag : 'Transformers'
}

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationSetTransformer class >> defaultTransformation [
^ [ :generalizations :controller :transformer | OntoUMLTransformGeneralizationSet transform: generalizations withController: controller withTransformer: transformer. ].
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationSetTransformer class >> generalizationSetGroups [
"Order of elements in collection determines order of the transformation"
^ { 'Phase'. 'Role'. 'RoleMixin'. 'Mixin'. 'Object'. "Object = all remaining GenSet groups" }.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationSetTransformer class >> initializeTransformationIndex [
transformationIndex := Dictionary new.
transformationIndex add: ('Phase' -> [ :generalizations :controller :transformer | OntoUMLTransformGeneralizationSet transformAsComposition: generalizations withController: controller withTransformer: transformer. ]).
Expand All @@ -31,44 +33,44 @@ OntoUMLGeneralizationSetTransformer class >> initializeTransformationIndex [
transformationIndex add: ('Mixin' -> [ :generalizations :controller :transformer | OntoUMLTransformGeneralizationSet transformAsComposition: generalizations withController: controller withTransformer: transformer. ]).
]

{ #category : #accessing }
{ #category : 'accessing' }
OntoUMLGeneralizationSetTransformer class >> savedTransformation [

^ savedTransformation
]

{ #category : #accessing }
{ #category : 'accessing' }
OntoUMLGeneralizationSetTransformer class >> savedTransformation: anObject [

savedTransformation := anObject
]

{ #category : #accessing }
{ #category : 'accessing' }
OntoUMLGeneralizationSetTransformer >> general [
^ controller getTransfomedElementFrom: transformed generalizations first general.
]

{ #category : #accessing }
{ #category : 'accessing' }
OntoUMLGeneralizationSetTransformer >> name [

^ name
]

{ #category : #accessing }
{ #category : 'accessing' }
OntoUMLGeneralizationSetTransformer >> name: anObject [

name := anObject
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationSetTransformer >> transform [
transformed generalizations ifEmpty: [ ^{}. ].
(OntoUMLModelQuery isStereotypeOf: transformed generalizations first general oclKindOf: 'Sortal')
ifTrue: [ ^ self transformSortalGenSet. ]
ifFalse: [ ^ self transformNonSortalGenSet. ].
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationSetTransformer >> transformGroup: aGroup [
| transformedGeneralizations transformation result |
transformedGeneralizations := generalizations select: [ :generalization | OntoUMLModelQuery isStereotypeOf: generalization specific oclKindOf: aGroup. ].
Expand All @@ -79,14 +81,14 @@ OntoUMLGeneralizationSetTransformer >> transformGroup: aGroup [
^ result.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationSetTransformer >> transformNonSortalGenSet [
generalizations := OrderedCollection new.
generalizations addAll: transformed generalizations.
^ OntoUMLTransformGeneralizationSet transformWithoutCombination: generalizations withController: controller withTransformer: self.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationSetTransformer >> transformSortalGenSet [
generalizations := OrderedCollection new.
generalizations addAll: transformed generalizations.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
Class {
#name : #OntoUMLGeneralizationTransformer,
#superclass : #OntoUMLTransformer,
#category : #'OntoUML-TransformationFramework-Transformers'
#name : 'OntoUMLGeneralizationTransformer',
#superclass : 'OntoUMLTransformer',
#category : 'OntoUML-TransformationFramework-Transformers',
#package : 'OntoUML-TransformationFramework',
#tag : 'Transformers'
}

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationTransformer class >> defaultTransformation [
^ OntoUMLTransformGeneralization.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationTransformer class >> getTransformation: aClass [
| stereotypeClass |
stereotypeClass := OntoUMLModelQuery getStereotypeClass: aClass.
^ super getTransformation: stereotypeClass.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationTransformer class >> initializeTransformationIndex [
transformationIndex := Dictionary new.
transformationIndex add: (OntoUMLPhase -> OntoUMLTransformComposition).
Expand All @@ -26,12 +28,12 @@ OntoUMLGeneralizationTransformer class >> initializeTransformationIndex [

]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationTransformer >> name [
^ ''.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLGeneralizationTransformer >> transform [
^ (self class getTransformation: transformed specific) transform: transformed withController: controller withTransformer: self.
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #OntoUMLTransformAssociation,
#superclass : #OntoUMLTransformation,
#category : #'OntoUML-TransformationFramework-Transformations'
#name : 'OntoUMLTransformAssociation',
#superclass : 'OntoUMLTransformation',
#category : 'OntoUML-TransformationFramework-Transformations',
#package : 'OntoUML-TransformationFramework',
#tag : 'Transformations'
}

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformAssociation >> createAssociation [
| association |
association := OPUMLAssociation new.
Expand All @@ -17,7 +19,7 @@ OntoUMLTransformAssociation >> createAssociation [
^ association.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformAssociation >> tranformAssociationEnd: aAssociationEnd forAssociation: aAssociation [
^ OPUMLProperty new
name: aAssociationEnd name;
Expand All @@ -36,7 +38,7 @@ OntoUMLTransformAssociation >> tranformAssociationEnd: aAssociationEnd forAssoci

]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformAssociation >> transform [
| association |
association := self createAssociation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #OntoUMLTransformAssociationTest,
#superclass : #OntoUMLTransformationTest,
#category : #'OntoUML-TransformationFramework-Transformations'
#name : 'OntoUMLTransformAssociationTest',
#superclass : 'OntoUMLTransformationTest',
#category : 'OntoUML-TransformationFramework-Transformations',
#package : 'OntoUML-TransformationFramework',
#tag : 'Transformations'
}

{ #category : #constants }
{ #category : 'constants' }
OntoUMLTransformAssociationTest >> getAssociation [
| source target association |
source := OPUMLClass new name: 'source'.
Expand Down
22 changes: 12 additions & 10 deletions src/OntoUML-TransformationFramework/OntoUMLTransformClass.class.st
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
Class {
#name : #OntoUMLTransformClass,
#superclass : #OntoUMLTransformation,
#category : #'OntoUML-TransformationFramework-Transformations'
#name : 'OntoUMLTransformClass',
#superclass : 'OntoUMLTransformation',
#category : 'OntoUML-TransformationFramework-Transformations',
#package : 'OntoUML-TransformationFramework',
#tag : 'Transformations'
}

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformClass >> copyAttribute: aAttribute for: aEntity [
(aAttribute isKindOf: OPUMLProperty) ifTrue: [ ^ self copyProperty: aAttribute for: aEntity. ].
(aAttribute isKindOf: OPUMLOperation) ifTrue: [ ^ self copyOperation: aAttribute for: aEntity. ].
^ {}.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformClass >> copyAttributes: aAttributesCollection for: aEntity [
| copy |
copy := aAttributesCollection copyEmpty.
copy addAll: (aAttributesCollection flatCollect: [ :attribute | self copyAttribute: attribute for: aEntity]).
^ copy.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformClass >> copyMultiplicity: aMultiplicity [
| copy |
aMultiplicity ifNil: [ ^ nil. ].
Expand All @@ -29,7 +31,7 @@ OntoUMLTransformClass >> copyMultiplicity: aMultiplicity [
^ copy
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformClass >> copyOperation: aOperation for: aEntity [
| copy |
copy := OPUMLOperation new.
Expand All @@ -42,7 +44,7 @@ OntoUMLTransformClass >> copyOperation: aOperation for: aEntity [
^ { copy. }.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformClass >> copyProperty: aProperty for: aEntity [
| copy |
aProperty association ifNotNil: [ ^ {}. ].
Expand All @@ -61,7 +63,7 @@ OntoUMLTransformClass >> copyProperty: aProperty for: aEntity [
^ { copy. }
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformClass >> createClassFor: aEntity [
| createdClass |
createdClass := OPUMLClass new.
Expand All @@ -72,7 +74,7 @@ OntoUMLTransformClass >> createClassFor: aEntity [
^ createdClass.
]

{ #category : #transforming }
{ #category : 'transforming' }
OntoUMLTransformClass >> transform [
| entityClass |
entityClass := self createClassFor: transformed.
Expand Down
Loading

0 comments on commit b07b60b

Please sign in to comment.