MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Newbie - Nested Objects
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Newbie - Nested Objects

 Post Reply Post Reply
Author
Message
pphelan View Drop Down
Contributor
Contributor
Avatar

Joined: 23.Jun.2008
Location: Ireland
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote pphelan Quote  Post ReplyReply Direct Link To This Post Topic: Newbie - Nested Objects
    Posted: 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


Back to Top
jpt View Drop Down
MetaCase
MetaCase
Avatar

Joined: 25.Mar.2008
Points: 253
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpt Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.057 seconds.