Design pattern creation through ocl [message #636955] |
Wed, 03 November 2010 10:20  |
Eclipse User |
|
|
|
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
|
|
|
|
|
Re: Design pattern creation through ocl [message #637350 is a reply to message #637143] |
Fri, 05 November 2010 03:55  |
Eclipse User |
|
|
|
Hi Marina
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
|
|
|
Powered by
FUDForum. Page generated in 0.06587 seconds