When specifying more than one input model, only the first one will be considered for pattern matching (if the extends are not referenced via @extend directly). For some use cases I have a large number of small input models which share the same metamodel. Is there a possibility to consider them all for pattern matching without addressing each one directly?
Sometimes it would be even useful to put various models (with the same metamodel) in one single extend. For my scenario I would like to put all physical separated models in this logical extend. This way I could deal easier with a dynamic number of input models (which is the case for my scenario).
On 11/09/2007, RFR <rene.fre...@student.hpi.uni-potsdam.de> wrote:
> When specifying more than one input model, only the first one will be > considered for pattern matching (if the extends are not referenced via > @extend directly). For some use cases I have a large number of small > input models which share the same metamodel. Is there a possibility to > consider them all for pattern matching without addressing each one > directly?
> Sometimes it would be even useful to put various models (with the same > metamodel) in one single extend. For my scenario I would like to put > all physical separated models in this logical extend. This way I could > deal easier with a dynamic number of input models (which is the case > for my scenario).
> Best regards > René
Hi again René,
More interesting questions. In theory, the single-extent solution is possible and the foundation to support it does exist, however...
At the moment you can only do this if you invoke Tefkat programmatically -- you create an instance of tefkat.model.impl.RefereceExtentImpl and add your org.eclipse.emf.ecore.resource.Resource objects to its multi-valued resources attribute, then you invoke transform(Resource transformation, Extent[] srcs, Extent[] tgts, Extent trackingExtent, boolean force) on an instance of tefkat.engine.Tefkat. The problem then is that this is not a public method :-(
Fixing this is something we can do in the short term.
To answer your first question, if you want a single rule to match across some number of input models, then you should be able to write something like:
TRANSFORMATION t: s1, s2, s3, s4, s5 -> t
// s1, s2, and s3 share the same metamodel and we // want to consider them together. // PATTERN sourceGroup(s) WHERE s = s1 OR s = s2 OR s = s3;
RULE rule FORALL Foo@s f WHERE sourceGroup(s) AND f.attr = "value" MAKE Bar b ;
This is because extent variables are just ordinary variables that happen to be bound to Extent objects (if they aren't then using them in @extent will fail).
The idea with the PATTERN for a source group helps indeed. The only problem which remains is that the number of input models is still static. Since I would prefer programmatical invokation of a transformation run anyway, access to the yet private method would solve this, too.
Is a transformation run involving two extends with different metamodels and multiple resources for each extend also possible this way?
Regards René
On 11 Sep., 15:10, "michael lawley" <mich...@lawley.id.au> wrote:
> On 11/09/2007, RFR <rene.fre...@student.hpi.uni-potsdam.de> wrote:
> > When specifying more than one input model, only the first one will be > > considered for pattern matching (if the extends are not referenced via > > @extend directly). For some use cases I have a large number of small > > input models which share the same metamodel. Is there a possibility to > > consider them all for pattern matching without addressing each one > > directly?
> > Sometimes it would be even useful to put various models (with the same > > metamodel) in one single extend. For my scenario I would like to put > > all physical separated models in this logical extend. This way I could > > deal easier with a dynamic number of input models (which is the case > > for my scenario).
> > Best regards > > René
> Hi again René,
> More interesting questions. In theory, the single-extent solution is > possible and the foundation to support it does exist, however...
> At the moment you can only do this if you invoke Tefkat > programmatically -- you create an instance of > tefkat.model.impl.RefereceExtentImpl and add your > org.eclipse.emf.ecore.resource.Resource objects to its multi-valued > resources attribute, then you invoke transform(Resource > transformation, Extent[] srcs, Extent[] tgts, Extent trackingExtent, > boolean force) on an instance of tefkat.engine.Tefkat. The problem > then is that this is not a public method :-(
> Fixing this is something we can do in the short term.
> To answer your first question, if you want a single rule to match > across some number of input models, then you should be able to write > something like:
> TRANSFORMATION t: s1, s2, s3, s4, s5 -> t
> // s1, s2, and s3 share the same metamodel and we > // want to consider them together. > // > PATTERN sourceGroup(s) > WHERE s = s1 OR s = s2 OR s = s3;
> RULE rule > FORALL Foo@s f > WHERE sourceGroup(s) AND f.attr = "value" > MAKE Bar b > ;
> This is because extent variables are just ordinary variables that > happen to be bound to Extent objects (if they aren't then using them > in @extent will fail).
> At the moment you can only do this if you invoke Tefkat > programmatically -- you create an instance of > tefkat.model.impl.RefereceExtentImpl and add your > org.eclipse.emf.ecore.resource.Resource objects to its multi-valued > resources attribute, then you invoke transform(Resource > transformation, Extent[] srcs, Extent[] tgts, Extent trackingExtent, > boolean force) on an instance of tefkat.engine.Tefkat. The problem > then is that this is not a public method :-(
> Fixing this is something we can do in the short term.
Hi Michael,
Will this be fixed for a new release or do I have to fix it on the basis of the CVS version? Is the CVS version as stable as the release?
> > At the moment you can only do this if you invoke Tefkat > > programmatically -- you create an instance of > > tefkat.model.impl.RefereceExtentImpl and add your > > org.eclipse.emf.ecore.resource.Resource objects to its multi-valued > > resources attribute, then you invoke transform(Resource > > transformation, Extent[] srcs, Extent[] tgts, Extent trackingExtent, > > boolean force) on an instance of tefkat.engine.Tefkat. The problem > > then is that this is not a public method :-(
> > Fixing this is something we can do in the short term.
> Hi Michael,
> Will this be fixed for a new release or do I have to fix it on the > basis of the CVS version? > Is the CVS version as stable as the release?
"...specify the name of the source extent variable as the Var Group property in the tefkat config file. For example, if there are two source models, file:foo.xmi and file:bar.xmi and the transformation is specified as TRANSFORMATION example: src -> tgt then you would add two SourceModels to the TransformationTask, one with Location Uri = file:foo.xmi and one with file:bar.xmi but set the Var Group of both to src."
nice to have that integrated into the UI launching method.
Anyway, is there also a solution for the situation, when the numper of models is dynamic. Best solution would be to generate a tefkat.xml dynamically and launch the engine programatically. Is such an interface available (run (TKConfiguration))?
Regards René
On 19 Sep., 01:16, "michael lawley" <mich...@lawley.id.au> wrote:
> "...specify the name of the source extent variable as the Var Group > property in the tefkat config file. For example, if there are two > source models, file:foo.xmi and file:bar.xmi and the transformation is > specified as TRANSFORMATION example: src -> tgt then you would add two > SourceModels to the TransformationTask, one with Location Uri = > file:foo.xmi and one with file:bar.xmi but set the Var Group of both > to src."
Yes, you can create a tefkat.config.TefkatConfig.TransformationTask programmatically (no need to serialise it to tefkat.xmi) and call new Tefkat().transform(transformationTask, true, false) The other parameters mean yes, please save the resulting models and no, don't continue after an error.
Alternatively, you can call tefkat.engine.Main.main(String[] args) with appropriate arguments:
> nice to have that integrated into the UI launching method.
> Anyway, is there also a solution for the situation, when the numper of > models is dynamic. Best solution would be to generate a tefkat.xml > dynamically and launch the engine programatically. Is such an > interface available (run (TKConfiguration))?
> Regards René
> On 19 Sep., 01:16, "michael lawley" <mich...@lawley.id.au> wrote: > > Hi René,
> > There is a new release available (build 2.1.0.lawley235) that supports > > multiple Resources per (source) Extent.
> > "...specify the name of the source extent variable as the Var Group > > property in the tefkat config file. For example, if there are two > > source models, file:foo.xmi and file:bar.xmi and the transformation is > > specified as TRANSFORMATION example: src -> tgt then you would add two > > SourceModels to the TransformationTask, one with Location Uri = > > file:foo.xmi and one with file:bar.xmi but set the Var Group of both > > to src."