Book a Demo

Author Topic: HOW TO CREATE A METAMODEL?  (Read 4322 times)

alexgua

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
HOW TO CREATE A METAMODEL?
« on: November 26, 2006, 03:01:51 am »
Hi! I'm a new user and I need to make a metamodel defining some metaclass and their relations to use in a new project. I have two questions:

1) How can I make this metamodel? Do I need to do the use case using metaclass? and how can I save this, as a profile?

2) How can I load this metamodel?

I expect you can help me. Thank you so much.

Dave_Bullet

  • EA User
  • **
  • Posts: 295
  • Karma: +0/-0
    • View Profile
Re: HOW TO CREATE A METAMODEL?
« Reply #1 on: November 26, 2006, 07:01:36 pm »
I presume you want to create a uml profile - which contains new stereotypes that will get a standard (user defined) set of tagged values when you add elements to a model?

If so - you are after UML profiles.  The help file does a good job of explaining this.

Open the help index and search on "uml profiles".  At the bottom there is a link "creating profiles" - which gives you a step by step explanation.

Come back here if it isn't clear and I can help you.  

The following are advanced topics - thought I'd post it here to help others so don't worry if you don't understand them yet.... (this site really needs a wiki).

There are a couple of bugs with UML profiles in EA as follows:

1. Do not include an special characters in the names (ie. like parenthesis - ( or ) ), otherwise EA will give you an error on saving as a UML profile.  This is logged with Sparx as a bug

2. You should be able to inherit stereotypes - but a sync on tagged values won't create the superclass tagged values

One you have defined your own custom stereotypes, you can define shapescript to change their appearance.   Don't define this on the "Settings -> UML -> Stereotypes" dialog.  Instead, define the shape script in the profile. You do that by giving the <<stereotype>> class an attribute _image. On the properties dialog for _image, click the "..." button next to the Initial Value field; this will open the Shape Editor dialog.
After entering the shape script, save the profile as normal.

Cheers,
David.
"I know I'm close to a good design, but it's like the balloon animals, squeeze in one spot and the problem moves down the line"

alexgua

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: HOW TO CREATE A METAMODEL?
« Reply #2 on: November 27, 2006, 03:35:41 am »

I want to create some metaclass to define the behaviour between these components in a project. For example, I want to define a component "Program" that has some components "Atributes". And I want to describe this behaviour.

Anyway, I'm going to try to make a design as you explained me and I'll expect it works. Thank you so much, David

Alex

Dave_Bullet

  • EA User
  • **
  • Posts: 295
  • Karma: +0/-0
    • View Profile
Re: HOW TO CREATE A METAMODEL?
« Reply #3 on: November 27, 2006, 12:29:45 pm »
What I described was simply a way to create your own "program" stereotype (based on whatever metaclass type you like - ie. component, node, requirement etc....) - then add standard tagged values to each "program" element you add to a model.

To define some sort of built in relationship / behaviour - you might need to look at "patterns" in EA.  Something I haven't played with.

Cheers,
David.
"I know I'm close to a good design, but it's like the balloon animals, squeeze in one spot and the problem moves down the line"

alexgua

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: HOW TO CREATE A METAMODEL?
« Reply #4 on: November 29, 2006, 11:34:54 am »

I try to make the profile and I can do it, but I have more questions. I expect someone can answer me:

1) How can I describe the behaviour of my stereotype components? I try to make a pattern, but I think a pattern is not the right solution.

2) How can I put a mandatory attribute in a stereotype component? I put a new attribute in a stereotype component, but when I make a new instance, it does not work.

3) David, a question for you: I do not understand very well how to use the variable _image. I put the path of the image, but it is wrong. I expect you can help me in this question.

Thank you so much.

Thank you, David

Dave_Bullet

  • EA User
  • **
  • Posts: 295
  • Karma: +0/-0
    • View Profile
Re: HOW TO CREATE A METAMODEL?
« Reply #5 on: November 29, 2006, 12:08:51 pm »
1) Sorry - don't have the experience here to help  :-/

2) I think you have to use OCL to force entry of tagged values??  I couldn't get this to work when I tried. (I'd like this too, so if you figure it out, appreciate if you could let me know)

3) First, you should load the images you need into the project. Do this via Settings -> Images menu.  You can then access your image in shapescript like this:

   image("BladeServerHS20.wmf",1,1,96,87);

No path necessary.  I've never tried a path, but loading into the project guarantees you won't have path issues for your users, plus if you transfer the project to say an EAP and take off-site - you have all your images with you.

Cheers,
David.
« Last Edit: November 29, 2006, 12:09:14 pm by Dave_Bullet »
"I know I'm close to a good design, but it's like the balloon animals, squeeze in one spot and the problem moves down the line"

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: HOW TO CREATE A METAMODEL?
« Reply #6 on: November 29, 2006, 02:13:22 pm »
Quote
2) How can I put a mandatory attribute in a stereotype component? I put a new attribute in a stereotype component, but when I make a new instance, it does not work.


The way that I do this is I have an add-in that responds to the EA_OnPostNewElement broadcast event.

If that answer appears to make no sense, then have a read of the EA help chapters "The Automation Interface" and "Add-Ins" and come back with any questions...
The Sparx Team
[email protected]