how to transform a bidirectional relationship? [message #1848906] |
Wed, 22 December 2021 17:54  |
Eclipse User |
|
|
|
Hello,
I am still a beginner in using QVT for M2M transformation, I wonder if we can transform a bidirectional relation to a class with the QVTo and how?
More precisely, I want to make a transformation from a multidimensional model to a graph model, I had no problem to transform the components of the source model except for the R3:
R1: each fact and dimension are transformed into vertex .
R2: measures, parameter and weak attribute are transformed into vertex property.
R3: the relation between the fact and the dimension is transformed into edge, connecting two vertexes, a vertexIn represents a fact, and vertexOut represents the dimension, with a label named "fact_Dim_Link".
the problem that arises is the transformation of the bidirectional relation that links a fact with a dimension to an edge, I don't know how to describe it in QVTo, knowing that the mapping requires two entities and not a relation.
Thank .
|
|
|
|
Re: how to transform a bidirectional relationship? [message #1849019 is a reply to message #1848925] |
Wed, 29 December 2021 12:16   |
Eclipse User |
|
|
|
Hi Ed,
thank you for your feedback, but even if I change this relationship, how to transform the properties of a relationship to another relationship properties. I am lost on this point, most of the articles make transformations of a class towards another, but this point, I found nothing.
In attachment, my two metamodels source and target.
I made all the transformations, and I initialized my MetaModele for the test, the error on the vertexIn and the vertexOut is reported, it asks me that I must define them, knowing that the vertexIn and vertexout describe the relation between a fact and dimension in the source model, Can someone clarify me on this point, how I can realize this transformation.
Regards,
Doha
Attachment: MD_SCTRG.png
(Size: 327.65KB, Downloaded 156 times)
|
|
|
Re: how to transform a bidirectional relationship? [message #1849024 is a reply to message #1849019] |
Wed, 29 December 2021 15:08  |
Eclipse User |
|
|
|
HI
Your failure to provide any clue as to what your transformation does leaves me guessing. See https://wiki.eclipse.org/OCL/ForumNetiquette
You target metamodel has no bidirectional relationships so my answer for the harder to-bidirectional use case is not that helpful. The from-bidirectional use case can be trivial unless you overthink it.
If you want to transform the bidirectional L+R, you may use one mapping for L+RtoLA2RA and another for L+RtoRB2LB. You may choose to inline as parts of LtoLA and RtoRB.
A difficulty only arises if you try to re-use an L+RtoLdash+Rdash to produce two unidirectionals from a bidirectional. Returning a tuple of the two is clumsy. Invoking twice will not work since the duplication is optimized away; you have to add a gratuitous disambiguating Boolean parameter so that forward/reverse are distinct mapping invocations.
Obviously if you want vertexIn/vertexOut to feature then they need them to be part of the transformation and you have declined to show your best attempt and so prevented me from providing a better answer.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.17254 seconds