<br><font size=2 face="sans-serif">Hi,</font>
<br>
<br><font size=2 face="sans-serif">I think I found a case where the current
lookupScope/referenceBy handling might not enough:</font>
<br>
<br><font size=2 face="sans-serif">I have a syntax for the Ecore variant
of OCL which is based on generics inheriting from a generic OCL metamodel
(which is kind of ugly in my oppinion). Anyway, there I define a template
for VariableExp in the fopllowing way:</font>
<br>
<br><font size=2 face="Courier New">template &quot;</font><a href=http://www.eclipse.org/ocl/1.1.0/Ecore><font size=2 face="Courier New">http://www.eclipse.org/ocl/1.1.0/Ecore&quot;#VariableExp</font></a>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; : [[</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;referredVariable {forcedLower=1,mode=self}</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
|</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;referredVariable &nbsp;{as=identifier, forcedLower=1 , lookupScope
= &quot;<u>ocl</u>::<u>ecore</u>::Variable.allInstances()&quot;, referenceBy=&quot;name&quot;}</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
]]</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;{{ eType=lookIn(&quot;OCL:self.referredVariable.oclAsType(<u>ocl</u>::<u>ecore</u>::Variable).eType&quot;),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; name=lookIn(&quot;OCL:self.referredVariable.oclAsType(<u>ocl</u>::<u>ecore</u>::Variable).name&quot;)
}}</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; ;</font>
<br>
<br><font size=2 face="sans-serif">However, this doesn't work as the referenceBy-feature
&quot;name&quot; is currently validated against the type of the feature
it is intended to set, i.e., referredVariable. In this setting referredVariable
is typed as &nbsp;Variable&lt;C, PM&gt; &nbsp;from ocl::expressions (which
is the generic part of OCL) where the generics are bound as &lt;EClassifier,
EParameter&gt;. Still there is a concrete subclass of VariableExp in the
ocl::ecore package defined as follows: Variable -&gt; ETypedElement,Variable&lt;EClassifier,
EParameter&gt;. This leads to the fact that &quot;name&quot; is only defined
on this concrete subclass (inherited from ETypedElement-&gt;ENamedElement).
Therefore, the &quot;name&quot; feature is not found when validating the
syntax and an error occurs. Still, the generic Variable&lt;C, PM&gt; also
inherits from the abstract class ocl::utilities::TypedElement which defines
an operation &quot;getName()&quot;. This &quot;coincidence&quot; leads
to the fact that on the Java side this &quot;getName()&quot; magically
works by resolving to ENamedElement.getName(), during OCL evaluation this
also works fine if we call operation getName() instead of attribute &quot;name&quot;.
Therefore, what might work is using the operation in the referenceBy clause:</font>
<br>
<br><font size=2 face="sans-serif">referenceBy=&quot;getName()&quot;</font>
<br>
<br><font size=2 face="sans-serif">What do you think? Is this just a weird
special case that will never occur anywhere else? Or do we need to support
this?</font>
<br>
<br><font size=2 face="sans-serif">Btw: Resolving generics as reference
types was not supported in the generator, I added this including some test
cases and I will push this later today.</font>
<br>
<br><font size=2 face="sans-serif">Cheers,<br>
Thomas<br>
</font>
<table>
<tr>
<td valign=top><img src=cid:_1_079928840799120C002C2B6AC1257842>
<td><font size=3>&nbsp; </font>
<td><font size=1 face="Verdana"><b>Thomas Goldschmidt </b><br>
<br>
ABB AG<br>
Forschungszentrum<br>
Wallstadter Straße 59<br>
68526 Ladenburg<br>
Office Phone: +49 6203 716134<br>
Office Fax: +49 6203 716253<br>
e-mail:</font><font size=1 color=blue face="Verdana"> thomas.goldschmidt@de.abb.com</font></table>
<br>
<br><font size=1 color=#808080 face="Verdana">ABB AG<br>
Sitz/Head Office: Mannheim <br>
Registergericht/Registry Court: Mannheim<br>
Handelsregisternummer/Commercial Register No.: HRB 4664<br>
Geschäftsführung/Managing Board: Peter Smits (Vorsitzender), Joachim Schneider,
Markus Ochsner, Hans-Georg Krabbe<br>
Vorsitzender des Aufsichtsrats/Chairman of Supervisory Board: Bernhard
Jucker<br>
<br>
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich
erhalten haben, informieren Sie bitte sofort den Absender und vernichten
Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe
dieser Mail ist nicht gestattet. <br>
<br>
This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.</font>