![]() |
Newbie - Nested Objects |
Post Reply
|
| Author | |
pphelan
Contributor
Joined: 23.Jun.2008 Location: Ireland Points: 10 |
Post Options
Thanks(0)
Quote Reply
Topic: Newbie - Nested ObjectsPosted: 30.Jun.2008 at 12:30 |
|
Hi,
Back again, I have been playing around with nested objects (a good way to learn the ins and outs of different things in MetaEdit). 1st attempt: Object (type A) with nested objects (type B - in a collection) - this worked pretty good until I got to a tricky bit, I can join objects of type A via a relationship if they have a common B in the collection. The Name of the common B became the Name used in the relationship. The problem I had was - if two Type A's had tow or more B's in common - how do I select the relevant B to the name of the relationship. (Can I do a drop-down pre-filled when creating the relationship ?). 2nd attempt: Started looking at the System [UML] example, where type A is effectively a transparent box, and I just create B's and place them inside the box. I can then pick out the B's and join them to B's in other transparent boxs (A's). Worked much better in respect to the problem - I have in the 1st attempt. My question here is can I mak the box A take ownership of the B objects within it (without loads of relationships drawn between the A and all the Bs within it ?). Any thoughs on the above would be appreciated. I kinda like the 1st one but getting the relationships to work correctly is my problem - I am thinking that this "nested object" can be exploded to another graph type once I get it right. I know these are probably simple things once you have the knowledge and experience in the tools - I am still getting to grips with MERL and traversing between objects / relationships etc. Thanks, ~Patsy |
|
![]() |
|
jpt
MetaCase
Joined: 25.Mar.2008 Points: 253 |
Post Options
Thanks(0)
Quote Reply
Posted: 02.Jul.2008 at 23:55 |
|
Hi,
For the first scenario you can use MERL to report on cases where B is common (or is not common) among the instances of A. You can then for example show an error icon or just text next to the relationship with conditional symbols (show text or symbol element if generator reports that there is common B).
If you want to show the instance (name) of B as a value on the relationship you can create the metamodel so that it shares the same type, that is: in B used in the collection and in the relationship. Here you need to do then a decision between referring to the name (string) or to a non-property type (e.g. object type B). If you want to use just name you can use property sharing in the pop-up menu of the relationship to choose the right name. If you prefer reusing a non-property, MetaEdit+ gives you a component selection tool to navigate to the right element in several alternative ways as well as inspecting the details before adding it to the relationship. In both cases any changes to the B in the collection by default will change the value name in the relationship too. This keeps models consistent and minimizes work needed to update models in case of changes. For the second attempt, the ownership is checked at generation side. While running the generator it can check if B is part of an A (or vice versa). The spatial location thus does not take ownership during modeling operations. If the nested structures get more complex, I see that your approach on having a subgraph is the right one. Juha-Pekka |
|
![]() |
|
Post Reply
|
|
| Tweet |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |