Home » Modeling » Epsilon » Model Elemenet Types: "!" vs. "::"
| | |
Re: Model Elemenet Types: "!" vs. "::" [message #494866 is a reply to message #494865] |
Mon, 02 November 2009 19:55   |
Eclipse User |
|
|
|
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 #500099 is a reply to message #499010] |
Tue, 24 November 2009 18:25  |
Eclipse User |
|
|
|
Hi Horacio,
The ANT tasks are documented in chapter 11 of the Epsilon book but the
chapter doesn't seem to be covering parameters for loading EMF models.
I'll update the book and/or add a new article on this under
http://www.eclipse.org/gmt/epsilon/doc/articles/ within the next few
days. Thanks for pointing this out!
Cheers,
Dimitris
Horacio wrote:
> Dimitris,
>
> Thanks for your help! I have a final question:
>
> [QUOTE]
> 2. I changed both
>
> <parameter name="isMetamodelFileBased" value="true"/>
>
> to
>
> <parameter name="isMetamodelFileBased" value="false"/>
> [/QUOTE
>
> 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
>
--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
|
|
|
Re: Model Elemenet Types: "!" vs. "::" [message #582476 is a reply to message #494860] |
Mon, 02 November 2009 19:20  |
Eclipse User |
|
|
|
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 #582492 is a reply to message #494865] |
Mon, 02 November 2009 19:55  |
Eclipse User |
|
|
|
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 #582840 is a reply to message #494866] |
Fri, 13 November 2009 10:49  |
Eclipse User |
|
|
|
Hello, and sorry fort the late response.
I still can't get it to work.... maybe i'm a doing something wrong elsewhere. This are some snippets of my code (No more pizza :) ):
Transformation.xml:
<epsilon.emf.register file="../HiLeSPL.generator/metamodels/hiles/StructuralHiles.ecore "/>
<epsilon.emf.register file="../HiLeSPL.generator/metamodels/vhdl/ams/VHDL-AMS.ecore "/>
...
<epsilon.loadModel name="Petri" type="EMF_M2">
<parameter name="modelFile" file="../HiLeS(Epsilon)/models/hiles/Petri.xmi"/>
...
</epsilon.loadModel>
...
<epsilon.loadModel name="PetriVHDL" type="EMF_M2">
<parameter name="modelFile" file="../models/vhdl/PetriVHDL.xmi"/>
...
</epsilon.loadModel>
So now on my ETL, usign the model names:
rule System2DesignUnit
transform hs : Petri!HilesSystem
to ds : PetriVHDL!DesignUnit {
ds.identifier = hs.name;
}
This is part of the Petri model:
<?xml version="1.0" encoding="ASCII"?>
<hl:HilesSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hl="/HiLeSPL.generator/metamodels/hiles/StructuralHiles.ecore " xmi:id="_wUOYkLmSEd6krrbVnIHY-w" name="Petri">
<initialArchitecture xmi:id="_fq8nQLmUEd6krrbVnIHY-w" name="main">
...
</initialArchitecture>
</hl:HilesSystem>
So as far as I can see it should work, but I keep getting a "Type Petri!HilesSystem not found" error.
|
|
|
Re: Model Elemenet Types: "!" vs. "::" [message #582850 is a reply to message #582840] |
Fri, 13 November 2009 13:34  |
Eclipse User |
|
|
|
Hi Horacio,
Both
<epsilon.loadModel ... type="EMF_M2">
should be
<epsilon.loadModel ... type="EMF">
If this doesn't solve it, could you please send me your metamodels and a
sample input model so that I can have a closer look?
Cheers,
Dimitris
Horacio wrote:
> Hello, and sorry fort the late response.
>
> I still can't get it to work.... maybe i'm a doing something wrong
> elsewhere. This are some snippets of my code (No more pizza :) ):
>
> Transformation.xml:
>
> <epsilon.emf.register
> file="../HiLeSPL.generator/metamodels/hiles/StructuralHiles.ecore "/>
> <epsilon.emf.register
> file="../HiLeSPL.generator/metamodels/vhdl/ams/VHDL-AMS.ecore "/>
> ..
> <epsilon.loadModel name="Petri" type="EMF_M2">
> <parameter name="modelFile"
> file="../HiLeS(Epsilon)/models/hiles/Petri.xmi"/>
> ..
> </epsilon.loadModel>
> ..
> <epsilon.loadModel name="PetriVHDL" type="EMF_M2">
> <parameter name="modelFile"
> file="../models/vhdl/PetriVHDL.xmi"/>
> ..
> </epsilon.loadModel>
>
> So now on my ETL, usign the model names:
>
> rule System2DesignUnit
> transform hs : Petri!HilesSystem
> to ds : PetriVHDL!DesignUnit {
> ds.identifier = hs.name;
> }
>
>
> This is part of the Petri model:
>
> <?xml version="1.0" encoding="ASCII"?>
> <hl:HilesSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:hl="/HiLeSPL.generator/metamodels/hiles/StructuralHiles.ecore "
> xmi:id="_wUOYkLmSEd6krrbVnIHY-w" name="Petri">
> <initialArchitecture xmi:id="_fq8nQLmUEd6krrbVnIHY-w" name="main">
> ...
> </initialArchitecture>
> </hl:HilesSystem>
>
>
> So as far as I can see it should work, but I keep getting a "Type
> Petri!HilesSystem not found" error.
>
>
>
|
|
|
Re: Model Elemenet Types: "!" vs. "::" [message #582898 is a reply to message #498038] |
Tue, 17 November 2009 11:05  |
Eclipse User |
|
|
|
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
I am sending you the files as requested.
Regards,
Horacio Hoyos
|
|
| |
Re: Model Elemenet Types: "!" vs. "::" [message #583051 is a reply to message #498603] |
Thu, 19 November 2009 09:37  |
Eclipse User |
|
|
|
Dimitris,
Thanks for your help! I have a final question:
[QUOTE]
2. I changed both
<parameter name="isMetamodelFileBased" value="true"/>
to
<parameter name="isMetamodelFileBased" value="false"/>
[/QUOTE
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
|
|
|
Re: Model Elemenet Types: "!" vs. "::" [message #583218 is a reply to message #583051] |
Tue, 24 November 2009 18:25  |
Eclipse User |
|
|
|
Hi Horacio,
The ANT tasks are documented in chapter 11 of the Epsilon book but the
chapter doesn't seem to be covering parameters for loading EMF models.
I'll update the book and/or add a new article on this under
http://www.eclipse.org/gmt/epsilon/doc/articles/ within the next few
days. Thanks for pointing this out!
Cheers,
Dimitris
Horacio wrote:
> Dimitris,
>
> Thanks for your help! I have a final question:
>
> [QUOTE]
> 2. I changed both
>
> <parameter name="isMetamodelFileBased" value="true"/>
>
> to
>
> <parameter name="isMetamodelFileBased" value="false"/>
> [/QUOTE
>
> 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
>
--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
|
|
|
Goto Forum:
Current Time: Tue Jul 22 15:10:24 EDT 2025
Powered by FUDForum. Page generated in 0.06088 seconds
|