Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: simonspaten on September 13, 2013, 05:23:51 pm
-
Is it possible to exchange the relationship between child and parent of an element? I would like to switch a parent element and its copied child (instance of element) so that the child becomes the parent and vice versa. The background is as follows, I have a detailed diagram of a complex system and need to modulate its less abstract layers / views, "backward engineering“, if you want to give it a name.
-
You can do that with a couple of manual steps (Element/Advanced/Change Type). But that's tedious for many elements. So the best would be to write a script.
- Select child (manually in browser or diagram)
- start script:
-- get selected element
-- locate its classifier (as you say: parent)
-- change both elements to be vice versa
NB: You obviously mean class and instance, not parent and child.
q.
-
Yes, I do mean class and instance! Skripting is no option at the moment due to the fact that it is not me profession, so I followed the other advice. With the discribed manual steps I only was able to change the appearance of the element but not the class or instance relation. Sorry, but the reply above is not very helpful so I need further information, please.
-
The manual way is as follows:
- locate instance (in diagram)
- ctrl-alt-g to find classifier (in browser)
- Change instance to class (element/advanced/change...)
- Change class to instance
- Set new classifier via Cltr-L
You will need a bit of endurance...
q.
-
Thank you again, but I`m still not happy. I tried the manual way as suggested but the third step: "Change instance to class (element/advanced/change...) can`t be solved.
There is nowhere a button to change the instance to class! The only progress I reached with your last advice is that I`m now able to locate the instance in the diagram and find the classifier in the project browser (both highlighted) but I do not know how to change them vice versa.
-
You change instance to class like class to instance via Element/Advanced/Change Type.
q.
-
What qwerty says is true... almost. You probably need to break the link between Classifier and Instance first, because that tends to get in the way. So press Ctrl+L on the Instance and set its Classifier to <none>.
The Instance is an Object element, so change its type from Object to Class, and the classifier from Class to Object. Then do Ctrl+L and re-establish the Classifier link. Also note that the 'new' Class loses its name, so you have to add a new name.
To make a Class an instance, you can also right click on it and select the Advanced | Convert to Instance option.
As qwerty also says, this is very tedious and you'd have to consider if the objective was worth the work you need to do. It's certainly an unusual task. Do you have multiple Instances of any Class?
-
Thanks a lot guys, with this detailed reply above it seems to work.