blob: 28d6708a31558d1f6d02b6e5500679111c75b96f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Emfatic Language Reference</title>
</head>
<body>
<h1>Emfatic Language Reference&nbsp; (draft)<br>
</h1>
by Chris Daly (cjdaly@us.ibm.com)<br>
Copyright IBM Corp. 2004<br>
<br>
<span style="font-style: italic;">Note: Emfatic, as described here, is
in sync with Emfatic version 0.0.1 available from alphaWorks</span>
(http://w3.alphaworks.ibm.com/techs/overview.jsp?tech=emfatic)<br>
<br>
<br>
<hr style="width: 100%; height: 2px;"><br>
<br>
Emfatic is a language designed to represent EMF Ecore models in a
textual form.&nbsp; This document details the syntax of Emfatic and the
mapping between Emfatic declarations and the corresponding Ecore
constructs.<br>
<br>
<span style="font-weight: bold;">Please see the </span><span
style="font-style: italic; font-weight: bold;">Emfatic Setup Guide</span><span
style="font-weight: bold;"> </span><span style="font-weight: bold;">and</span><span
style="font-weight: bold;"> the <span style="font-style: italic;">Emfatic
G</span></span><span style="font-style: italic; font-weight: bold;">etting
Started Guide</span><span style="font-weight: bold;"> for
information on how to get, install and use Emfatic in your Eclipse
environment.</span><br>
<br>
<h2>1. Packages</h2>
In this document, Emfatic programs are shown in boxes
as in the example below:<br>
<br>
<table
style="width: 100%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 255);"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">package test;<br>
class Foo { }</td>
</tr>
</tbody>
</table>
<br>
When compiled, the program above will produce a model with an <span
style="font-weight: bold;">EPackage</span> named "test" containing a
single <span style="font-weight: bold;">EClass</span> named "Foo".<br>
<br>
As is probably clear from the first Emfatic program above, the keyword <span
style="font-family: monospace;">package</span> introduces an Ecore <span
style="font-weight: bold;">EPackage</span> and the identifier
following it maps to the <span style="font-weight: bold;">name</span>
attribute of the generated <span style="font-weight: bold;">EPackage</span>.<br>
<h3>1.1 Main Package</h3>
The only thing required in an Emfatic source file is a package
declaration.&nbsp; This required element is called the main package
declaration and the <span style="font-weight: bold;">EPackage</span>
it defines will contain (directly or indirectly) all of the other
elements of the generated Ecore model.&nbsp; Thus the simplist possible
Emfatic program would look something like this:<br>
<br>
<table
style="width: 100%; text-align: left; background-color: rgb(204, 204, 255); font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">package p;<br>
</td>
</tr>
</tbody>
</table>
<br>
Specifying values for the <span style="font-weight: bold;">EPackage</span>
attributes <span style="font-weight: bold;">nsURI</span> and <span
style="font-weight: bold;">nsPrefix</span> is done like this:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">@namespace(uri="http://www.eclipse.org/emf/2002/Ecore",
prefix="ecore")<br>
package ecore;<br>
</td>
</tr>
</tbody>
</table>
<br>
Note that Emfatic is case-sensitive in most contexts (reflecting the
underlying case-sensitivity of Ecore), however the identifiers <span
style="font-family: monospace;">namespace</span>, <span
style="font-family: monospace;">uri</span> and <span
style="font-family: monospace;">prefix</span> in the text above could
be written in
any case.&nbsp; Also note that the order of declaration for <span
style="font-family: monospace;">uri</span> and <span
style="font-family: monospace;">prefix</span> is not important<span
style="font-family: monospace;"></span>.&nbsp; The syntax of the <span
style="font-family: monospace;">@namespace</span> declaration is
actually a special case of the more general syntax for declaring
EAnnotations, which will be described in full detail in section 5 below.<br>
<br>
<h3>1.2 Sub-Packages</h3>
Ecore allows packages to be nested inside packages.&nbsp; In Emfatic,
the syntax for nested packages differs from that of the main
package.&nbsp; Nested package declarations are followed by a
curly-brace bracketed region which encloses the nested package
contents.&nbsp; The example below demonstrates package nesting.&nbsp; <br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">package main;<br>
<br>
package sub1 {<br>
}<br>
<br>
package sub2 {<br>
&nbsp; package sub2_1 { }<br>
&nbsp; package sub2_2 { }<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
In the Ecore model generated from the above program, the top-level
package named "main" will contain two packages, "sub1" and "sub2", and
package sub2 will contain the packages "sub2_1" and "sub2_2".<br>
<span style="font-style: italic;"></span><br>
<h3>1.3 Main Package Imports</h3>
Import statements allow for types defined in external Ecore models to
be referenced.&nbsp; All import statements must immediately follow the
main package declaration.&nbsp; The example below demonstrates the
basic syntax of import statements.&nbsp; The double-quoted string
literal following the import keyword must contain the URI of an Ecore
model.<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">package main;<br>
<br>
import "platform:/resource/proj1/foo.ecore";<br>
import "http://www.eclipse.org/emf/2002/Ecore";<br>
<br>
package sub { }<br>
</td>
</tr>
</tbody>
</table>
<br>
Note that Ecore.ecore is automatically imported, so the second import
in the program above is not really necessary.<br>
<br>
<h2>2. Classifiers</h2>
<h3>2.1 Classes</h3>
The Emfatic syntax for class declarations is very similar to Java,
however a few quirks are required to allow for all of the possibilities
of Ecore.&nbsp; The example below containing four simple class
declarations demonstrates the use of the keywords <span
style="font-family: monospace;">class</span>, <span
style="font-family: monospace;">interface</span> and <span
style="font-family: monospace;">abstract</span> and also introduces
Emfatic comments (Emfatic allows both styles of Java comments).&nbsp;
The comments detail the mapping from Emfatic to the <span
style="font-weight: bold;">EClass</span> attributes <span
style="font-weight: bold;">interface</span> and <span
style="font-weight: bold;">abstract</span>.<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">package main;<br>
<br>
class C1 {
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// isInterface=false, isAbstract=false<br>
abstract class C2 { }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //
isInterface=false, isAbstract=true<br>
interface I1 {
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //
isInterface=true,&nbsp; isAbstract=false<br>
abstract interface I2 { }&nbsp; // isInterface=true,&nbsp;
isAbstract=true<br>
</td>
</tr>
</tbody>
</table>
<br>
Inheritance is specified with the keyword <span
style="font-family: monospace;">extends</span>.&nbsp; Unlike Java,
there is no <span style="font-family: monospace;">implements</span>
keyword to distinguish inheritance from interface implementation.&nbsp;
The example below defines an inheritance hierarchy.<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">package main;<br>
<br>
class A { }<br>
class B { }<br>
class C extends A, B { }<br>
class D extends C { }<br>
</td>
</tr>
</tbody>
</table>
<br>
If necessary, the value of the <span style="font-weight: bold;">EClassifier</span>
attribute <span style="font-weight: bold;">instanceClassName</span>
can be specified.&nbsp; The class <span style="font-weight: bold;">EStringToStringMapEntry</span>
from Ecore.ecore provides an example of this:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">class EStringToStringMapEntry :
java.util.Map$Entry {<br>
&nbsp; // ... contents omitted ...<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
Note that if the class both extends other classes and specifies a value
for <span style="font-weight: bold;">instanceClassName</span>, the <span
style="font-family: monospace;">extends</span> clause must precede the
<span style="font-weight: bold;">instanceClassName</span> clause.<br>
<br>
<h3>2.2 Data Types</h3>
Declaring an EDataType is fairly simple.&nbsp; Here are some familiar
examples from Ecore.ecore:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">datatype EInt : int;<br>
datatype EIntegerObject : java.lang.Integer;<br>
transient datatype EJavaObject : java.lang.Object;<br>
<br>
datatype EFeatureMapEntry : org.eclipse.emf.ecore.util.FeatureMap$Entry;<br>
datatype EByteArray : "byte[]";&nbsp; // Note: [ and ] are not legal
identifier characters and must be in quotes<br>
</td>
</tr>
</tbody>
</table>
<br>
First note that as with classes, the value of the <span
style="font-weight: bold;">EClassifier</span> attribute <span
style="font-weight: bold;">instanceClassName</span> follows the colon
after the name of the datatype.&nbsp; However specifying <span
style="font-weight: bold;">instanceClassName</span> is required for
datatypes (while it is optional for classes).<br>
<br>
The keyword <span style="font-family: monospace;">transient</span> in
the third datatype declaration above indicates that the value of the <span
style="font-weight: bold;">EDataType</span> <span
style="font-weight: bold;">serializable</span> attribute should be set
to false.&nbsp; This is a good time to point out that the modifier
keywords introduced so far (<span style="font-family: monospace;">abstract</span>
and <span style="font-family: monospace;">interface</span>) are
applied to reverse the default Ecore attribute values (by default <span
style="font-weight: bold;">EClass</span> attributes <span
style="font-weight: bold;">abstract</span> and <span
style="font-weight: bold;">interface</span> are both false).&nbsp; In
the case of the <span style="font-weight: bold;">EDataType</span>
attribute <span style="font-weight: bold;">serializable</span>, the
default value is true so Emfatic uses a keyword, <span
style="font-family: monospace;">transient</span>, that means the
opposite of serializable.<br>
<br>
The last two datatypes illustrate a subtle syntactic point.&nbsp; The
value specified for the <span style="font-weight: bold;">instanceClassName</span>
attribute must either be a valid qualified identifier (a dot or
dollar-sign separated list of identifiers such as <span
style="font-family: monospace;">java.lang.Object</span> in the third
datatype above) or it must be enclosed in double quotes.&nbsp; The
datatype EFeatureMapEntry contains the character '<span
style="font-family: monospace;">$</span>' which, following Java
syntactic rules, is a legal qualified identifier separator.&nbsp; The
datatype EByteArray contains the characters '<span
style="font-family: monospace;">[</span>' and '<span
style="font-family: monospace;">]</span>' which are not legal in a
qualified identifier.<br>
<br>
The overall point to make about qualified identifier versus
double-quoted syntax for <span style="font-weight: bold;">instanceClassName</span>
is that the typical datatype declaration can use the former and thus
should be easier to read and edit, while the latter is available when
needed and allows for arbitrary string text to be placed in the
generated Ecore model.&nbsp; There are some other contexts where the
Emfatic programmar has the option to use either a qualified identifier
or double-quoted string (see the section on Annotations below for
another example of this).<br>
<br>
<h3>2.3 Enumerated Types</h3>
The example below demonstrates the Emfatic syntax that maps to <span
style="font-weight: bold;">EEnum</span> and <span
style="font-weight: bold;">EEnumLiteral</span>.&nbsp; Note that the
simple assignment expressions specify the <span
style="font-weight: bold;">value</span> attribute of each generated <span
style="font-weight: bold;">EEnumLiteral</span>.<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">enum E {<br>
&nbsp; A=1;<br>
&nbsp; B=2;<br>
&nbsp; C=3;<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
In fact, specifying enumeration literal values is optional and
Emfatic generates reasonable values when they are left
unspecified.&nbsp; The code and comments below describe the rules for
this.<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">enum E {<br>
&nbsp; A;&nbsp; // = 0 (if not specified, first literal has value 0)<br>
&nbsp; B = 3;<br>
&nbsp; C;&nbsp; // = 4 (in general, unspecified values are 1 greater
than previous value)<br>
&nbsp; D;&nbsp; // = 5<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
<h3>2.4 Map Entries</h3>
MapEntry classes (such as <span style="font-weight: bold;">EStringToStringMapEntry</span>
in Ecore.ecore) can be specified in either of two ways.&nbsp; The
"longhand" way is to declare a class with features named <span
style="font-weight: bold;">key</span> and <span
style="font-weight: bold;">value</span> and with <span
style="font-family: monospace;">[instanceClass=java.util.Map$Entry]</span>
as suggested at the end of section 2.1 above.&nbsp; But there is a
convienent shorthand notation which achieves the same result:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">mapentry EStringToStringMapEntry
: String -&gt; String;<br>
</td>
</tr>
</tbody>
</table>
<br>
The expression following the colon gives the type of the MapEntry <span
style="font-weight: bold;">key</span> structural feature followed by
the <span style="font-family: monospace;">-&gt;</span>
operator, followed by the type of the <span style="font-weight: bold;">value</span>
structural feature.&nbsp; Type expressions can
be more complex than shown in the example above and are detailed fully
in the next section.<br>
<br>
<h2>3. Type Expressions<br>
</h2>
The most basic Ecore elements that haven't yet been explored in Emfatic
are the structural and behavioral class features represented by the
Ecore classes <span style="font-weight: bold;">EAttribute</span>,
<span style="font-weight: bold;">EReference</span>, <span
style="font-weight: bold;">EOperation</span> and <span
style="font-weight: bold;">EParameter</span>.&nbsp; These four Ecore
classes are all derived from <span style="font-weight: bold;">ETypedElement</span>
which means that instances of them have some type (which is an <span
style="font-weight: bold;">EClassifier</span>) and inherit the other
characteristics of <span style="font-weight: bold;">ETypedElement</span>,
like multiplicity.&nbsp; Before we can describe each specific kind of
class feature, we need to show
how types are represented syntactically, because that applies (more or
less) to all of them.<br>
<br>
Type expressions have two parts.&nbsp; First is a simple identifier or
a qualified identifier (a dot-separated list of simple identifiers like
"a.b.c") that identifies some <span style="font-weight: bold;">EClassifier</span>.&nbsp;
The <span style="font-weight: bold;">EClassifier</span>
identified may be defined in the same Emfatic source file as the type
expression, or it may be in one of the imported Ecore models (specified
in import statements).<br>
<br>
Let's skip ahead a little by looking at some attribute declarations so
that we can talk about their type expressions:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">package test;<br>
<br>
datatype D1 : int;<br>
<br>
package P {<br>
&nbsp; datatype D2 : int;<br>
}<br>
<br>
class C {<br>
&nbsp; attr D1 d1;<br>
&nbsp; attr P.D2 d2;<br>
&nbsp; attr ecore.EString s1;<br>
&nbsp; attr String s2;<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
The class named "C" above declares four attributes with the names "d1",
"d2", "s1" and "s2".&nbsp; Note that Emfatic follows Java syntactic
style in placing type expression before the name.&nbsp; However unlike
Java field declarations, Emfatic uses a keyword - <span
style="font-family: monospace;">attr</span> - to introduce an
attribute.&nbsp; (The keyword <span style="font-family: monospace;">attr</span>
and similar keywords to introduce references and operations will
explained in more detail in the following sub-sections).<br>
<br>
The type expression for d1 is "D1" which identifies the datatype
D1.&nbsp; Because C and D1 are in the same package (test), this simple
expression is fine.<br>
<br>
The type expression for d2 is "P.D2".&nbsp; In this case a qualified
identifier expression is necessary to identify datatype D2 inside
package P.<br>
<br>
The type expression for s1 is "ecore.EString".&nbsp; This identifies
the datatype EString in package ecore (recall that model Ecore.ecore is
implicitly imported in all Emfatic programs).<br>
<br>
The type expression for s2 is "String".&nbsp; The identifier String is
actually a special shorthand for ecore.EString, so s1 and s2 have the
same type.<br>
<h3>3.1 Basic Types</h3>
A number of the types defined in Ecore.ecore have shorthand notation in
Emfatic.&nbsp; The table below lists the Emfatic shorthand and the
corresponding Ecore.ecore type name for each of these basic types as
well as the corresponding Java type or class (taken from table 5.1 in
the EMF book).<br>
<br>
<table style="width: 100%; text-align: left;" border="1" cellpadding="2"
cellspacing="2">
<caption>Table 3.1 - Basic Type Names<br>
</caption> <tbody>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">Emfatic
Keyword<br>
</td>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">Ecore
EClassifier name<br>
</td>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">Java
type name<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">boolean<br>
</td>
<td style="vertical-align: top;">EBoolean<br>
</td>
<td style="vertical-align: top;">boolean<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Boolean<br>
</td>
<td style="vertical-align: top;">EBooleanObject<br>
</td>
<td style="vertical-align: top;">java.lang.Boolean<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">byte<br>
</td>
<td style="vertical-align: top;">EByte<br>
</td>
<td style="vertical-align: top;">byte<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Byte<br>
</td>
<td style="vertical-align: top;">EByteObject<br>
</td>
<td style="vertical-align: top;">java.lang.Byte<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">char<br>
</td>
<td style="vertical-align: top;">EChar<br>
</td>
<td style="vertical-align: top;">char<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Character<br>
</td>
<td style="vertical-align: top;">ECharacterObject<br>
</td>
<td style="vertical-align: top;">java.lang.Character<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">double<br>
</td>
<td style="vertical-align: top;">EDouble<br>
</td>
<td style="vertical-align: top;">double<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Double<br>
</td>
<td style="vertical-align: top;">EDoubleObject<br>
</td>
<td style="vertical-align: top;">java.lang.Double<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">float<br>
</td>
<td style="vertical-align: top;">EFloat<br>
</td>
<td style="vertical-align: top;">float<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Float<br>
</td>
<td style="vertical-align: top;">EFloatObject<br>
</td>
<td style="vertical-align: top;">java.lang.Float<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">int<br>
</td>
<td style="vertical-align: top;">EInt<br>
</td>
<td style="vertical-align: top;">int<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Integer<br>
</td>
<td style="vertical-align: top;">EIntegerObject<br>
</td>
<td style="vertical-align: top;">java.lang.Integer<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">long<br>
</td>
<td style="vertical-align: top;">ELong<br>
</td>
<td style="vertical-align: top;">long<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Long<br>
</td>
<td style="vertical-align: top;">ELongObject<br>
</td>
<td style="vertical-align: top;">java.lang.Long<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">short<br>
</td>
<td style="vertical-align: top;">EShort<br>
</td>
<td style="vertical-align: top;">short<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Short<br>
</td>
<td style="vertical-align: top;">EShortObject<br>
</td>
<td style="vertical-align: top;">java.lang.Short<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Date<br>
</td>
<td style="vertical-align: top;">EDate<br>
</td>
<td style="vertical-align: top;">java.util.Date<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">String<br>
</td>
<td style="vertical-align: top;">EString<br>
</td>
<td style="vertical-align: top;">java.lang.String<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Object<br>
</td>
<td style="vertical-align: top;">EJavaObject<br>
</td>
<td style="vertical-align: top;">java.lang.Object<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">Class<br>
</td>
<td style="vertical-align: top;">EJavaClass<br>
</td>
<td style="vertical-align: top;">java.lang.Class<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">EObject<br>
</td>
<td style="vertical-align: top;">EObject</td>
<td style="vertical-align: top;">org.eclipse.emf.ecore.EObject</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">EClass<br>
</td>
<td style="vertical-align: top;">EClass<br>
</td>
<td style="vertical-align: top;">org.eclipse.emf.ecore.EClass</td>
</tr>
</tbody>
</table>
<br>
Remember that you can always reference these types, and the rest of the
types in Ecore.ecore, by using their fully qualified name which begins
with the package prefix "ecore".&nbsp; For example <span
style="font-family: monospace;">ecore.EOperation</span> and <span
style="font-family: monospace;">ecore.EBigInteger</span> are also
legal references to types in Ecore.ecore.<br>
<br>
<h3>3.2 Multiplicity Expressions </h3>
The second part of a type expression is the multiplicity
expression.&nbsp; This maps to the <span style="font-weight: bold;">lowerBound</span>
and <span style="font-weight: bold;">upperBound</span> attributes of <span
style="font-weight: bold;">ETypedElement</span>.&nbsp; Multiplicity
expressions are optional, but when omitted the generated <span
style="font-weight: bold;">ETypedElement</span> gets the defaults (<span
style="font-weight: bold;">lowerBound</span> = 0 and <span
style="font-weight: bold;">upperBound</span> = 1).&nbsp; The example
below shows some attribute declarations with multiplicity expressions:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">class C {<br>
&nbsp; attr String[1] s1;<br>
&nbsp; attr String[0..3] s2;<br>
&nbsp; attr String[*] s3;<br>
&nbsp; attr String[+] s4;<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
The mapping between various multiplicity expressions and the <span
style="font-weight: bold;">lowerBound</span> and <span
style="font-weight: bold;">upperBound</span> attributes of the
generated <span style="font-weight: bold;">ETypedElement</span> is
detailed more fully in the following table.<br>
<br>
<table style="width: 100%; text-align: left;" border="1" cellpadding="2"
cellspacing="2">
<caption>Table 3.2 - Multiplicity Expressions<br>
</caption> <tbody>
<tr>
<td style="background-color: rgb(204, 204, 204);">Emfatic
multiplicity expression<br>
</td>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">ETypedElement
lowerBound<br>
</td>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">ETypedElement
upperBound<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-style: italic;">none</span><br>
</td>
<td style="vertical-align: top;">0<br>
</td>
<td style="vertical-align: top;">1<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[?]</span><br>
</td>
<td style="vertical-align: top;">0<br>
</td>
<td style="vertical-align: top;">1<br>
</td>
</tr>
<tr>
<td
style="background-color: rgb(204, 204, 255); vertical-align: top; font-family: monospace;">[]<br>
</td>
<td style="vertical-align: top;">0<br>
</td>
<td style="vertical-align: top;">unbounded (-1)</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[*]</span><br>
</td>
<td style="vertical-align: top;">0<br>
</td>
<td style="vertical-align: top;">unbounded (-1)<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[+]</span><br>
</td>
<td style="vertical-align: top;">1<br>
</td>
<td style="vertical-align: top;">unbounded (-1)<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[1]</span><br>
</td>
<td style="vertical-align: top;">1<br>
</td>
<td style="vertical-align: top;">1<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[<span style="font-style: italic;">n</span>]</span><br>
</td>
<td style="vertical-align: top;"><span style="font-style: italic;">n</span><br>
</td>
<td style="vertical-align: top;"><span style="font-style: italic;">n</span><br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[0..4]</span><br>
</td>
<td style="vertical-align: top;">0<br>
</td>
<td style="vertical-align: top;">4<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[<span style="font-style: italic;">m</span>..<span
style="font-style: italic;">n</span>]</span><br>
</td>
<td style="vertical-align: top;"><span style="font-style: italic;">m</span><br>
</td>
<td style="vertical-align: top;"><span style="font-style: italic;">n</span><br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[5..*]</span><br>
</td>
<td style="vertical-align: top;">5<br>
</td>
<td style="vertical-align: top;">unbounded (-1)</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255);"><span
style="font-family: monospace;">[1..?]</span><br>
</td>
<td style="vertical-align: top;">1<br>
</td>
<td style="vertical-align: top;">unspecified (-2)<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<h3>3.3 Escaping Keywords</h3>
<span style="font-style: italic;">Note: this doesn't really fit here,
but I can't find a better place for it...</span><br>
<br>
Sometimes it's necessary or desirable to use a keyword as the name for
some model element.&nbsp; This can be acheived by prefixing the name
identifier with the '<span style="font-family: monospace;">~</span>'
symbol.&nbsp; This ability was added primarily to make it possible to
represent Ecore.ecore in Emfatic, so we'll show another example from
Ecore.ecore here to illustrate:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">class EClass extends EClassifier
{<br>
&nbsp; // ...<br>
&nbsp; ~abstract : EBoolean;<br>
&nbsp; ~interface : EBoolean;<br>
&nbsp; // ...<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
Recall that the <span style="font-family: monospace;">abstract</span>
and <span style="font-family: monospace;">interface</span> keywords
are used in class declarations.&nbsp; The code above shows how they can
be used as attribute names.&nbsp; Emfatic removes the '<span
style="font-family: monospace;">~</span>' symbol so names in the
generated Ecore model do not contain it.<br>
<br>
<h2>4. Structural and Behavioral Features</h2>
Now we are ready to show how the Ecore class features <span
style="font-weight: bold;">EAttribute</span>,
<span style="font-weight: bold;">EReference</span>, <span
style="font-weight: bold;">EOperation</span> and <span
style="font-weight: bold;">EParameter</span> are represented in
Emfatic.&nbsp; The example below is the class <span
style="font-weight: bold;">EPackage</span>
from Ecore.ecore and it was
chosen to give a feel for the feature syntax because it contains a
sample of each kind of class feature.&nbsp; <br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">class EPackage extends
ENamedElement {<br>
&nbsp; op EClassifier getEClassifier(EString name);<br>
&nbsp; attr EString nsURI;<br>
&nbsp; attr EString nsPrefix;<br>
&nbsp; transient !resolve ref EFactory[1]#ePackage eFactoryInstance;<br>
&nbsp; val EClassifier[*]#ePackage eClassifiers;<br>
&nbsp; val EPackage[*]#eSuperPackage eSubpackages;<br>
&nbsp; readonly transient ref EPackage#eSubpackages eSuperPackage;<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
For now we just want to point out that the syntax for class features is
based on the syntax of Java with one key difference.&nbsp; In Java some
elements are introduced with special keywords like <span
style="font-family: monospace;">class</span> and <span
style="font-family: monospace;">interface</span>, but type members
like fields and methods have no such keywords to introduce them.&nbsp;
This works for Java because fields and methods can be distinguished by
looking at other syntactic featues (methods have parenthesis and fields
do not).&nbsp; However the distinction between what EMF calls
attributes and references doesn't really exist in Java, so there is no
distinguishing syntax.&nbsp; Because of this and because class features
are such an essential element of EMF, a decision was made to use
keywords to introduce and differentiate attributes, references and
operations.&nbsp; Thus in Emfatic the basic syntax for a class feature
looks like this:<br>
<br>
<div style="margin-left: 40px;"><span style="font-style: italic;">modifiers
&nbsp; featureKind &nbsp; typeExpression &nbsp; name</span> &nbsp; ';'<br>
</div>
<br>
Where <span style="font-style: italic;">featureKind</span> is one of
the four keywords in the following table.<br>
<br>
<table style="width: 100%; text-align: left;" border="1" cellpadding="2"
cellspacing="2">
<caption>Table 4.1 - Class Feature Kind Keywords<br>
</caption><tbody>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">Emfatic
keyword<br>
</td>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">introduces<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">attr<br>
</td>
<td style="vertical-align: top;">EAttribute<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">op<br>
</td>
<td style="vertical-align: top;">EOperation</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">ref<br>
</td>
<td style="vertical-align: top;">normal EReference
(EReference.containment = false)<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-family: monospace; background-color: rgb(204, 204, 255);">val<br>
</td>
<td style="vertical-align: top;">"by value" EReference
(EReference.containment = true)<br>
</td>
</tr>
</tbody>
</table>
<br>
<h3>4.1 Modifiers</h3>
Look again at the Emfatic code above for <span
style="font-weight: bold;">EPackage</span> and note in the last class
feature declaration the keyword <span style="font-family: monospace;">ref</span>
is preceded by the words <span style="font-family: monospace;">readonly</span>
and <span style="font-family: monospace;">transient</span>.&nbsp;
These are modifiers similar in spirit to Java's modifiers such as
<span style="font-family: monospace;">public</span>, <span
style="font-family: monospace;">private</span> and <span
style="font-family: monospace;">abstract</span>.&nbsp; However these
modifiers map to
boolean attributes on the Ecore classes involved in defining structural
and behavioral features.&nbsp; These modifiers must appear directly
before the feature's type expression.&nbsp; The table below describes
each
modifier.<br>
<br>
<table style="width: 100%; text-align: left;" border="1" cellpadding="2"
cellspacing="2">
<caption>Table 4.2 - Class Feature Modifiers<br>
</caption><tbody>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">modifier<br>
</td>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">means<br>
</td>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">applies
to<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">readonly<br>
</td>
<td style="vertical-align: top;">EStructuralFeature.changeable =
false<br>
</td>
<td style="vertical-align: top;">attribute, reference<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">volatile<br>
</td>
<td style="vertical-align: top;">EStructuralFeature.volatile =
true<br>
</td>
<td style="vertical-align: top;">attribute, reference</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">transient<br>
</td>
<td style="vertical-align: top;">EStructuralFeature.transient =
true<br>
</td>
<td style="vertical-align: top;">attribute, reference</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">unsettable<br>
</td>
<td style="vertical-align: top;">EStructuralFeature.unsettable =
true<br>
</td>
<td style="vertical-align: top;">attribute, reference</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">derived<br>
</td>
<td style="vertical-align: top;">EStructuralFeature.derived = true<br>
</td>
<td style="vertical-align: top;">attribute, reference</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">unique<br>
</td>
<td style="vertical-align: top;">ETypedElement.unique = true<br>
</td>
<td style="vertical-align: top;">attribute, reference, operation,
parameter<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">ordered<br>
</td>
<td style="vertical-align: top;">ETypedElement.ordered = true<br>
</td>
<td style="vertical-align: top;">attribute, reference, operation,
parameter</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">resolve<br>
</td>
<td style="vertical-align: top;">EReference.resolveProxies = true<br>
</td>
<td style="vertical-align: top;">reference<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 255); font-family: monospace;">id<br>
</td>
<td style="vertical-align: top;">EAttribute.iD = true<br>
</td>
<td style="vertical-align: top;">attribute<br>
</td>
</tr>
</tbody>
</table>
<br>
Note that the meaning of a modifier may be negated by prefixing the <span
style="font-family: monospace;">!</span> operator.&nbsp; The example
below demonstrates this with an non-ordered attribute:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">class X {<br>
&nbsp; !ordered attr String[*] s;<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
Normally the only modifiers that you should see negated with <span
style="font-family: monospace;">!</span> are <span
style="font-family: monospace;">unique</span>, <span
style="font-family: monospace;">ordered</span> and <span
style="font-family: monospace;">resolve</span>.&nbsp; This is because
these three are true by default, so reversing the Ecore default means
using the <span style="font-family: monospace;">!</span>
operator.&nbsp; Note also that <span style="font-weight: bold;">EStructuralFeature.changeable</span>
is true by default, but the modifier keyword <span
style="font-family: monospace;">readonly</span> means the opposite (<span
style="font-weight: bold;">EStructuralFeature.changeable</span> =
false).<br>
<br>
<h3>4.2 Attributes</h3>
We've now seen attribute naming and type expressions.&nbsp; Attributes
may also be assigned default value expressions.&nbsp; Below is an
example showing the various forms of
attribute syntax.<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">class C {<br>
&nbsp; attr String s;<br>
&nbsp; attr int i = 1;<br>
&nbsp; attr ecore.EBoolean b = true;<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
Again note that the declaration of attributes is basically identical to
declaraing fields in Java except for the presence of the <span
style="font-family: monospace;">attr</span> keyword.<br>
<br>
<h3>4.3 References</h3>
The type expression syntax for references is slightly complicated by
the fact that we need some way to identify the opposite of a
reference.&nbsp; Let's return again to the code for <span
style="font-weight: bold;">EPackage</span>, but we'll just look at the
last two feature declarations:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">class EPackage extends
ENamedElement {<br>
&nbsp; // ...<br>
&nbsp; val EPackage[*]#eSuperPackage eSubpackages;<br>
&nbsp; readonly transient ref EPackage#eSubpackages eSuperPackage;<br>
}</td>
</tr>
</tbody>
</table>
<br>
Notice that the type expressions are followed by a <span
style="font-family: monospace;">#</span> symbol and an
identifer.&nbsp; This identifier names the <span
style="font-weight: bold;">EReference</span> which is the <span
style="font-weight: bold;">opposite</span> of the reference being
declared.&nbsp; If a reference doesn't need to specify its opposite
then that
part (including the <span style="font-family: monospace;">#</span>
symbol) is omitted.<br>
<br>
<h3>4.4 Operations</h3>
The declaration syntax for operations is Java-like as described above,
including use of the keyword <span style="font-family: monospace;">void</span>
to identify operations which don't return a value.&nbsp; Also a
Java-like <span style="font-family: monospace;">throws</span> clause
allows for the declaration of exception types:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">class X {<br>
&nbsp; op String getFullName();<br>
&nbsp; op void returnsNothing();<br>
&nbsp; op int add(int a, int b);<br>
&nbsp; op EObject doSomething(int a, ecore.EBoolean b) throws
ExceptionA, ExceptionB;<br>
}<br>
</td>
</tr>
</tbody>
</table>
<span style="font-style: italic;"></span><br>
<br>
<h2>
5. Annotations</h2>
Annotations can be attached to every kind of EMF element, however only
the <span style="font-weight: bold;">source</span> and <span
style="font-weight: bold;">details</span> features of the resulting <span
style="font-weight: bold;">EAnnotation</span> can be
specified in Emfatic.&nbsp; The Emfatic syntax for representing EMF
annotations was inspired by the
syntax being introduced for Java annotations in Java 1.5
("Tiger").&nbsp; The <span style="font-family: monospace;">@</span>
symbol is followed by the value of the <span style="font-weight: bold;">EAnnotation</span>
<span style="font-weight: bold;">source</span>
attribute.&nbsp; Key/value pairs for the annotation <span
style="font-weight: bold;">details</span> may appear in parenthesis
following the <span style="font-weight: bold;">source</span>
value.&nbsp; Multiple
annotations can be attached to each element.&nbsp; Usually the
annotation appears just before its containing element (parameter and
enum literal annotations may appear just after the declaration).&nbsp;
The example below gives some examples of annotations.<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">@"http://source/uri"("key1"="value1",
"key2"="value2")<br>
@sourceLabel(key.a="value1", key.b="value2")<br>
@simpleAttr<br>
package test;<br>
<br>
@"http://class/annotation"(k="v")<br>
class C {<br>
&nbsp; @"http://attribute/annotation"(k="v")<br>
&nbsp; attr int a;<br>
<br>
&nbsp; op int Op(<br>
&nbsp;&nbsp;&nbsp; @before(k=v) int a,<br>
&nbsp;&nbsp;&nbsp; int b @after(k=v)<br>
&nbsp; );<br>
}<br>
<br>
enum E {<br>
&nbsp; @"http://before"(k=v)<br>
&nbsp; A=1;<br>
&nbsp; B=2 @"http://after"(k=v);<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
One subtle point
to note is that double quotes are only required around the string value
if it is not a valid simple or qualified identifier.&nbsp; So an
identifier
like <span style="font-family: monospace;">key</span> or <span
style="font-family: monospace;">key.a.b.c</span> need not be quoted,
but most complex strings (such as urls) will need to be.<br>
<br>
<h3>5.1 Annotation Labels<br>
</h3>
Emfatic allows for short labels to be defined that map to longer URI
values for the <span style="font-weight: bold;">source</span>
attribute of an <span style="font-weight: bold;">EAnnotation</span>.&nbsp;
The purpose of this feature is to simplify the Emfatic code, making it
easier to read and edit.&nbsp; Several annotation labels are available
by default, as shown in the following table:<br>
<br>
<table style="width: 100%; text-align: left;" border="1" cellpadding="2"
cellspacing="2">
<tbody>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">Emfatic
annotation label<br>
</td>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204);">maps
to EAnnotation.source value<br>
</td>
</tr>
<tr>
<td
style="background-color: rgb(204, 204, 255); vertical-align: top;"><span
style="font-family: monospace;">Ecore</span><br>
</td>
<td style="vertical-align: top;"><span
style="font-family: monospace;">http://www.eclipse.org/emf/2002/Ecore</span><br>
</td>
</tr>
<tr>
<td
style="background-color: rgb(204, 204, 255); vertical-align: top;"><span
style="font-family: monospace;">GenModel</span><br>
</td>
<td style="vertical-align: top;"><span
style="font-family: monospace;">http://www.eclipse.org/emf/2002/GenModel</span><br>
</td>
</tr>
<tr>
<td
style="background-color: rgb(204, 204, 255); vertical-align: top; font-family: monospace;">ExtendedMetaData<br>
</td>
<td style="vertical-align: top;"><span
style="font-family: monospace;">http:///org/eclipse/emf/ecore/util/ExtendedMetaData</span><br>
</td>
</tr>
<tr>
<td
style="background-color: rgb(204, 204, 255); vertical-align: top;"><span
style="font-family: monospace;">EmfaticAnnotationMap</span><br>
</td>
<td style="vertical-align: top;"><span
style="font-family: monospace;">http://www.eclipse.org/emf/2004/EmfaticAnnotationMap</span><br>
</td>
</tr>
</tbody>
</table>
<br>
The code below shows some examples:<br>
<br>
<table
style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">@EmfaticAnnotationMap(myLabel="http://foo/bar")<br>
@genmodel(documentation="model documentation")<br>
package test;<br>
<br>
@ecore(constraints="constraintA constraintB")<br>
@myLabel(key="value")<br>
class C {<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
There are several details to elaborate on in the example above.&nbsp;
First note that labels are not case sensitive (so <span
style="font-family: monospace;">Ecore</span> and <span
style="font-family: monospace;">ecore</span> and <span
style="font-family: monospace;">ECORE</span> all work the same way).<br>
<br>
Second, note that declaring an annotation using the label <span
style="font-family: monospace;">EmfaticAnnotationMap</span> has the
side effect of creating a new label which can be used later in the
program.&nbsp; So the second annotation on class "C" will get the <span
style="font-weight: bold;">source</span> value of <span
style="font-family: monospace;">"http://foo/bar"</span>.<br>
<br>
Finally, note that the code above shows how to introduce model
documentation and constraints in a way that will later flow into
generated Java code when working with an EMF genmodel.<br>
<br>
</body>
</html>