Rational Rose creates an EMF Model

Source: Internet
Author: User

The creation of EMF by Rational Rose is more intuitive than that of XSD and Java Bean, and more in line with the "design state ". In some important applications, we often see EMF models created by Rational Rose, such as EMF itself, UML2, WTP, and DTP.

 

Rational Rose has many versions. I use 7.0.0.4-ifix02, which is basically compatible with common EMF models.

 

1. Open the previous settings.

Any EMF ecore model must reference ecore. In the eclipse plugins directory, there is an org. eclipse. EMF. decompress the ecore plug-in to a directory on the hard disk. For example, D: \ extract \ ORG on my machine. eclipse. EMF. ecore: All ecore model descriptions under the subdirectory model. Here we only pay attention to two files: ecore. MDL and org. eclipse. EMF. ecore. cat is a rational rose file.

 

Use a text editor such as NotePad ++ to open ecore. MDL and you will see$ Vabase_plugins_pathThis is the path map to be set in Rational Rose. Open Rational Rose and set this variable in the menu File> edit path map. For example, mine:

 

It is best to restart Rational Rose after this setting is complete.

2 reference ecore

Create a package in Rose's logical view before referencing, because EMF is in the unit of package. After the creation, select control XXX to generate a cat file.

Select File-> unit-> load. In the displayed dialog box, select Org. eclipse. EMF. ecore. so that the ecore package is introduced.

Now there is no problem in creating a class under the package. You can also use the relevant model elements of ecore. However, there is no way to set up some non-Rational Rose information. For example, in EMF, a class named man has an ID attribute as the primary key. In this case, we need to introduce some "extra" ecore meta model information, which is the Pty file of Rational Rose.

3. Set the ecore Pty

The Pty file of ecore is also located in the eclipse plugin directory, find Org. eclipse. EMF. importer. the rose plug-in, decompress it to a directory, and there is an ecore under its subdirectory named "Rose. pty File

Right-click the model properties at the bottom of the Rose Project, select "add" in the menu, and select the ecore. Pty file you just saw. What will happen after adding it?

No class attribute page added before ecore. Pty

Added a class attribute page before ecore. Pty.

We can see that there is an additional setting page named ecore, which contains the various additional settings we have seen.

4. Import EMF Model

Use eclipse with emf sdk installed, create a new empty EMF project, and then create a new EMF generator model through the wizard, select rose class model on the select a model importer Wizard Page.

During the import process, a dialog box containing cdm_extract_path is also set to the directory of the extracted plug-in. For example, my local machine is D: \ extract.

 

5 Use of stereotype

Stereotype is a powerful extension mechanism provided by UML, and EMF is also used. common ones are as follows:

  • Enumeration: If the stereotype of a class is enumeration, after the import, all attributes of the class will be used as emum literal, and the class itself will become an ecore emum.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.