MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - More restrictive bindings
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

More restrictive bindings

 Post Reply Post Reply Page  12>
Author
Message
newbie01 View Drop Down
Contributor
Contributor


Joined: 19.Aug.2010
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote newbie01 Quote  Post ReplyReply Direct Link To This Post Topic: More restrictive bindings
    Posted: 18.Sep.2010 at 22:15
Hi,

I'm trying to figure out how to make some of my bindings more restrictive than they currently are.

Let's say I have a Relationship with 2 roles but several different objects. But only certain objects can be used in these roles with certain other objects. That is, all objects cannot be used with all other objects.

For example, let's say my relationship is "causal" and the roles are either "causes" or "is caused by". Let's say object A can "cause" object B and object B can cause object C but object B is not allowed to cause object B (or object A). I don't see a way in the Bindings tab of the Graph tool to make the bindings "more specific." If I have a lot of possible objects that can all use the causal role, but they should only work in specific combinations, how do I define that?

Thanks.
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: 18.Sep.2010 at 23:24
You can define several bindings using the same relationship type and role types but having different object types for each individual binding. Using your example two bindings (containing <Object types><Role types><Relationship type><Role types><Object types>) that specify the rules are:
 
<object A><causes><causal><is caused by><object B>
<object B><causes><causal><is caused by><object C>
 
In the graphical GOPPR this would look like: 
Having defined these bindings the more restrictive bindings you mentioned are defined as there is no causal relationship B->B or B->A. Also A->A, A->C, C->A and C->C are not possible either. You may add such bindings if they are needed.
 
You may also use constraints for roles and relationships to specify which kind of connections objects may have with relationships and roles.
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 18.Sep.2010 at 23:32
You can make as many bindings as you like: you don't need to put all the rules for one relationship type in the same binding.
Relationship Role Object
Causes From A
To B
Causes From B
To C
 
You see this quite often, e.g. Data Flow Diagrams can have Flow from Process to Store, External or Process, and also from Store, External or Process back to Process - but not between a combination of just Stores and Externals. Not all metamodeling languages (i.e. metametamodels) can cope nicely with things like that. That's why GOPPRR has the concept of binding, and bindings are owned by graph types - rather than trying to say that a relationship type owns its bindings, or a relationship type owns its roles, or (worst) an object type knows its bindings.
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 18.Sep.2010 at 23:34
Heh, Juha-Pekka was faster this time! Extra points for the pretty picture too Smile.
Back to Top
newbie01 View Drop Down
Contributor
Contributor


Joined: 19.Aug.2010
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote newbie01 Quote  Post ReplyReply Direct Link To This Post Posted: 19.Sep.2010 at 02:22
I'm not using the graphical GOPPR, I'm using the form-based Graph tool. I don't see how I can create separate bindings using the Graph tool. Does this mean I have to create separate graph types to do this?

When using constraints, could I use the idea of an object being in "at most zero" relationships or roles?

Thanks.
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: 19.Sep.2010 at 12:51
You can just add new bindings by opening the pop-up menu and choosing add... The same relationship type and role types are used in the different bindings but just the object types are different. The result in binding tool should look then something like shown below:
 
Back to Top
newbie01 View Drop Down
Contributor
Contributor


Joined: 19.Aug.2010
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote newbie01 Quote  Post ReplyReply Direct Link To This Post Posted: 19.Sep.2010 at 21:33
Hey, that's pretty easy! Thanks.
Back to Top
newbie01 View Drop Down
Contributor
Contributor


Joined: 19.Aug.2010
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote newbie01 Quote  Post ReplyReply Direct Link To This Post Posted: 19.Sep.2010 at 21:38
That leads to another question, though. If I've already created a model based on this metamodel, how do I re-validate the model based on the updated metamodel?
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 20.Sep.2010 at 12:59

The quick answer is that there is no magic "revalidate" button. Generally metamodel changes fall in two phases: 1) metamodel development and 2) metamodel use.

1) During development, the only real user is the metamodeler, and models at that stage are small and often just for playing around with the language. Those kind of models are updated by hand (or even thrown away if the language changes completely). At this stage there's little point trying to automate model updates (beyond what MetaEdit+ offers automatically), because it would take longer to build the automation than simply do it once by hand.
 
2) During metamodel use, existing models generally shouldn't be rendered invalid by metamodel changes. They represent real products, and probably a fair amount of work by the modelers. Just as with the evolution of programming languages, the old structures should be allowed - in other words, the models must still open OK, and generators must still work with them. Modelers need to be warned of the obsolesence, not only in the "language version release notes" but also in the models themselves. The best way to do this is often with a little generator that finds the old structures; this can then be run as part of a checking report, and also by the symbols of the elements in question - e.g. so they show a red exclamation mark or some other warning sign. Where possible there should also be advice on the recommended way to update the models, e.g. "Please replace instances of Foo with NewFoo".
 
Of course if the change can be specified precisely, it's easy enough to use the API to write a model transformation that automates the update. In practice this is actually vanishingly rare - there's just something about language evolution, whether in human languages or computer languages, that makes this kind of change unusual.
 
In fact, most changes to metamodels in production are benign, not requiring changes to existing models. Nine times out of ten, the changes are structural extensions which are handled automatically by MetaEdit+, which upgrades the existing models. Rules are more often relaxed than tightened - the metamodeler initially often tries to lock things down too much. Modelers intuition of the domain and language allows them to see things like new ways of connecting objects, along with the appropriate semantics of what that would mean. The metamodeler then relaxes the rule forbidding that kind of connection, and extends the generators to provide appropriate code for that case.
Back to Top
newbie01 View Drop Down
Contributor
Contributor


Joined: 19.Aug.2010
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote newbie01 Quote  Post ReplyReply Direct Link To This Post Posted: 21.Sep.2010 at 23:36
You mention a checking report generator. Do you have instructions on how to create one of these or maybe an example? When you mention displaying a red exclamation point, you're referring to doing that in the checker, not in the model itself, right?
Back to Top
 Post Reply Post Reply Page  12>

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.045 seconds.