Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDesign pattern creation through ocl
https://www.eclipse.org/forums/index.php/mv/msg/199618/636955/#msg_636955
I have to create a model-to-model transformation from a UML diagram into another UML diagram following the Composite design pattern (for more info take a look at http://en.wikipedia.org/wiki/Composite_pattern ) using QVT relation and OCL.
I have successfully created my ecore and source model.
In order to detect a composite pattern, I think I have to look for all the classes that have an Aggregation and have the same operation in common. In this way I could determine the Composite and Leaf classes.
So, i think a recursive method is quite necessary.
I tried to use iterate() but i get always an error message. Here's the code about iterate()
However I'm not sure wgat tooling you are using, since Eclipse M2M/QVTr
currently has no execution capability. So I don't know what OCL you are
using and so whether it is supported there.
You don't give the error message.
Your acc is a Sequencxe which is a bit odd when using union to gather
results.
You might find closure more helpful. Search this newsgroup for details.
Regards
Ed Willink
On 03/11/2010 14:20, Marina wrote:
> Hi all,
>
> I have to create a model-to-model transformation from a UML diagram into
> another UML diagram following the Composite design pattern (for more
> info take a look at http://en.wikipedia.org/wiki/Composite_pattern )
> using QVT relation and OCL.
>
> I have successfully created my ecore and source model.
>
> In order to detect a composite pattern, I think I have to look for all
> the classes that have an Aggregation and have the same operation in
> common. In this way I could determine the Composite and Leaf classes.
>
> So, i think a recursive method is quite necessary.
>
> I tried to use iterate() but i get always an error message. Here's the
> code about iterate()
>
> temp->iterate(x:UMLISW2::UmlClass; acc:
> Sequence(UMLISW2::UmlClass)|classe->union(SubClass(x));
>
> where Subclass is
>
> query SubClass(classe : UMLISW2::UmlClass): Sequence(UMLISW2::UmlClass){
> classe.umlForward->
> select(x:UMLISW2::UmlAssociation|x.isAggregation=true).umlSo urce
> }
>
>
>
> Is it possible to get a recursive query with OCL?
>
> Thanks]]>Ed Willink2010-11-04T09:53:12-00:00Re: Design pattern creation through ocl
https://www.eclipse.org/forums/index.php/mv/msg/199618/637143/#msg_637143
thanks for your reply.
I'm using Ecore Tools, EMF and Medini on Galileo Eclipse.
The error message is : acc is not assigned.
why should I use closure instead of iterate?
I've already searched but i still have this doubt
Regards]]>Marina2010-11-04T11:05:53-00:00Re: Design pattern creation through ocl
https://www.eclipse.org/forums/index.php/mv/msg/199618/637350/#msg_637350
Medini QVT is a third party Eclipse product and so not formally
supported by Eclipse.
I'm not sure what OCL engine Medini QVT uses but I don't think it's
MDT/OCL. Certainly MDT/OCL has no message that could produce
"is not assigned".
Guessing: accis not assigned might arise through an attempt to realize
iterators through a generic iterate as discussed in the specification.
Initialization failure of the iterate acc would then make that a
sensible message. However it should always or never work for select, so
unless select is totally broken, I suggest that some type analysis
failure or empty/null-containing collection may be the cause.
If you are not using MDT/OCL you are unlikley to have closure() that
supports transitive collection iteration.
Regards
Ed Willink
On 04/11/2010 11:05, Marina wrote:
> Hi Ed,
> Thanks for your reply.
> I'm using Ecore Tools, EMF and Medini on Galileo Eclipse.
>
> The error message is : acc is not assigned.
> why should I use closure instead of iterate? I've already searched but i
> still have this doubt
>
> Regards]]>Ed Willink2010-11-05T07:55:26-00:00