[QVTo] composing transformations [message #789649] |
Fri, 03 February 2012 08:28  |
Eclipse User |
|
|
|
Hi,
I created two transformations T1 and T2 both having the signature:
T(in inModel : mm_pgwb, out outModel : mm_pgwb)
I'd like to create a transformation that results in the composition of T1 and T2. Therefore I came up with something that looks like:
transformation all(in inModel : mm_pgwb, out outModel : mm_pgwb)
access T1(in inModel : mm_pgwb, out outModel : mm_pgwb)
access T2(in inModel : mm_pgwb, out outModel : mm_pgwb);
main() {
var m1 : mm_pgwb = outModel.createEmptyModel().oclAsType(mm_pgwb);
var t1:= new T1(inModel, m1).transform();
var t2:= new T2(m1, outModel).transform();
}
When I try to execute this code, eclipse/qvt complains with this message:
org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException: Undefined model passed to transformation
at all::main(all.qvto:74)
I assume that m1 is an empty model without any root element and that is the reason for the error. Two questions: is my assumption right and if so, how can I add a root element to a Model entity?
Greetings,
Wilbert.
|
|
|
Re: [QVTo] composing transformations [message #789735 is a reply to message #789649] |
Fri, 03 February 2012 10:37   |
Eclipse User |
|
|
|
Hi Wilbert
(I think you must be getting sufficiently expert to answer rather than
ask questions.)
It's not clear which line all.qvto:74 is, (and it might be off by one
anyway). But assuming it's the T1 step, I would go in with Java debugger
and see how the construcytion of T1 differs in your call to a normal
call of T1 as an uncomposed transformation. You can then copy whatever
code enabled T1 to work. If it's the T2 step then save the intermediate
and try to use it in a T2-only context and again compare construction
contexts.
You may also want to prune the ResourceSet since leaving temporaries
around from T1 could corrupt the behaviour of T2.
Regards
Ed Willink
On 03/02/2012 08:28, Wilbert Alberts wrote:
> Hi,
>
> I created two transformations T1 and T2 both having the signature:
>
> T(in inModel : mm_pgwb, out outModel : mm_pgwb)
>
> I'd like to create a transformation that results in the composition of
> T1 and T2. Therefore I came up with something that looks like:
>
> transformation all(in inModel : mm_pgwb, out outModel : mm_pgwb)
>
> access T1(in inModel : mm_pgwb, out outModel : mm_pgwb)
> access T2(in inModel : mm_pgwb, out outModel : mm_pgwb);
>
> main() {
> var m1 : mm_pgwb = outModel.createEmptyModel().oclAsType(mm_pgwb);
>
> var t1:= new T1(inModel, m1).transform();
> var t2:= new T2(m1, outModel).transform();
> }
>
> When I try to execute this code, eclipse/qvt complains with this message:
>
> org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException:
> Undefined model passed to transformation
> at all::main(all.qvto:74)
>
> I assume that m1 is an empty model without any root element and that
> is the reason for the error. Two questions: is my assumption right and
> if so, how can I add a root element to a Model entity?
>
> Greetings,
> Wilbert.
>
|
|
|
Re: [QVTo] composing transformations [message #791747 is a reply to message #789735] |
Mon, 06 February 2012 08:08  |
Eclipse User |
|
|
|
I came to the following solution. In stead of using createEmptyModel for creating intermediate models, I used copy().
transformation all(in inModel : mm_pgwb, out outModel : mm_pgwb)
access T1(in inModel : mm_pgwb, out outModel : mm_pgwb)
access T2(in inModel : mm_pgwb, out outModel : mm_pgwb);
main() {
var m1 : mm_pgwb = outModel.copy().oclAsType(mm_pgwb);
var t1:= new T1(inModel, m1).transform();
var t2:= new T2(m1, outModel).transform();
}
This one works.
Thanks.
Wilbert
|
|
|
Powered by
FUDForum. Page generated in 0.04330 seconds