|Re: [QVTo] How to mapp association between two classes [message #1795094 is a reply to message #1795089]
||Fri, 14 September 2018 12:14
| Ed Willink
Registered: July 2009
I'm not sure what 'resolve' has to do with mapping Associations ...
My personal experience with 'resolve' was not good. I found it confusing and untrustworthy and so preferred to maintain my mappings in a Dict that I could understand.
For QVT 1.3, I tried to pin down the semantics of traceability that underpins the resolve functions. This is written up as "8.1.11 Tracing and Resolving" and while it does not precisely correspond with the current Eclipse QVTo implementation, it is not significantly different. Areas where the Eclipse QVTo implementation needs to catch up concern the tracing of polymorphic mappings.
While QVTo has many declarative facilities, it is an operational/imperative language, so it is your responsibility as a programmer to ensure that if A2B needs to use the results of C2D, then C2D must execute first. If A2B 'resolves' something using C2D before C2D executes you get a null resolution. There is an underspecified "late resolve" facility that I cannot honestly recommend. IIRC, in Eclipse QVTo, late resolve works for a simple object reference, it does not work for an expression involving an object reference.
In practice many transformations need two passes, a first pass to create a composition tree of output objects and then a second pass to create the cross-references that support an output graph rather than tree. The second pass can use resolve to navigate the results of the first pass. In QVTo you need to code these two passes as separate suites of mappings that execute on before the other. (In QVTr you can specify everything a single mapping since a QVTr must understand the dependencies and sequence its actions accordingly.)
It is likely that problems that you encounter with resolve are through an over-optimistic attempt to use a one-pass solution for a two-pass problem. Statistically one might expect that 50% of resolves will 'work' and 50% will 'fail'.
Powered by FUDForum
. Page generated in 0.02095 seconds