[OCLInEcore] Problem with OCL expressions containing type references from imported packages [message #815247] |
Wed, 07 March 2012 07:17  |
Eclipse User |
|
|
|
Hi,
I have a problem to use types from imported packages in OCL expressions. Quick example:
package a:
module _'A.ecore'
package a : a = 'http[:]//me.me/a'
{
class System
{
property components : Component[*] { ordered composes };
}
class Component
{
attribute name : String[1] { ordered };
}
}
a package b:
module _'B.ecore'
import a : 'A.ecore#/';
package b : b = 'http[:]//me.me/b'
{
class Instance
{
attribute name : String[1] { ordered };
property type : a::Component[1] { ordered };
property parent : a::System[1] { derived readonly transient volatile }
{
derivation: type.oclContainer().oclAsType(a::System);
}
}
}
This works as long as I don't close and reopen the editor. When I do that it changes the OCL expression for the derived property to:
derivation: type.oclContainer().oclAsType(System);
which is invalid. It correctly preserves the property types like (a::Component[1], a::System[1]).
Is this a bug (I tried to look for it, but I only found problems regarding the type definition rather than embedded OCL expressions)? Is there any workaround (besides merging the packages)?
|
|
|
|
|
Re: [OCLInEcore] Problem with OCL expressions containing type references from imported packages [message #815310 is a reply to message #815259] |
Wed, 07 March 2012 08:47   |
Eclipse User |
|
|
|
Hi
Sorry replied too quickly. This is a problem fixed in Juno for the Pivot
model only.
The problem is that OCL, as specified, provides no way of binding the
'a' alias to 'A.ecore'. For Juno, I've introduced an extension so that
package names can be URIs and so the OCL saved in Ecore is
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
<details key="derivation"
value="type.oclContainer().oclAsType(_'A.ecore'::a::System)"/>
</eAnnotations>
which is loadable by a compliant parser.
You will also need a compliant library to support the oclContainer()
function too.
So, your next question, how does this work in Acceleo? It doesn't.
This is an example of many corner case problems in the legacy code.
These are very hard to fix, hence the new pivot binding. It is very
unlikely that Acceleo will use the pivot model in Juno, so use of these
OCL fixes may have to wait for Kepler.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=373518 raised to
investigate solutions.
Regards
Ed Willink
On 07/03/2012 12:37, Filip Krikava wrote:
> That is what I hoped, but I use: 3.1.2.v20120206-0606 and I think it
> is a different issue - my problem is not the model structure but the
> OCL expressions themselves.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03840 seconds