Home » Modeling » ATL » Containment references cannot span across models(Several output models need to be merged in one file)
Containment references cannot span across models [message #975246] |
Wed, 07 November 2012 18:27 |
Gunnar Arndt Messages: 82 Registered: June 2012 |
Member |
|
|
Hi forum members,
I've been using ATL happily for months now to create a transformation from a vendor-specific model to an open model called OTX. Its purpose is to describe diagnostic procedures.
The ATL file has grown to more than 4kLOC, and seems that I've just run into a serious problem.
The target Ecore model, OTX, has a submodel, DiagCom, which is an Ecore model, too (I received them as XML schema definitions, which I imported with the Ecore tools). Both of them are output models to the ATL transformation:
create OUT: otx, diag: otxDiagCom from IN: transformate;
In the run configuration, there is a file for each model, but all the output shall be put into the OTX output model/file, whereas the DiagCom output file shall remain empty.
That works fine when a DiagCom target element is put into an OTX element within the rule that creates it, but - and that's my problem - it does not work for a set of rules where a DiagCom target element is not put into an OTX element immediately, but by another rule:
lazy rule Asam3dResponse2ResponseParameters {
from
source: transformate!Asam3dResponse
to
-- This target element from DiagCom is not put anywhere in the current rule,
-- which makes it reside in the DiagCom output file eventually.
-- There is nothing I can do about that, although I need it in the OTX file
-- and it should be put there by the next rule 'Asam3dCallServiceTactic2Action'.
otxResponseParameters: otxDiagCom!ResponseParameters(
name <- otxStringTerm
),
otxStringTerm: otx!StringLiteral(
value <- source.name
)
}
lazy rule Asam3dCallServiceTactic2Action {
from
source: transformate!Asam3dCallServiceTactic,
to
otxAction: otx!Action(
id <- thisModule -> getId(),
realisation <- otxExecuteDiagService
),
-- This output element eventually resides in the OTX output file,
-- although it is from the DiagCom model. This is how I need it!
-- I guess it works because it is put into an OTX element right above,
-- i.e. in the very rule where it is created.
otxExecuteDiagService: otxDiagCom!ExecuteDiagService(
diagService <- otxDiagServiceValue,
-- The DiagCom target element 'otxResponseParameters' from the above rule
-- 'Asam3dResponse2ResponseParameters' should be put in the current
-- output element 'otxExecuteDiagService' here, but, as written above,
-- goes to the DiagCom output file.
responseParameters <- source.service.responses
-> collect(response | thisModule ->
Asam3dResponse2ResponseParameters(response))
),
otxDiagServiceValue: otxDiagCom!DiagServiceValue(
valueOf <- source.service.name
)
}
I would more than glad if you could help me with that - it would be a total disaster if I had to rework the whole project without ATL, because I'm running short on time (and it's more fun that way).
Thank you for reading!
|
|
|
Re: Containment references cannot span across models [message #975840 is a reply to message #975246] |
Thu, 08 November 2012 05:36 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Gunnar,
I don't follow the details but note that EMF does support cross resource
containment, i.e., a contained object can be in the root of a different
resource. You need to enable that by setting the GenModel property
"Containment Proxies" to true, and then any containment EReference is
resolveProxies true (the default) will support cross resource containment.
On 07/11/2012 7:27 PM, Gunnar Arndt wrote:
> Hi forum members,
>
> I've been using ATL happily for months now to create a transformation
> from a vendor-specific model to an open model called OTX. Its purpose
> is to describe diagnostic procedures.
> The ATL file has grown to more than 4kLOC, and seems that I've just
> run into a serious problem.
> The target Ecore model, OTX, has a submodel, DiagCom, which is an
> Ecore model, too (I received them as XML schema definitions, which I
> imported with the Ecore tools). Both of them are output models to the
> ATL transformation:
>
> create OUT: otx, diag: otxDiagCom from IN: transformate;
>
> In the run configuration, there is a file for each model, but all the
> output shall be put into the OTX output model/file, whereas the
> DiagCom output file shall remain empty. That works fine when a DiagCom
> target element is put into an OTX element within the rule that creates
> it, but - and that's my problem - it does not work for a set of rules
> where a DiagCom target element is not put into an OTX element
> immediately, but by another rule:
>
> lazy rule Asam3dResponse2ResponseParameters {
> from
> source: transformate!Asam3dResponse
> to
> -- This target element from DiagCom is not put anywhere in the
> current rule,
> -- which makes it reside in the DiagCom output file eventually.
> -- There is nothing I can do about that, although I need it in
> the OTX file
> -- and it should be put there by the next rule
> 'Asam3dCallServiceTactic2Action'.
> otxResponseParameters: otxDiagCom!ResponseParameters(
> name <- otxStringTerm
> ),
> otxStringTerm: otx!StringLiteral(
> value <- source.name
> )
> }
>
> lazy rule Asam3dCallServiceTactic2Action {
> from
> source: transformate!Asam3dCallServiceTactic,
> to
> otxAction: otx!Action(
> id <- thisModule -> getId(),
> realisation <- otxExecuteDiagService
> ),
> -- This output element eventually resides in the OTX output file,
> -- although it is from the DiagCom model. This is how I need it!
> -- I guess it works because it is put into an OTX element right
> above,
> -- i.e. in the very rule where it is created.
> otxExecuteDiagService: otxDiagCom!ExecuteDiagService(
> diagService <- otxDiagServiceValue,
> -- The DiagCom target element 'otxResponseParameters' from the
> above rule
> -- 'Asam3dResponse2ResponseParameters' should be put in the
> current
> -- output element 'otxExecuteDiagService' here, but, as written
> above,
> -- goes to the DiagCom output file.
> responseParameters <- source.service.responses
> -> collect(response | thisModule ->
> Asam3dResponse2ResponseParameters(response))
> ),
> otxDiagServiceValue: otxDiagCom!DiagServiceValue(
> valueOf <- source.service.name
> )
> }
>
>
> I would more than glad if you could help me with that - it would be a
> total disaster if I had to rework the whole project without ATL,
> because I'm running short on time (and it's more fun that way).
> Thank you for reading!
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: Containment references cannot span across models [message #982631 is a reply to message #975246] |
Tue, 13 November 2012 09:36 |
Gunnar Arndt Messages: 82 Registered: June 2012 |
Member |
|
|
Guys, thank you for your replies.
Ed: Containment proxies were indeed deactivated, which I have changed and regenerated.
It does not help, the message "Containment references cannot span across models" shows up again, so I guess it is an ATL problem, not an Ecore one.
Hugo: OTX.ecore and DiagCom.ecore were both created from OTX.xsd, which imports DiagCom.xsd. Seperate sub-models were created automatically, and I only imported them to ATL explicitely because I do not know another way to create sub-model elements there.
When an element of org.iso.otx.DiagCom.DiagService is required, I have tried to use both
to otx!"org::iso::otx::DiagCom::DiagService"()
-- Cannot find class org::iso::otx::DiagCom::DiagService in reference model otx
as described here, and
to otx!DiagService()
-- Cannot find class DiagService in reference model otx
instead of
to otxDiagCom!DiagService()
-- Containment references cannot span across models
but that doesn't work out.
Hugo, your solution is just what I'm looking for, but I don't know how to it that way. Maybe you can post a little example?
|
|
| | | | | | |
Goto Forum:
Current Time: Wed Sep 25 09:06:20 GMT 2024
Powered by FUDForum. Page generated in 0.05866 seconds
|