|
|
|
| Re: Model Elemenet Types: "!" vs. "::" [message #494866 is a reply to message #494865 ] |
Mon, 02 November 2009 19:55   |
Dimitrios Kolovos Messages: 553 Registered: July 2009 |
Senior Member |
|
|
Hi Horacio,
In Epsilon, models are referred to by their names. For example, you can
have two (in general an arbitrary number of) models A and B that conform
to the same metamodel (e.g. the UML 2.x metamodel). In this case,
A!Class.all will return all UML classes in model A and similarly
B!Model.all will return all UML classes in model B.
Therefore, your rule should look like
rule Pizzas2Menu
transform p : Source!NamedPizza
to i : Target!Item {
...
}
where Source and Target (or whatever else you choose them to be in the
"name" field of the model configuration dialogs or in the "name"
attribute of your <epsilon.loadModel ...> ANT tasks) are the names of
your source and target models (not metamodels).
What the rule in its existing form does is that it transforms all
NamedPizzas from the first model of your launch configuration
(regardless of its name) to an Item in your Menu model.
Up to 0.8.7, "" were used to allow you to use reserved words or strings
containing non alphanumeric characters as property/type names (e.g
"transform".allInstances or myObject."my strange property name"). The
Generate ETL utility generates all identifiers within "" to cater for
potential reserved words in your EClasses/EAttributes. From 0.8.8, ``
are used for this reason and "" are used for enclosing literal strings
(to give it a more Java-like flavour).
Cheers,
Dimitris
Horacio wrote:
> Thanks for your reply Dimitris. and don't worry about the delay :d.
>
> Ok, I understand the diference between the two.. or at least I think I
> do. In my test transformation I created a rule to transform one element
> to another:
>
> rule Pizzas2Menu
> transform p : Pizza::NamedPizza
> to i : Menu!Item {
> i.name = p.name;
> }
>
> My input metamodel is PIzza, and my output one is Menu. For the
> transformation to work I had to, as you can see, identify the input
> model element with :: and the output one with !. In the tree2graph
> example ! is used for both input and output ones. And out of curiosity I
> used the "Epsilon->Generate ETL" menu over an ecore model and the
> transformation uses ! and the element name inside double qutoes.
> What I am trying to figure out is when to use one or the other, not from
> a "meaning" point of view (as you explained in your answer), but for my
> workflow to run without erroros, that with such a simple test seems to
> come from somewhere else than the actual "meaning" of each separator.
>
> Regards,
>
>
> Horacio Hoyos
|
|
|
|
|
| Re: Model Elemenet Types: "!" vs. "::" [message #498598 is a reply to message #498038 ] |
Tue, 17 November 2009 11:05   |
Horacio Messages: 9 Registered: October 2009 |
Junior Member |
|
|
Hi Dimitris,
My models have a .xmi extension and reading other posts I thought EMF_M2 was the correct type. Any how I changed it as you suggested and now I get a new error, from the ant processing:
java.lang String index out of range: 0
How can I send you the files as requested?
Regards,
Horacio Hoyos
[Updated on: Tue, 17 November 2009 11:07]
|
|
|
|
| Re: Model Elemenet Types: "!" vs. "::" [message #499010 is a reply to message #498603 ] |
Thu, 19 November 2009 09:37  |
Horacio Messages: 9 Registered: October 2009 |
Junior Member |
|
|
Dimitris,
Thanks for your help! I have a final question. On your mail you told me:
| Quote: |
2. I changed both
<parameter name="isMetamodelFileBased" value="true"/>
to
<parameter name="isMetamodelFileBased" value="false"/>
|
Why and when to set that property to true, and where can I get detailed information on the attributes of the Epsilon workflow tasks?
Thanks,
Horacio
[Updated on: Thu, 19 November 2009 09:50]
|
|
|