[QVTO] subobjects() order [message #499413] |
Sun, 22 November 2009 04:17 |
|
I have a metamodel which is similar with XSD metamodel. As in XSD, Sequence can contains a collection of Element, Sequence, Choice, All and in my case few other components. I would like to process these child components in the same order as they are in the input file but when I execute something like this:
mapping SequenceType::sequenceToTemplateParticles(in templateName:String) : XSDContaniner {
log("invoking SequenceType::sequenceToTemplateParticles() " );
containerType := CONTAINER_TYPE::SEQUENCE;
particles += self.subobjects()->map toTemplateParticles(templateName);
}
mapping OclAny::toTemplateParticles(in templateName:String) : Particle
disjuncts ChoiceType::choiceToTemplateParticles, SequenceType::sequenceToTemplateParticles, ElementType::elementToTemplateElement, EllipsisType::ellipsisToTemplateElement, EllipsisType::ellipsisToTemplateElements {
}
.....
Everything works fine, except every time I run the transformation the order is different then the source Sequence model. What should I do the preserve the order during processing/mapping?
Any help is greatly appreciated.
Thanks,
Ioan
|
|
|
Re: [QVTO] subobjects() order [message #499462 is a reply to message #499413] |
Sun, 22 November 2009 19:33 |
Eclipse User |
|
|
|
Originally posted by: dvorak.radek.gmail.com
Hi Ioan,
If you take a look into the OMG spec, you can see that the subobjects
operation has
the following signature:
Element::subobjects() : Set(Element)
The Set being the return type here does not give any assumptions on
ordering.
Though, I agree, it's fairly impractical to give a different order
of contained elements then they really have in its container.
We will provide a fix, ensuring that the order is preserved.
Regards,
/Radek
On Sun, 22 Nov 2009 05:17:16 +0100, Ioan <ioan.salau@insighteck.com> wrote:
> I have a metamodel which is similar with XSD metamodel. As in XSD,
> Sequence can contains a collection of Element, Sequence, Choice, All and
> in my case few other components. I would like to process these child
> components in the same order as they are in the input file but when I
> execute something like this:
>
>
>
> mapping SequenceType::sequenceToTemplateParticles(in
> templateName:String) : XSDContaniner {
> log("invoking SequenceType::sequenceToTemplateParticles() " );
> containerType := CONTAINER_TYPE::SEQUENCE;
> particles += self.subobjects()->map toTemplateParticles(templateName);
> }
>
> mapping OclAny::toTemplateParticles(in templateName:String) : Particle
> disjuncts ChoiceType::choiceToTemplateParticles,
> SequenceType::sequenceToTemplateParticles,
> ElementType::elementToTemplateElement,
> EllipsisType::ellipsisToTemplateElement,
> EllipsisType::ellipsisToTemplateElements {
> }
>
> ....
>
> Everything works fine, except every time I run the transformation the
> order is different then the source Sequence model. What should I do
> the preserve the order during processing/mapping? Any help is greatly
> appreciated.
>
> Thanks,
>
> Ioan
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03247 seconds