<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 "</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"#VariableExp</font></a>
<br><font size=2 face="Courier New"> : [[</font>
<br><font size=2 face="Courier New">
referredVariable {forcedLower=1,mode=self}</font>
<br><font size=2 face="Courier New">
|</font>
<br><font size=2 face="Courier New">
referredVariable {as=identifier, forcedLower=1 , lookupScope
= "<u>ocl</u>::<u>ecore</u>::Variable.allInstances()", referenceBy="name"}</font>
<br><font size=2 face="Courier New">
]]</font>
<br><font size=2 face="Courier New">
{{ eType=lookIn("OCL:self.referredVariable.oclAsType(<u>ocl</u>::<u>ecore</u>::Variable).eType"),</font>
<br><font size=2 face="Courier New">
name=lookIn("OCL:self.referredVariable.oclAsType(<u>ocl</u>::<u>ecore</u>::Variable).name")
}}</font>
<br><font size=2 face="Courier New"> ;</font>
<br>
<br><font size=2 face="sans-serif">However, this doesn't work as the referenceBy-feature
"name" is currently validated against the type of the feature
it is intended to set, i.e., referredVariable. In this setting referredVariable
is typed as Variable<C, PM> from ocl::expressions (which
is the generic part of OCL) where the generics are bound as <EClassifier,
EParameter>. Still there is a concrete subclass of VariableExp in the
ocl::ecore package defined as follows: Variable -> ETypedElement,Variable<EClassifier,
EParameter>. This leads to the fact that "name" is only defined
on this concrete subclass (inherited from ETypedElement->ENamedElement).
Therefore, the "name" feature is not found when validating the
syntax and an error occurs. Still, the generic Variable<C, PM> also
inherits from the abstract class ocl::utilities::TypedElement which defines
an operation "getName()". This "coincidence" leads
to the fact that on the Java side this "getName()" magically
works by resolving to ENamedElement.getName(), during OCL evaluation this
also works fine if we call operation getName() instead of attribute "name".
Therefore, what might work is using the operation in the referenceBy clause:</font>
<br>
<br><font size=2 face="sans-serif">referenceBy="getName()"</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> </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>