by Chris Daly (cjdaly@us.ibm.com)
Copyright IBM Corp. 2004
Emfatic is a language designed to represent EMF Ecore models in a
textual form. This document shows the basic steps involved in
working with Emfatic.
Please see the Emfatic Language
Reference for a full
explanation of the syntax and sematics of the Emfatic language.
In this document, Emfatic programs are shown in boxes
as in the example below:
package test;
class Foo { }
When compiled, the program above will produce a model with an EPackage named "test" containing a
single EClass named "Foo".
Let's go ahead and create an Emfatic file with the above source code:
Create a new project or use an existing one for the next step (it
doesn't matter what kind of project you choose or which Eclipse
perspective you are in).
Create a new file called "test.emf".
Enter the two lines from the box above in test.emf.
Save test.emf.
In the Navigator view (or Package Explorer), right-click on
test.emf and select Generate Ecore
Model.
Now you should see a new file called "test.ecore" in the Navigator (In
the same folder as test.emf). Try the following:
Open test.ecore (using the default EMF Ecore model editor)
Right-click on the EPackage "test" and select New Child -> EClass.
Select the new EClass, right-click and Show Properties View.
In the Properties view, enter the name "Bar" for the EClass
In the Properties view, change the value of the property Abstract
to true.
Save test.ecore.
In the Navigator view, right-click on test.ecore and select Generate Emfatic Source.
Look at test.emf again. It should now look something like this:
package test;
class Foo {
}
abstract class Bar {
}
You have now seen the basic steps involved in working with
Emfatic.
Here are a few key points to stress:
Emfatic source files use the extension .emf
Save your Emfatic and Ecore files before invoking the "Generate"
actions (Emfatic reads the file from disk rather than looking at the
contents of the editor)
Emfatic will overwrite existing files as you invoke the
"Generate" actions, so be careful!