MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - metamodel of type and of instance
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

metamodel of type and of instance

 Post Reply Post Reply
Author
Message
edward22243 View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 19.Apr.2019
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Topic: metamodel of type and of instance
    Posted: 04.Jun.2021 at 10:17
Was thinking hard on how to call the title, because it becomes quit fussy at the meta-meta-level. I think it covers of what I try to achieve, but I try to explain it as concretly as possible:


I have a Graph named "SkillType" in which the user can define the content of a kind of skill. It consists of only any number of Objects called "SkillPropertiesType" (and other kind of objects which I omit to keep the story simple). So I can make instances of a Graph with 2 SkillPropertiesTypes and another Graph with 3 different SkillPropertiesTypes for example. 

Now I want to define a different Graph with all kind of Skills objects are connected . Each "Skill" object has a "SkillType" (there may be skills that have the same SkillType) and must provide properties for each "SkilPropertiesType" defined in the "SkillType". 

Now question on how to achieve this:
1) "Skill" has a "SkillType"  : I can put the "SkillType" graph as a parameter in a "Skill" object, or as a subgraph. Anyway, there are ways to be able to couple the "SkillType" graph to the skill object.
2) must provide properties for each "SkilPropertiesType" defined in the "SkillType" : here I am lost. 

Naively I think there should be a way to get the SkilPropertiesType from the underlying SkillType and be able to generate properties in the Skill object that can be filled in by the user. But I could not find such a mechanism availble (this would mean that properties are created dynamically and I think that is not possible).

I also thought of the following (see next figure). I extend the SkillType with a "SkillPropertiesInstance" object (yellow box). In the graph I add properties a collection of SkillPropertiesInstances and add the existing instances in the graph to the collection. So if I change the properties, I directly change the SkillPropertiesInstances. I add the "skilltype"-graph as a property in the skills graph where I can define the "skills" then I can change it. But of course, I make a thinking-mistake: Because when I change the skill than I change the SkillType and thus change it for any Skill.

So who can help me out? I am going in circles here.

Back to Top
edward22243 View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 19.Apr.2019
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Posted: 04.Jun.2021 at 10:24
maybe extra info:
The SkillType Graph is something the user defines. Therefor I want to keep this a general model. I could of course make dedicated Graphs for every possible Skill Definition and avoid this problem, but we require this flexibility. 


Edited by edward22243 - 04.Jun.2021 at 10:25
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 602
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 04.Jun.2021 at 10:27
Since you're in a metamodeling tool, the most natural solution is to define the SkillTypes and SkillPropertiesTypes in a metamodel. That way the modeler can make true instances of these, and they will obey the rules of the metamodel. 

If you like to define your metamodels graphically, you can do that too. The demo repository has the GOPRR project, a graphical (meta)modeling language that generates MetaEdit+ XML metamodels and imports them. See the Graphical Metamodeling manual for details.

And since the graphical GOPRR language is just a normal MetaEdit+ language, and the generators are just normal MERL, you can freely build your own similar graphical metamodel language, generating the same XML format (MXT files).
Back to Top
edward22243 View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 19.Apr.2019
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Posted: 04.Jun.2021 at 13:47
Thank you for the response.

I thought I was already making a meta-model.

I looked at the GOPPR project and it seems that the mxt-files generates graphs, objects, etc. that I also can make with the normal modeling tooling (graph-, object-tool etc.). Or am I mistaken.

Thus, I think, remains the question, how to go about achieving this.


Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 602
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 04.Jun.2021 at 14:24
Graph Tool, Object Tool etc. are metamodeling tools, with which you directly edit a metamodel.
Diagram Editor, Graph Browser etc. are modeling tools, with which you directly edit models.
The models are instances of the metamodels.

Your original title "metamodel of type and of instance" describes what you have at the moment, correctly I believe. You have a MetaEdit+ metamodel containing "SkillType" and also "Skill", and MetaEdit+ models containing instances of SkillType and instances of Skill. However, you don't really have a type-instance connection between a SkillType instance and a Skill instance - they're just two objects in the model. 

The following sentences indicates to me that you want a true type-instance connection:
Quote "Each "Skill" object has a "SkillType" (there may be skills that have the same SkillType) and must provide properties for each "SkilPropertiesType" defined in the "SkillType"... here I am lost. 

To take a concrete example from your first screenshot: you want a MetaEdit+ object type called "Rotational2" which has two properties, diameter and torque. So when the user instantiates it, he sees a property dialog that looks something like this:


The only way you'll get that is if Rotational2 exists as an Object type in the metamodel. To make a MetaEdit+ metamodel based on a MetaEdit+ model, generate the MXT file, part of whose contents will be:

<object typeName="Rotational2">
  <slot name="diameter (m)">
    <property typeName="diameter">
      <dataType>
        <simpleType>Number</simpleType></dataType></property></slot>
  <slot name="torque (Nm)">
    <property typeName="torque">
      <dataType>
        <simpleType>Number</simpleType></dataType></property></slot>
</object>


Back to Top
edward22243 View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 19.Apr.2019
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Posted: 04.Jun.2021 at 14:48
Thank you. I was thinking along a similar line after I posted my comment.

The Rotational2 object can only be defined if its properties are defined first by the user that defines graph SkillType.

This, I think means we need different steps in the development proces ( as I think you also mean it):
1) The user defines graphs with SkillType (so with different parameterobjects)
2) I need to make a generator that iterates over all SkillType graphs, and this generator makes one graph with objects (one for each SkillType graph) with parameters matching the red parameter blocks in MXT.
3) Load the MXT Graph. 
4) Instatiate the new graph, that now contains all "Skill" objects with parameters as defined in SkillType (like Rotational2).

If I understand it correctly this is the preferred way forward please confirm, I can certainly give this a shot. 

Another question: When I make the objects as described, I would also like to be able to reach the "SkillType" from the newly made skill. I could make a parameter in the object that can contain a Graph, but in MXT I think I cannot populate this with the SkillType (similarly probably I cannot store the oid of the Skilltype when I generate the skill? just thinking out loud)

Thanks for the help so far.
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 602
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 04.Jun.2021 at 15:19
Yes, that's correct. 

An instance in MetaEdit+ always knows its type. You can reach the Rotational2 "SkillType" Object type from any instance of Rotational2 with the Help button in the Property dialog, or the Edit Type popup in the sidebar of the Diagram Editor. If there's extra information from the original "SkillType" Graph instance or "SkillPropertiesType" Object instance, that can be included in the Description of the generated Object type or Property type. You can't however make an Object type's instances all refer to a particular Object instance when created.
Back to Top
edward22243 View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 19.Apr.2019
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Posted: 05.Jun.2021 at 22:23
The objects I am creating with the generator I want them to have a similar graphical layout (symbol editor). The graphical layout is not described in mxt so it is empty. 

If I create the objects as a subtype of a common superobject which has a graphical layout than this layout is not used by the subtypes. 

Would it be possible (feature-request?) that when you create a subtype of an object that the graphical layout is used of the object from which the subtype is derived? This could be done by default, unless you specify your own graphical layout for the subtype.


Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 602
Post Options Post Options   Thanks (1) Thanks(1)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 09.Jun.2021 at 16:53
You can create the symbols in the MXT file - they use SVG with a few extensions. If you want the same symbol in your generated MXT object types, the easiest thing is to create it and export it from Type Manager as part of an MXT file, then Paste As Quoted into your MERL generator.
Back to Top
edward22243 View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 19.Apr.2019
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Posted: 09.Jun.2021 at 17:13
thanks. I experimented a bit with exporting and I noticed indeed the graphical objects are exported as well.  
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 10.16
Copyright ©2001-2013 Web Wiz Ltd.

This page was generated in 0.077 seconds.