Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » subobjects() order of elements(Is there an alternative implementation of subobjects() that preserves the object ordering as defined in the input file?)
subobjects() order of elements [message #1032935] Wed, 03 April 2013 16:43 Go to next message
Paul Rontidis is currently offline Paul RontidisFriend
Messages: 10
Registered: March 2013
Junior Member
Hello,
I was getting very close to completing my QVTo project but I have met an obstacle.
The Stdlib::Element::subobjects() : Set(Element) does not preserve object ordering in Operational QVT version: 3.2.2.v20130128-1651.
I know this is excepted due to the fact that the result type is a Set.

Is there an alternative implementation of subobjects() that preserves the object ordering as defined in the input file (e.g. xmi)?

Best,
Paul

[Updated on: Wed, 03 April 2013 16:45]

Report message to a moderator

Re: subobjects() order of elements [message #1032947 is a reply to message #1032935] Wed, 03 April 2013 17:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

There shouldn't be. What you're asking for is misguided.

If you want to preserve ordering in a tree you must descend over
relationships that are known to be ordered.

Or you shoud change technology spaces so that you use XMI as your metamodel.

Regards

Ed Willink

On 03/04/2013 17:43, Paul Rontidis wrote:
> Hello,
> I was getting very close to completing my QVTo project but I have met
> an obstacle. The Stdlib::Element::subobjects() : Set(Element) does not
> preserve object ordering in Operational QVT version:
> 3.2.2.v20130128-1651. I know this is excepted due to the fact that the
> result type is a Set.
>
> Is there an alternative implementation of subobjects() that preserves
> the object ordering as defined in the input file (e.g. xmi)?
Re: subobjects() order of elements [message #1032957 is a reply to message #1032947] Wed, 03 April 2013 17:24 Go to previous messageGo to next message
Paul Rontidis is currently offline Paul RontidisFriend
Messages: 10
Registered: March 2013
Junior Member
Hello,

Please let me clarify the reason I need the object order.
The xmi input(PIM) is extracted from a DSL text.
I am trying to perform a PIM to PSM transformation with QVTo.
Once I get the PSM, I generate C code in which case the ordering statements is crucial.
The body statements are the subobjects() of Body elements (as defined in PIM).
Do you think my approach is wrong?

Best,
Paul
Re: subobjects() order of elements [message #1032964 is a reply to message #1032957] Wed, 03 April 2013 17:37 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

No, but you must navigate with ordering.

So get all your Bodies in order, then all their sub objects in order.
Don't expect to preserve order through a disordered approach.

Regards

Ed

On 03/04/2013 18:24, Paul Rontidis wrote:
> Hello,
> Please let me clarify the reason I need the object order. The xmi
> input(PIM) is extracted from a DSL text. I am trying to perform a PIM
> to PSM transformation with QVTo. Once I get the PSM, I generate C code
> in which case the ordering statements is crucial. The body statements
> are the subobjects() of Body elements (as defined in PIM). Do you
> think my approach is wrong?
>
> Best,
> Paul
Re: subobjects() order of elements [message #1033037 is a reply to message #1032964] Wed, 03 April 2013 19:48 Go to previous messageGo to next message
Paul Rontidis is currently offline Paul RontidisFriend
Messages: 10
Registered: March 2013
Junior Member
Hello Ed,

First of all, thank you much for your replies.

Excuse me, but I cannot understand the "ordered navigation" part of your answer.

In my PIM only Methods contain a Body element.

For example, I have a Method element, this Method has a Body and the Body has (as statements) various model objects(Expressions, Ifs, Loops).
Thus, I want to retrieve objects of different type in the order they appear in the XMI.

I don't face the same problem with Properties (ordered reference to Property object) which are mapped first and I retrieve them in the correct order.

I appreciate your help so far.
Best,
Paul

P.S.In my PSM I defined a Statement object as a container for each body object. However, the DSL editor (and thus the automatically generated PIM metamodel) was part of another person's work.

[Updated on: Thu, 04 April 2013 08:26]

Report message to a moderator

Re: subobjects() order of elements [message #1033073 is a reply to message #1033037] Wed, 03 April 2013 20:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Consider a real world example.

You want to extract a geographically ordered list of police stations
from an Interpol database that you happen to know is geographically ordered.

You are asking the question, give me all the police stations and
complaining that your respondent gives them to you in alphabetical order.

To get your required ordering you must successively visit each
continent, country, county, town to reach the police stations, at each
level preserving the required geographical order. If at any step you
violate the order you lose it.

Regards

Ed Willink



On 03/04/2013 20:48, Paul Rontidis wrote:
> Hello Ed,
>
> First of all, thank you very much for your replies.
>
> Excuse me, but I cannot understand the "ordered navigation" part of
> your answer.
>
> In my PIM only Methods contain a Body element.
>
> For example, I have a Method element, this Method has a Body and the
> Body has (as statements) various model objects(Expressions, Ifs,
> Loops). Thus, I want to retrieve objects of different type in the
> order they appear in the XMI.
> I don't face the same problem with Properties (ordered reference to
> Property object) which are mapped first and I retrieve them in the
> correct order.
>
> I appreciate your help so far.
> Best,
> Paul
>
> P.S. In my PSM I defined a Statement object as a container for each
> body object. However, the DSL editor -which directly affects the
> extracted xmi- was developed by another person and I am not sure I can
> modify it to alter the PIM.
Re: subobjects() order of elements [message #1033145 is a reply to message #1032935] Wed, 03 April 2013 22:54 Go to previous messageGo to next message
Paul Rontidis is currently offline Paul RontidisFriend
Messages: 10
Registered: March 2013
Junior Member
Hello,

after reading the police station metaphor I totally understand what you said.

However, I cannot think how to overcome the problem without changing the PIM metamodel. For example, change it so all body elements have a common super-type foo and the body has an ordered reference to foo.

Best,
Paul
Re: subobjects() order of elements [message #1033364 is a reply to message #1033145] Thu, 04 April 2013 06:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Consider a UML file and a requirement for an ordered list of all parameters.

Not possible because operations are not ordered in classes, classes are
not ordered in packages and packages are not ordered in packages.

However if you use an *.ecore file it is possible, because eOperations,
eClassifiers etc are ordered and so you can do an order-preserving descent.

If your PIM is not hierarchically ordered then you are not a modeler if
you access more information than is actually modeled.

Regards

Ed Willink


On 03/04/2013 23:54, Paul Rontidis wrote:
> Hello,
>
> after reading the police station metaphor I totally understand what
> you said.
>
> However, I cannot think how to overcome the problem without changing
> the PIM metamodel. For example, change it so all body elements have a
> common super-type foo and the body has an ordered reference to foo.
>
> Best,
> Paul
>
Re: subobjects() order of elements [message #1033425 is a reply to message #1033364] Thu, 04 April 2013 08:09 Go to previous messageGo to next message
Paul Rontidis is currently offline Paul RontidisFriend
Messages: 10
Registered: March 2013
Junior Member
Hello,

Ed Willink wrote on Thu, 04 April 2013 04:51

If your PIM is not hierarchically ordered then you are not a modeler if
you access more information than is actually modeled.

As I said, my work starts after the PIM metamodel definition which is why I did not encounter such issues with the PSM metamodel.

Anyway, you clearly answered the original (and relevant to this forum) question in your first post.

Thank you for the discussion.

Best,
Paul
Re: subobjects() order of elements [message #1033625 is a reply to message #1032935] Thu, 04 April 2013 12:51 Go to previous message
Christopher Gerking is currently offline Christopher GerkingFriend
Messages: 115
Registered: April 2011
Senior Member
Just to let you know, the issue has already been tracked some time ago:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=295814

The problem is actually not the missing order as such, but the random order produced when ordering. Executing a transformation twice on the same input may result in different outputs, since the obtained order may differ from execution to execution.
Previous Topic:objectsOfType don`t return correct results
Next Topic:Mapping in/output programmatically
Goto Forum:
  


Current Time: Thu Mar 28 20:25:17 GMT 2024

Powered by FUDForum. Page generated in 0.05380 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top