![]() |
Accessing oid of selected object via API or MERL |
Post Reply
|
| Author | ||
Dagijoana
Major Contributor
Joined: 14.Jun.2008 Points: 22 |
Post Options
Thanks(0)
Quote Reply
Topic: Accessing oid of selected object via API or MERLPosted: 30.Jan.2009 at 21:46 |
|
|
Hi Steven,
I want to implement model guidance methods within my models. Therefore I need to get the information (e.g. objectID) of the currently selected element in a model. And when a relationship type is selected in the toolbar, I need the type information as well. This feature would be essential for my further work. Thank you in advance, Dagi |
||
![]() |
||
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 02.Feb.2009 at 12:57 |
|
|
Hi Dagi,
MetaEdit+ already guides users on which relationships are legal between which objects. The modeler selects the objects he wants to connect, and optionally also the relationship type he wants, and MetaEdit+ creates roles and relationships of the correct types. If there is more than one legal combination for the selected objects, MetaEdit+ prompts the modeler to choose from a list of the possibilities.
What you mention in your email tries to achieve the same goal by a different route: when the user has chosen one object and also the relationship type, highlight all the other objects of any type from which a legal combination could be made.
I've seen other tools go even further: you select one object and a relationship type, and the tool offers to create a new object and a relationship to it. That tends to be seen in tools with a weak or naive idea of a graph, where objects can't exist unless they are connected into some structure with other objects, often a tree.
Our approach mirrors the way modelers work: they know the objects without really thinking, but the exact types of the relationships and roles are not always as intuitive. For instance in a family tree, everyone can select objects called "Mum" and "Dad", but they won't necessarily know what names the metamodeler has given to the relationship and role types to connect them: Parent, Spouse, Wife, Mother, Father etc. Or in UML, you can select "Car" and "Wheel", but then have to think if you want an Aggregation or Association between them.
Our approach also copes fine with n-ary relationships and large graphs; imagine yours applied to a large UML class diagram or family tree -- pretty much every object would often be highlighted, which isn't really offering any guidance.
Have you thought through what should happen in your case if there are multiple graphs open, each with an object and relationship type selected? Or multiple objects selected in one graph? Or two diagrams open on the same graph, but with different selections in each? Or a matrix? MetaEdit+ already works with all of those cases. They are also good examples why we don't provide an API command "selectedObject" or "currentRelationshipType" - there is no single answer to that.
What can be done is to use copiedObjects:
That still leaves you without the relationship type and graph, but you could make the next step be to run a generator (which will give you the graph) that calls your API function. That can then figure out the legal relationship types for the selected object(s), and offer to create new relationships and possibly objects based on that, or then highlight some other objects. I'm pretty sure the end result will be longer and more complicated for the modeler (not to mention for you!) than what MetaEdit+ already offers, but then that too is a perfectly valid research result!
|
||
![]() |
||
Dagijoana
Major Contributor
Joined: 14.Jun.2008 Points: 22 |
Post Options
Thanks(0)
Quote Reply
Posted: 02.Feb.2009 at 14:35 |
|
|
Hi Steven,
thank you for your reply! It's true that MetaEdit offers some kind of guidance. But not the way I need it! <<Our approach also copes fine with n-ary relationships and large graphs; imagine yours <<applied to a large UML class diagram or family tree -- pretty much every object would often <<be highlighted, which isn't really offering any guidance. With my approach the DSL would be connected to an expert system, where rules specified in fuzzy logic (to deal with heuristics) are used to say if a relationship between objects is correct and going even further complete a model based on the fuzzy result. MetaEdit can cope with a situation to evaluate what kind of relationship types are correct between to selected objects. But this relationship type can be correct regarding the involved types, but suboptimal regarding additional expert constraints. I understand your concerns, but is it possible to add API command "selectedObject" or "currentRelationshipType"? Thanks |
||
![]() |
||
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 02.Feb.2009 at 14:54 |
|
|
Thanks for the clarification! Unfortunately, for the reasons I mentioned (multiple diagram editors, each with their own selection and relationship type), there's no way to give a universally correct answer for the API calls you suggest. Whilst we could come up with a hack to satisfy you, obviously things we implement in MetaEdit+ have to be useful and sound for all our users.
The API is intended for users to be able to add new behaviour, not to change existing MetaEdit+ behaviour. As such, it is based on data integration rather than control integration -- only about 4% of the API methods are for control. Maybe you can restate your problem so its input is in the form of model data, rather than the ephemeral state of windows? E.g. as I mentioned above, copy an object in MetaEdit+ and let the relationship selection happen in your API program.
|
||
![]() |
||
Dagijoana
Major Contributor
Joined: 14.Jun.2008 Points: 22 |
Post Options
Thanks(0)
Quote Reply
Posted: 06.Feb.2009 at 14:38 |
|
I understand that... But it still does not solve my problem :( I know that my API call would give incorrect answers in the case of several selected objects in more than open diagram. But I think it is not a big defect, telling a user that modeling guidance in my system only works with only one diagram being opened. Is it possible (just to satisfy me) to give me a patch for that API call? You don't need to implement it to MetaEdit for all users and give the patch to everyone, I just want to do some experimental work and perhaps I come up with a solution or additional functionality that also satisfies you...
Sorry, but I think copying an object is not really an option, because it is not really an intuitive step in modeling when trying to add a new relationship. Regards, Dagi |
||
![]() |
||
jpt
MetaCase
Joined: 25.Mar.2008 Points: 253 |
Post Options
Thanks(0)
Quote Reply
Posted: 10.Feb.2009 at 13:54 |
|
|
Hi Dagi, We have provided custom extensions and they are available as patch files extending the basic MetaEdit+ functionality. We'll contact you directly on these possibility. Yours,
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 |