Home » Archived » M2M (model-to-model transformation) » [ATL] Problems with Contexts and ATL 2006
[ATL] Problems with Contexts and ATL 2006 [message #7664] |
Sun, 14 January 2007 05:31 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
Is there a known issue with helper contexts and ATL 2006?
I have the following helper and context:
helper context ecore!EObject def: test() : String =
'test';
rule Example {
from s : ecore!EObject
to t : metamodel!Node (
name <- s.test()
}
It matches ecore!EObject fine, but the context doesn't work. I get
message: ERROR: could not find operation test on MOF!RelationshipType
having supertypes: [OclType, OclAny] (including Java operations)
If I don't use the context and use:
helper def: test2() : String =
'test2';
the name <- thisModule.test2()
works fine.
cheers,
ian
|
|
| |
Re: [ATL] Problems with Contexts and ATL 2006 [message #8962 is a reply to message #7747] |
Thu, 18 January 2007 03:24 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
that is a good question, I think it worked with 2004, bu I probably
wasn't doing it on the ecore!EObject.
What is the best way to give you my launch configuration (where are they
stored)?
cheers,
ian
Frédéric Jouault wrote:
> Hi Ian,
>
> I do not think there is such a specific issue in ATL 2006.
> Are you sure this only happens with this version, and not with ATL 2004?
>
>
> Do you have this problem with any metamodel, or only with the Ecore
> metametamodel?
> Could you please give your launch configuration?
>
>
> Regards,
>
> Frédéric Jouault
>
>
> Ian Bull wrote:
>> Is there a known issue with helper contexts and ATL 2006?
>>
>> I have the following helper and context:
>>
>> helper context ecore!EObject def: test() : String =
>> 'test';
>>
>>
>> rule Example {
>> from s : ecore!EObject
>> to t : metamodel!Node (
>> name <- s.test()
>> }
>> It matches ecore!EObject fine, but the context doesn't work. I get
>> message: ERROR: could not find operation test on MOF!RelationshipType
>> having supertypes: [OclType, OclAny] (including Java operations)
>>
>> If I don't use the context and use:
>> helper def: test2() : String =
>> 'test2';
>>
>> the name <- thisModule.test2()
>>
>> works fine.
>>
>> cheers,
>> ian
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #8982 is a reply to message #8962] |
Thu, 18 January 2007 03:25 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
I am also having problems with distinct .. foreach. This may be
releated too.
cheers,
ian
Ian Bull wrote:
> that is a good question, I think it worked with 2004, bu I probably
> wasn't doing it on the ecore!EObject.
>
> What is the best way to give you my launch configuration (where are they
> stored)?
>
> cheers,
> ian
>
> Frédéric Jouault wrote:
>> Hi Ian,
>>
>> I do not think there is such a specific issue in ATL 2006.
>> Are you sure this only happens with this version, and not with ATL 2004?
>>
>>
>> Do you have this problem with any metamodel, or only with the Ecore
>> metametamodel?
>> Could you please give your launch configuration?
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Ian Bull wrote:
>>> Is there a known issue with helper contexts and ATL 2006?
>>>
>>> I have the following helper and context:
>>>
>>> helper context ecore!EObject def: test() : String =
>>> 'test';
>>>
>>>
>>> rule Example {
>>> from s : ecore!EObject
>>> to t : metamodel!Node (
>>> name <- s.test()
>>> }
>>> It matches ecore!EObject fine, but the context doesn't work. I get
>>> message: ERROR: could not find operation test on MOF!RelationshipType
>>> having supertypes: [OclType, OclAny] (including Java operations)
>>>
>>> If I don't use the context and use:
>>> helper def: test2() : String =
>>> 'test2';
>>>
>>> the name <- thisModule.test2()
>>>
>>> works fine.
>>>
>>> cheers,
>>> ian
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #9071 is a reply to message #8962] |
Thu, 18 January 2007 09:37 |
Eclipse User |
|
|
|
Originally posted by: freddy.allilaire.univ-nantes.fr
Hi Ian,
You can save a launch configuration by using the tab "Common". You
should choose the option "Shared file". This will create a *.launch file
in the selected folder.
Regards,
Freddy.
Ian Bull a écrit :
> that is a good question, I think it worked with 2004, bu I probably
> wasn't doing it on the ecore!EObject.
>
> What is the best way to give you my launch configuration (where are they
> stored)?
>
> cheers,
> ian
>
> Frédéric Jouault wrote:
>> Hi Ian,
>>
>> I do not think there is such a specific issue in ATL 2006.
>> Are you sure this only happens with this version, and not with ATL 2004?
>>
>>
>> Do you have this problem with any metamodel, or only with the Ecore
>> metametamodel?
>> Could you please give your launch configuration?
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Ian Bull wrote:
>>> Is there a known issue with helper contexts and ATL 2006?
>>>
>>> I have the following helper and context:
>>>
>>> helper context ecore!EObject def: test() : String =
>>> 'test';
>>>
>>>
>>> rule Example {
>>> from s : ecore!EObject
>>> to t : metamodel!Node (
>>> name <- s.test()
>>> }
>>> It matches ecore!EObject fine, but the context doesn't work. I get
>>> message: ERROR: could not find operation test on MOF!RelationshipType
>>> having supertypes: [OclType, OclAny] (including Java operations)
>>>
>>> If I don't use the context and use:
>>> helper def: test2() : String =
>>> 'test2';
>>>
>>> the name <- thisModule.test2()
>>>
>>> works fine.
>>>
>>> cheers,
>>> ian
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #9194 is a reply to message #9071] |
Thu, 18 January 2007 19:32 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
This is a multi-part message in MIME format.
--------------070602000307010604040404
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Here is my launch configuration.
However, I think the problem may be around SuperTypes and ATL.
-- @atlcompiler atl2006
module TestTransform; -- Module Template
create output : metamodel from My : ecore;
helper context ecore!EObject def: getMyString() : String =
self.toString();
rule Example {
from s : ecore!EObject
to t : metamodel!Node (
name <- s.getMyString()
)
}
This transformation doesn't work:
****** BEGIN Stack Trace
message: ERROR: could not find operation getMyString on
MOF!RelationshipType having supertypes: [OclType, OclAny] (including
Java operations)
A.main() : ??#24 null
local variables = {self=TestTransform : ASMModule}
local stack = []
A.__exec__() : ??#8 null
local variables = {e=TransientLink {rule = 'Example', sourceElements =
{s = My!calls}, targetElements = {t = output!<notnamedyet>}, variables =
{}}, self=TestTransform : ASMModule}
local stack = []
A.__applyExample(1 : NTransientLink;) : ??#12 11:25-11:40
local variables = {t=output!<notnamedyet>, s=My!calls,
link=TransientLink {rule = 'Example', sourceElements = {s = My!calls},
targetElements = {t = output!<notnamedyet>}, variables = {}},
self=TestTransform : ASMModule}
local stack = [output!<notnamedyet>, output!<notnamedyet>,
TestTransform : ASMModule]
****** END Stack Trace
But if I change the context to use OclAny it does work. It seems
strange that the rule matches the EObject but the helper doesn't.
Does it make sense to match EObject?
cheers,
ian
Freddy Allilaire wrote:
> Hi Ian,
>
> You can save a launch configuration by using the tab "Common". You
> should choose the option "Shared file". This will create a *.launch file
> in the selected folder.
>
> Regards,
> Freddy.
>
> Ian Bull a
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #9214 is a reply to message #9194] |
Thu, 18 January 2007 21:17 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
Where is RelationshipType defined?
Could you please try to use ecore!EModelElement instead of ecore!EObject
and report the results?
Regards,
Frédéric Jouault
Ian Bull wrote:
> Here is my launch configuration.
>
> However, I think the problem may be around SuperTypes and ATL.
>
> -- @atlcompiler atl2006
> module TestTransform; -- Module Template
> create output : metamodel from My : ecore;
>
> helper context ecore!EObject def: getMyString() : String =
> self.toString();
>
> rule Example {
> from s : ecore!EObject
> to t : metamodel!Node (
> name <- s.getMyString()
> )
>
> }
> This transformation doesn't work:
> ****** BEGIN Stack Trace
> message: ERROR: could not find operation getMyString on
> MOF!RelationshipType having supertypes: [OclType, OclAny] (including
> Java operations)
> A.main() : ??#24 null
> local variables = {self=TestTransform : ASMModule}
> local stack = []
> A.__exec__() : ??#8 null
> local variables = {e=TransientLink {rule = 'Example', sourceElements
> = {s = My!calls}, targetElements = {t = output!<notnamedyet>}, variables
> = {}}, self=TestTransform : ASMModule}
> local stack = []
> A.__applyExample(1 : NTransientLink;) : ??#12 11:25-11:40
> local variables = {t=output!<notnamedyet>, s=My!calls,
> link=TransientLink {rule = 'Example', sourceElements = {s = My!calls},
> targetElements = {t = output!<notnamedyet>}, variables = {}},
> self=TestTransform : ASMModule}
> local stack = [output!<notnamedyet>, output!<notnamedyet>,
> TestTransform : ASMModule]
> ****** END Stack Trace
>
> But if I change the context to use OclAny it does work. It seems
> strange that the rule matches the EObject but the helper doesn't.
>
> Does it make sense to match EObject?
>
> cheers,
> ian
>
>
> Freddy Allilaire wrote:
>> Hi Ian,
>>
>> You can save a launch configuration by using the tab "Common". You
>> should choose the option "Shared file". This will create a *.launch
>> file in the selected folder.
>>
>> Regards,
>> Freddy.
>>
>> Ian Bull a écrit :
>>> that is a good question, I think it worked with 2004, bu I probably
>>> wasn't doing it on the ecore!EObject.
>>>
>>> What is the best way to give you my launch configuration (where are
>>> they stored)?
>>>
>>> cheers,
>>> ian
>>>
>>> Frédéric Jouault wrote:
>>>> Hi Ian,
>>>>
>>>> I do not think there is such a specific issue in ATL 2006.
>>>> Are you sure this only happens with this version, and not with ATL
>>>> 2004?
>>>>
>>>>
>>>> Do you have this problem with any metamodel, or only with the Ecore
>>>> metametamodel?
>>>> Could you please give your launch configuration?
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Frédéric Jouault
>>>>
>>>>
>>>> Ian Bull wrote:
>>>>> Is there a known issue with helper contexts and ATL 2006?
>>>>>
>>>>> I have the following helper and context:
>>>>>
>>>>> helper context ecore!EObject def: test() : String =
>>>>> 'test';
>>>>>
>>>>>
>>>>> rule Example {
>>>>> from s : ecore!EObject
>>>>> to t : metamodel!Node (
>>>>> name <- s.test()
>>>>> }
>>>>> It matches ecore!EObject fine, but the context doesn't work. I get
>>>>> message: ERROR: could not find operation test on
>>>>> MOF!RelationshipType having supertypes: [OclType, OclAny]
>>>>> (including Java operations)
>>>>>
>>>>> If I don't use the context and use:
>>>>> helper def: test2() : String =
>>>>> 'test2';
>>>>>
>>>>> the name <- thisModule.test2()
>>>>>
>>>>> works fine.
>>>>>
>>>>> cheers,
>>>>> ian
>
>
> ------------------------------------------------------------ ------------
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <launchConfiguration type="org.atl.eclipse.adt.launching.atlTransformation">
> <mapAttribute key="Libs"/>
> <mapAttribute key="Model Handler">
> <mapEntry key="metamodel" value="EMF"/>
> <mapEntry key="My" value=""/>
> <mapEntry key="output" value=""/>
> <mapEntry key="ecore" value="EMF"/>
> </mapAttribute>
> <mapAttribute key="Input">
> <mapEntry key="My" value="ecore"/>
> </mapAttribute>
> <stringAttribute key="Project Name" value="TestATL"/>
> <mapAttribute key="ModelType">
> <mapEntry key="metamodel" value="METAMODELOUTPUT"/>
> <mapEntry key="My" value="MODELINPUT"/>
> <mapEntry key="output" value="MODELOUTPUT"/>
> <mapEntry key="ecore" value="METAMODELINPUT"/>
> </mapAttribute>
> <mapAttribute key="Output">
> <mapEntry key="output" value="metamodel"/>
> </mapAttribute>
> <booleanAttribute key="Mode Debug" value="false"/>
> <booleanAttribute key="AllowInterModelReferences" value="false"/>
> <stringAttribute key="ATL File Name" value="/TestATL/TestTransform.atl"/>
> <mapAttribute key="Path">
> <mapEntry key="metamodel" value="/TestProject/metamodel.ecore"/>
> <mapEntry key="My" value="/TestProject/My.viewshaper"/>
> <mapEntry key="output" value="/TestATL/output.viewshaper"/>
> <mapEntry key="ecore" value="#EMF"/>
> </mapAttribute>
> </launchConfiguration>
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #9234 is a reply to message #9214] |
Thu, 18 January 2007 21:51 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
Hi Frederic,
RelationshipType is in my metamodel. Basically, I am trying to write a
transformation that will take any EMF meta model and transform it to
normalized form that I am using in my PhD. RelationshipType just
happens to be in the model that I am translating today, but tomorrow it
could be a library database.
Because I need it to work on any model, I am writing my transformations
using EObjects instead of the actual types (in this case
RelationshipType). I tried this with EModelElement, but nothing matches.
cheers,
ian
Frédéric Jouault wrote:
> Hello,
>
> Where is RelationshipType defined?
>
> Could you please try to use ecore!EModelElement instead of ecore!EObject
> and report the results?
>
>
> Regards,
>
> Frédéric Jouault
>
>
> Ian Bull wrote:
>> Here is my launch configuration.
>>
>> However, I think the problem may be around SuperTypes and ATL.
>>
>> -- @atlcompiler atl2006
>> module TestTransform; -- Module Template
>> create output : metamodel from My : ecore;
>>
>> helper context ecore!EObject def: getMyString() : String =
>> self.toString();
>>
>> rule Example {
>> from s : ecore!EObject
>> to t : metamodel!Node (
>> name <- s.getMyString()
>> )
>>
>> }
>> This transformation doesn't work:
>> ****** BEGIN Stack Trace
>> message: ERROR: could not find operation getMyString on
>> MOF!RelationshipType having supertypes: [OclType, OclAny] (including
>> Java operations)
>> A.main() : ??#24 null
>> local variables = {self=TestTransform : ASMModule}
>> local stack = []
>> A.__exec__() : ??#8 null
>> local variables = {e=TransientLink {rule = 'Example',
>> sourceElements = {s = My!calls}, targetElements = {t =
>> output!<notnamedyet>}, variables = {}}, self=TestTransform : ASMModule}
>> local stack = []
>> A.__applyExample(1 : NTransientLink;) : ??#12 11:25-11:40
>> local variables = {t=output!<notnamedyet>, s=My!calls,
>> link=TransientLink {rule = 'Example', sourceElements = {s = My!calls},
>> targetElements = {t = output!<notnamedyet>}, variables = {}},
>> self=TestTransform : ASMModule}
>> local stack = [output!<notnamedyet>, output!<notnamedyet>,
>> TestTransform : ASMModule]
>> ****** END Stack Trace
>>
>> But if I change the context to use OclAny it does work. It seems
>> strange that the rule matches the EObject but the helper doesn't.
>>
>> Does it make sense to match EObject?
>>
>> cheers,
>> ian
>>
>>
>> Freddy Allilaire wrote:
>>> Hi Ian,
>>>
>>> You can save a launch configuration by using the tab "Common". You
>>> should choose the option "Shared file". This will create a *.launch
>>> file in the selected folder.
>>>
>>> Regards,
>>> Freddy.
>>>
>>> Ian Bull a écrit :
>>>> that is a good question, I think it worked with 2004, bu I probably
>>>> wasn't doing it on the ecore!EObject.
>>>>
>>>> What is the best way to give you my launch configuration (where are
>>>> they stored)?
>>>>
>>>> cheers,
>>>> ian
>>>>
>>>> Frédéric Jouault wrote:
>>>>> Hi Ian,
>>>>>
>>>>> I do not think there is such a specific issue in ATL 2006.
>>>>> Are you sure this only happens with this version, and not with ATL
>>>>> 2004?
>>>>>
>>>>>
>>>>> Do you have this problem with any metamodel, or only with the Ecore
>>>>> metametamodel?
>>>>> Could you please give your launch configuration?
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Frédéric Jouault
>>>>>
>>>>>
>>>>> Ian Bull wrote:
>>>>>> Is there a known issue with helper contexts and ATL 2006?
>>>>>>
>>>>>> I have the following helper and context:
>>>>>>
>>>>>> helper context ecore!EObject def: test() : String =
>>>>>> 'test';
>>>>>>
>>>>>>
>>>>>> rule Example {
>>>>>> from s : ecore!EObject
>>>>>> to t : metamodel!Node (
>>>>>> name <- s.test()
>>>>>> }
>>>>>> It matches ecore!EObject fine, but the context doesn't work. I get
>>>>>> message: ERROR: could not find operation test on
>>>>>> MOF!RelationshipType having supertypes: [OclType, OclAny]
>>>>>> (including Java operations)
>>>>>>
>>>>>> If I don't use the context and use:
>>>>>> helper def: test2() : String =
>>>>>> 'test2';
>>>>>>
>>>>>> the name <- thisModule.test2()
>>>>>>
>>>>>> works fine.
>>>>>>
>>>>>> cheers,
>>>>>> ian
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>> <launchConfiguration
>> type="org.atl.eclipse.adt.launching.atlTransformation">
>> <mapAttribute key="Libs"/>
>> <mapAttribute key="Model Handler">
>> <mapEntry key="metamodel" value="EMF"/>
>> <mapEntry key="My" value=""/>
>> <mapEntry key="output" value=""/>
>> <mapEntry key="ecore" value="EMF"/>
>> </mapAttribute>
>> <mapAttribute key="Input">
>> <mapEntry key="My" value="ecore"/>
>> </mapAttribute>
>> <stringAttribute key="Project Name" value="TestATL"/>
>> <mapAttribute key="ModelType">
>> <mapEntry key="metamodel" value="METAMODELOUTPUT"/>
>> <mapEntry key="My" value="MODELINPUT"/>
>> <mapEntry key="output" value="MODELOUTPUT"/>
>> <mapEntry key="ecore" value="METAMODELINPUT"/>
>> </mapAttribute>
>> <mapAttribute key="Output">
>> <mapEntry key="output" value="metamodel"/>
>> </mapAttribute>
>> <booleanAttribute key="Mode Debug" value="false"/>
>> <booleanAttribute key="AllowInterModelReferences" value="false"/>
>> <stringAttribute key="ATL File Name" value="/TestATL/TestTransform.atl"/>
>> <mapAttribute key="Path">
>> <mapEntry key="metamodel" value="/TestProject/metamodel.ecore"/>
>> <mapEntry key="My" value="/TestProject/My.viewshaper"/>
>> <mapEntry key="output" value="/TestATL/output.viewshaper"/>
>> <mapEntry key="ecore" value="#EMF"/>
>> </mapAttribute>
>> </launchConfiguration>
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #10209 is a reply to message #9234] |
Thu, 18 January 2007 22:25 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hi Ian,
1. About your transformation scenario
Is /TestProject/My.viewshaper an Ecore metamodel or a terminal model?
According to the header of your transformation (My : ecore) and to your
launch configuration (My->/TestProject/My.viewshaper & ecore->#EMF
(i.e., Ecore)), the file /TestProject/My.viewshaper should contain an
Ecore metamodel.
If /TestProject/My.viewshaper is not an Ecore metamodel then the
transformation cannot run properly because the launch configuration is
erroneous. I would even be surprised if anything was matched at all (see
the reason in the next section).
2. About using Ecore!EObject as a wildcard
Every Java object corresponding to an EMF model element is an instance
of the Java interface org.eclipse.emf.ecore.EObject. However, this does
not mean that you can use Ecore!EObject as a wildcard to match every
model element.
ATL does not let you handle Java objects but model elements. Therefore,
a source pattern typed with Ecore!EObject only matches model elements,
which type explicitly extends the Ecore!EObject metamodel element.
In practice, this means that only elements of Ecore metamodels
(including the Ecore metametamodel itself) are matched.
3. About writing transformations independent of the source metamodel
There are at least two possibilities to design a transformation scenario
that works whatever its source metamodel is:
1- Using reflective access (e.g., .refGetValue(propertyName)) and
imperative mode (because a declarative rule can only match elements of a
precise type).
2- Writing a Hight-Order Transformation (HOT) that generates one
transformation per metamodel. This technique is, for instance, used in
the http://www.eclipse.org/gmt/amw/examples/#UMLProfiles AMW scenario
(see figures 8 and 9 in the pdf documentation and/or the ATL
transformations MM2Profile.atl and Profile2MM.atl provided in the zip file).
Regards,
Frédéric Jouault
Ian Bull wrote:
> Hi Frederic,
>
> RelationshipType is in my metamodel. Basically, I am trying to write a
> transformation that will take any EMF meta model and transform it to
> normalized form that I am using in my PhD. RelationshipType just
> happens to be in the model that I am translating today, but tomorrow it
> could be a library database.
>
> Because I need it to work on any model, I am writing my transformations
> using EObjects instead of the actual types (in this case
> RelationshipType). I tried this with EModelElement, but nothing matches.
>
> cheers,
> ian
>
> Frédéric Jouault wrote:
>> Hello,
>>
>> Where is RelationshipType defined?
>>
>> Could you please try to use ecore!EModelElement instead of
>> ecore!EObject and report the results?
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Ian Bull wrote:
>>> Here is my launch configuration.
>>>
>>> However, I think the problem may be around SuperTypes and ATL.
>>>
>>> -- @atlcompiler atl2006
>>> module TestTransform; -- Module Template
>>> create output : metamodel from My : ecore;
>>>
>>> helper context ecore!EObject def: getMyString() : String =
>>> self.toString();
>>>
>>> rule Example {
>>> from s : ecore!EObject
>>> to t : metamodel!Node (
>>> name <- s.getMyString()
>>> )
>>>
>>> }
>>> This transformation doesn't work:
>>> ****** BEGIN Stack Trace
>>> message: ERROR: could not find operation getMyString on
>>> MOF!RelationshipType having supertypes: [OclType, OclAny] (including
>>> Java operations)
>>> A.main() : ??#24 null
>>> local variables = {self=TestTransform : ASMModule}
>>> local stack = []
>>> A.__exec__() : ??#8 null
>>> local variables = {e=TransientLink {rule = 'Example',
>>> sourceElements = {s = My!calls}, targetElements = {t =
>>> output!<notnamedyet>}, variables = {}}, self=TestTransform : ASMModule}
>>> local stack = []
>>> A.__applyExample(1 : NTransientLink;) : ??#12 11:25-11:40
>>> local variables = {t=output!<notnamedyet>, s=My!calls,
>>> link=TransientLink {rule = 'Example', sourceElements = {s =
>>> My!calls}, targetElements = {t = output!<notnamedyet>}, variables =
>>> {}}, self=TestTransform : ASMModule}
>>> local stack = [output!<notnamedyet>, output!<notnamedyet>,
>>> TestTransform : ASMModule]
>>> ****** END Stack Trace
>>>
>>> But if I change the context to use OclAny it does work. It seems
>>> strange that the rule matches the EObject but the helper doesn't.
>>>
>>> Does it make sense to match EObject?
>>>
>>> cheers,
>>> ian
>>>
>>>
>>> Freddy Allilaire wrote:
>>>> Hi Ian,
>>>>
>>>> You can save a launch configuration by using the tab "Common". You
>>>> should choose the option "Shared file". This will create a *.launch
>>>> file in the selected folder.
>>>>
>>>> Regards,
>>>> Freddy.
>>>>
>>>> Ian Bull a écrit :
>>>>> that is a good question, I think it worked with 2004, bu I probably
>>>>> wasn't doing it on the ecore!EObject.
>>>>>
>>>>> What is the best way to give you my launch configuration (where are
>>>>> they stored)?
>>>>>
>>>>> cheers,
>>>>> ian
>>>>>
>>>>> Frédéric Jouault wrote:
>>>>>> Hi Ian,
>>>>>>
>>>>>> I do not think there is such a specific issue in ATL 2006.
>>>>>> Are you sure this only happens with this version, and not with ATL
>>>>>> 2004?
>>>>>>
>>>>>>
>>>>>> Do you have this problem with any metamodel, or only with the
>>>>>> Ecore metametamodel?
>>>>>> Could you please give your launch configuration?
>>>>>>
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Frédéric Jouault
>>>>>>
>>>>>>
>>>>>> Ian Bull wrote:
>>>>>>> Is there a known issue with helper contexts and ATL 2006?
>>>>>>>
>>>>>>> I have the following helper and context:
>>>>>>>
>>>>>>> helper context ecore!EObject def: test() : String =
>>>>>>> 'test';
>>>>>>>
>>>>>>>
>>>>>>> rule Example {
>>>>>>> from s : ecore!EObject
>>>>>>> to t : metamodel!Node (
>>>>>>> name <- s.test()
>>>>>>> }
>>>>>>> It matches ecore!EObject fine, but the context doesn't work. I
>>>>>>> get message: ERROR: could not find operation test on
>>>>>>> MOF!RelationshipType having supertypes: [OclType, OclAny]
>>>>>>> (including Java operations)
>>>>>>>
>>>>>>> If I don't use the context and use:
>>>>>>> helper def: test2() : String =
>>>>>>> 'test2';
>>>>>>>
>>>>>>> the name <- thisModule.test2()
>>>>>>>
>>>>>>> works fine.
>>>>>>>
>>>>>>> cheers,
>>>>>>> ian
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>>> <launchConfiguration
>>> type="org.atl.eclipse.adt.launching.atlTransformation">
>>> <mapAttribute key="Libs"/>
>>> <mapAttribute key="Model Handler">
>>> <mapEntry key="metamodel" value="EMF"/>
>>> <mapEntry key="My" value=""/>
>>> <mapEntry key="output" value=""/>
>>> <mapEntry key="ecore" value="EMF"/>
>>> </mapAttribute>
>>> <mapAttribute key="Input">
>>> <mapEntry key="My" value="ecore"/>
>>> </mapAttribute>
>>> <stringAttribute key="Project Name" value="TestATL"/>
>>> <mapAttribute key="ModelType">
>>> <mapEntry key="metamodel" value="METAMODELOUTPUT"/>
>>> <mapEntry key="My" value="MODELINPUT"/>
>>> <mapEntry key="output" value="MODELOUTPUT"/>
>>> <mapEntry key="ecore" value="METAMODELINPUT"/>
>>> </mapAttribute>
>>> <mapAttribute key="Output">
>>> <mapEntry key="output" value="metamodel"/>
>>> </mapAttribute>
>>> <booleanAttribute key="Mode Debug" value="false"/>
>>> <booleanAttribute key="AllowInterModelReferences" value="false"/>
>>> <stringAttribute key="ATL File Name"
>>> value="/TestATL/TestTransform.atl"/>
>>> <mapAttribute key="Path">
>>> <mapEntry key="metamodel" value="/TestProject/metamodel.ecore"/>
>>> <mapEntry key="My" value="/TestProject/My.viewshaper"/>
>>> <mapEntry key="output" value="/TestATL/output.viewshaper"/>
>>> <mapEntry key="ecore" value="#EMF"/>
>>> </mapAttribute>
>>> </launchConfiguration>
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #10239 is a reply to message #10209] |
Thu, 18 January 2007 23:02 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
Thanks for the response.
My.viewshaper is a terminal model, and i have changed launch
configuration so my metamodel is the ecore model that viewshaper
conforms to (viewshaper.ecore).
Ok, so I understand that I can't use EObject to match anything, but it
does work. Since this is not really supported I would like to change
this. I am basically using the imperative method (with called rules)
already. I just use the EObject to start the whole thing.
Can I match OclAny? Is there a whildcard that will match any element
without writing a HOT.
Cheers,
ian
Frédéric Jouault wrote:
> Hi Ian,
>
>
> 1. About your transformation scenario
>
> Is /TestProject/My.viewshaper an Ecore metamodel or a terminal model?
>
> According to the header of your transformation (My : ecore) and to your
> launch configuration (My->/TestProject/My.viewshaper & ecore->#EMF
> (i.e., Ecore)), the file /TestProject/My.viewshaper should contain an
> Ecore metamodel.
>
> If /TestProject/My.viewshaper is not an Ecore metamodel then the
> transformation cannot run properly because the launch configuration is
> erroneous. I would even be surprised if anything was matched at all (see
> the reason in the next section).
>
>
> 2. About using Ecore!EObject as a wildcard
>
> Every Java object corresponding to an EMF model element is an instance
> of the Java interface org.eclipse.emf.ecore.EObject. However, this does
> not mean that you can use Ecore!EObject as a wildcard to match every
> model element.
>
> ATL does not let you handle Java objects but model elements. Therefore,
> a source pattern typed with Ecore!EObject only matches model elements,
> which type explicitly extends the Ecore!EObject metamodel element.
>
> In practice, this means that only elements of Ecore metamodels
> (including the Ecore metametamodel itself) are matched.
>
>
> 3. About writing transformations independent of the source metamodel
>
> There are at least two possibilities to design a transformation scenario
> that works whatever its source metamodel is:
>
> 1- Using reflective access (e.g., .refGetValue(propertyName)) and
> imperative mode (because a declarative rule can only match elements of a
> precise type).
>
> 2- Writing a Hight-Order Transformation (HOT) that generates one
> transformation per metamodel. This technique is, for instance, used in
> the http://www.eclipse.org/gmt/amw/examples/#UMLProfiles AMW scenario
> (see figures 8 and 9 in the pdf documentation and/or the ATL
> transformations MM2Profile.atl and Profile2MM.atl provided in the zip
> file).
>
>
>
> Regards,
>
> Frédéric Jouault
>
>
> Ian Bull wrote:
>> Hi Frederic,
>>
>> RelationshipType is in my metamodel. Basically, I am trying to write a
>> transformation that will take any EMF meta model and transform it to
>> normalized form that I am using in my PhD. RelationshipType just
>> happens to be in the model that I am translating today, but tomorrow
>> it could be a library database.
>>
>> Because I need it to work on any model, I am writing my
>> transformations using EObjects instead of the actual types (in this
>> case RelationshipType). I tried this with EModelElement, but nothing
>> matches.
>>
>> cheers,
>> ian
>>
>> Frédéric Jouault wrote:
>>> Hello,
>>>
>>> Where is RelationshipType defined?
>>>
>>> Could you please try to use ecore!EModelElement instead of
>>> ecore!EObject and report the results?
>>>
>>>
>>> Regards,
>>>
>>> Frédéric Jouault
>>>
>>>
>>> Ian Bull wrote:
>>>> Here is my launch configuration.
>>>>
>>>> However, I think the problem may be around SuperTypes and ATL.
>>>>
>>>> -- @atlcompiler atl2006
>>>> module TestTransform; -- Module Template
>>>> create output : metamodel from My : ecore;
>>>>
>>>> helper context ecore!EObject def: getMyString() : String =
>>>> self.toString();
>>>>
>>>> rule Example {
>>>> from s : ecore!EObject
>>>> to t : metamodel!Node (
>>>> name <- s.getMyString()
>>>> )
>>>>
>>>> }
>>>> This transformation doesn't work:
>>>> ****** BEGIN Stack Trace
>>>> message: ERROR: could not find operation getMyString on
>>>> MOF!RelationshipType having supertypes: [OclType, OclAny] (including
>>>> Java operations)
>>>> A.main() : ??#24 null
>>>> local variables = {self=TestTransform : ASMModule}
>>>> local stack = []
>>>> A.__exec__() : ??#8 null
>>>> local variables = {e=TransientLink {rule = 'Example',
>>>> sourceElements = {s = My!calls}, targetElements = {t =
>>>> output!<notnamedyet>}, variables = {}}, self=TestTransform : ASMModule}
>>>> local stack = []
>>>> A.__applyExample(1 : NTransientLink;) : ??#12 11:25-11:40
>>>> local variables = {t=output!<notnamedyet>, s=My!calls,
>>>> link=TransientLink {rule = 'Example', sourceElements = {s =
>>>> My!calls}, targetElements = {t = output!<notnamedyet>}, variables =
>>>> {}}, self=TestTransform : ASMModule}
>>>> local stack = [output!<notnamedyet>, output!<notnamedyet>,
>>>> TestTransform : ASMModule]
>>>> ****** END Stack Trace
>>>>
>>>> But if I change the context to use OclAny it does work. It seems
>>>> strange that the rule matches the EObject but the helper doesn't.
>>>>
>>>> Does it make sense to match EObject?
>>>>
>>>> cheers,
>>>> ian
>>>>
>>>>
>>>> Freddy Allilaire wrote:
>>>>> Hi Ian,
>>>>>
>>>>> You can save a launch configuration by using the tab "Common". You
>>>>> should choose the option "Shared file". This will create a *.launch
>>>>> file in the selected folder.
>>>>>
>>>>> Regards,
>>>>> Freddy.
>>>>>
>>>>> Ian Bull a écrit :
>>>>>> that is a good question, I think it worked with 2004, bu I
>>>>>> probably wasn't doing it on the ecore!EObject.
>>>>>>
>>>>>> What is the best way to give you my launch configuration (where
>>>>>> are they stored)?
>>>>>>
>>>>>> cheers,
>>>>>> ian
>>>>>>
>>>>>> Frédéric Jouault wrote:
>>>>>>> Hi Ian,
>>>>>>>
>>>>>>> I do not think there is such a specific issue in ATL 2006.
>>>>>>> Are you sure this only happens with this version, and not with
>>>>>>> ATL 2004?
>>>>>>>
>>>>>>>
>>>>>>> Do you have this problem with any metamodel, or only with the
>>>>>>> Ecore metametamodel?
>>>>>>> Could you please give your launch configuration?
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Frédéric Jouault
>>>>>>>
>>>>>>>
>>>>>>> Ian Bull wrote:
>>>>>>>> Is there a known issue with helper contexts and ATL 2006?
>>>>>>>>
>>>>>>>> I have the following helper and context:
>>>>>>>>
>>>>>>>> helper context ecore!EObject def: test() : String =
>>>>>>>> 'test';
>>>>>>>>
>>>>>>>>
>>>>>>>> rule Example {
>>>>>>>> from s : ecore!EObject
>>>>>>>> to t : metamodel!Node (
>>>>>>>> name <- s.test()
>>>>>>>> }
>>>>>>>> It matches ecore!EObject fine, but the context doesn't work. I
>>>>>>>> get message: ERROR: could not find operation test on
>>>>>>>> MOF!RelationshipType having supertypes: [OclType, OclAny]
>>>>>>>> (including Java operations)
>>>>>>>>
>>>>>>>> If I don't use the context and use:
>>>>>>>> helper def: test2() : String =
>>>>>>>> 'test2';
>>>>>>>>
>>>>>>>> the name <- thisModule.test2()
>>>>>>>>
>>>>>>>> works fine.
>>>>>>>>
>>>>>>>> cheers,
>>>>>>>> ian
>>>>
>>>>
>>>> ------------------------------------------------------------ ------------
>>>>
>>>>
>>>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>>>> <launchConfiguration
>>>> type="org.atl.eclipse.adt.launching.atlTransformation">
>>>> <mapAttribute key="Libs"/>
>>>> <mapAttribute key="Model Handler">
>>>> <mapEntry key="metamodel" value="EMF"/>
>>>> <mapEntry key="My" value=""/>
>>>> <mapEntry key="output" value=""/>
>>>> <mapEntry key="ecore" value="EMF"/>
>>>> </mapAttribute>
>>>> <mapAttribute key="Input">
>>>> <mapEntry key="My" value="ecore"/>
>>>> </mapAttribute>
>>>> <stringAttribute key="Project Name" value="TestATL"/>
>>>> <mapAttribute key="ModelType">
>>>> <mapEntry key="metamodel" value="METAMODELOUTPUT"/>
>>>> <mapEntry key="My" value="MODELINPUT"/>
>>>> <mapEntry key="output" value="MODELOUTPUT"/>
>>>> <mapEntry key="ecore" value="METAMODELINPUT"/>
>>>> </mapAttribute>
>>>> <mapAttribute key="Output">
>>>> <mapEntry key="output" value="metamodel"/>
>>>> </mapAttribute>
>>>> <booleanAttribute key="Mode Debug" value="false"/>
>>>> <booleanAttribute key="AllowInterModelReferences" value="false"/>
>>>> <stringAttribute key="ATL File Name"
>>>> value="/TestATL/TestTransform.atl"/>
>>>> <mapAttribute key="Path">
>>>> <mapEntry key="metamodel" value="/TestProject/metamodel.ecore"/>
>>>> <mapEntry key="My" value="/TestProject/My.viewshaper"/>
>>>> <mapEntry key="output" value="/TestATL/output.viewshaper"/>
>>>> <mapEntry key="ecore" value="#EMF"/>
>>>> </mapAttribute>
>>>> </launchConfiguration>
|
|
| |
Re: [ATL] Problems with Contexts and ATL 2006 [message #10338 is a reply to message #10272] |
Fri, 19 January 2007 01:10 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
This is a multi-part message in MIME format.
--------------050205050800090402070206
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
I will try your solution,
In the mean time, this is an example that matches everything. I am using
the same MM for input and output (but I have tried it with other models
too).
cheers,
ian
Fr
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #10370 is a reply to message #10272] |
Fri, 19 January 2007 01:31 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
Also,
Did you literally mean "%EMF" because I get an error that says:
****** BEGIN Stack Trace
message: cannot find model %EMF
I searched the source code for the String %EMF (It is probably
recognized somewhere and it wasn't found.
Maybe I have the wrong version. I just checked out the plugins from the
gmt.atl project and added the missing libs (to engine).
cheers,
Ian
Frédéric Jouault wrote:
> Hello,
>
>> My.viewshaper is a terminal model, and i have changed launch
>> configuration so my metamodel is the ecore model that viewshaper
>> conforms to (viewshaper.ecore).
>
> Ok. You should now have a correct launch configuration.
>
>> Ok, so I understand that I can't use EObject to match anything, but it
>> does work. Since this is not really supported I would like to change
>> this. I am basically using the imperative method (with called rules)
>> already. I just use the EObject to start the whole thing.
>
> I did not manage to reproduce this matching of "everything" with
> EObject. Could you please give us a copy of your project (or of a
> simplified version) exhibiting this behavior?
>
>> Can I match OclAny? Is there a whildcard that will match any element
>> without writing a HOT.
>
> No, you cannot match OclAny. There is no wildcard that you can match.
> Here is one possible solution:
>
> module TestTransform;
> create OUT : OUTMM from IN : INMM;
>
> entrypoint rule Main() {
> do {
> for(e in
> -- get all EClasses from INMM (%EMF stands for Ecore when
> -- it is not explicitly referenced from the header)
> "%EMF"!EClass.allInstancesFrom('INMM')->collect(e |
> -- get all elements from IN typed by each EClass of INMM
> e.allInstancesFrom('IN')
> )->flatten()) {
> thisModule.TransformOneElement(e);
> }
> }
> }
>
> rule TransformOneElement(e : OclAny) {
> -- do something for each element of model IN
> }
>
>
>
> Regards,
>
> Frédéric Jouault
|
|
| |
Re: [ATL] Problems with Contexts and ATL 2006 [message #10435 is a reply to message #10402] |
Fri, 19 January 2007 02:11 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
Nope, I have version 1.10 which is from head. I noticed that you have
1.5.2.16 (this has the fix in it). Is this a separate branch?
Cheers,
Ian
Frédéric Jouault wrote:
> Hello,
>
>> Did you literally mean "%EMF" because I get an error that says:
>> ****** BEGIN Stack Trace
>> message: cannot find model %EMF
>>
>> I searched the source code for the String %EMF (It is probably
>> recognized somewhere and it wasn't found.
>
> Yes, I literally mean "%EMF".
>
> Here is the code that loads models in plugin org.atl.eclipse.adt.debug,
> class org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate , line
> 317:
> toReturn.put("%" + modelHandler.get(mmName), mofmm);
>
> It registers the metametamodel of the model handler used to load the
> model under the name "%" + name of model handler.
> Therefore "%EMF" corresponds to the Ecore metametamodel when you load at
> least one model with EMF.
> This scheme enables the use of several model handlers in a single
> transformation.
>
>
>> Maybe I have the wrong version. I just checked out the plugins from
>> the gmt.atl project and added the missing libs (to engine).
>
> Can you please check if you have the code mentionned above?
> If not, then you might need to upgrade.
>
>
> Regards,
>
> Frédéric Jouault
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #10466 is a reply to message #10435] |
Fri, 19 January 2007 04:08 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
The Eclipse debug API changes from version to version. In order to cope
with these changes, a new branch of the org.atl.eclipse.adt.debug plugin
was started for Eclipse 3.1: ADTDebugForEclipse3_1.
If you are using a version of Eclipse older than 3.0, then you should
check out this branch. The way to do this is documented in the "ATL
installation guide" section 3.2.2, page 8:
http://www.eclipse.org/m2m/atl/doc/ATL_Installation_Guide%5B v0.1%5D.pdf
Best regards,
Frédéric Jouault
Ian Bull wrote:
> Nope, I have version 1.10 which is from head. I noticed that you have
> 1.5.2.16 (this has the fix in it). Is this a separate branch?
>
> Cheers,
> Ian
>
> Frédéric Jouault wrote:
>> Hello,
>>
>>> Did you literally mean "%EMF" because I get an error that says:
>>> ****** BEGIN Stack Trace
>>> message: cannot find model %EMF
>>>
>>> I searched the source code for the String %EMF (It is probably
>>> recognized somewhere and it wasn't found.
>>
>> Yes, I literally mean "%EMF".
>>
>> Here is the code that loads models in plugin
>> org.atl.eclipse.adt.debug, class
>> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate , line 317:
>> toReturn.put("%" + modelHandler.get(mmName), mofmm);
>>
>> It registers the metametamodel of the model handler used to load the
>> model under the name "%" + name of model handler.
>> Therefore "%EMF" corresponds to the Ecore metametamodel when you load
>> at least one model with EMF.
>> This scheme enables the use of several model handlers in a single
>> transformation.
>>
>>
>>> Maybe I have the wrong version. I just checked out the plugins from
>>> the gmt.atl project and added the missing libs (to engine).
>>
>> Can you please check if you have the code mentionned above?
>> If not, then you might need to upgrade.
>>
>>
>> Regards,
>>
>> Frédéric Jouault
|
|
|
Re: [ATL] Problems with Contexts and ATL 2006 [message #10498 is a reply to message #10466] |
Fri, 19 January 2007 04:20 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
Frederic,
I am using 3.3M4, I will try the 3.1 branch with this version.
thanks again for all your help, you must be up late! (or else you are
traveling).
cheers,
ian
Frédéric Jouault wrote:
> Hello,
>
> The Eclipse debug API changes from version to version. In order to cope
> with these changes, a new branch of the org.atl.eclipse.adt.debug plugin
> was started for Eclipse 3.1: ADTDebugForEclipse3_1.
>
> If you are using a version of Eclipse older than 3.0, then you should
> check out this branch. The way to do this is documented in the "ATL
> installation guide" section 3.2.2, page 8:
> http://www.eclipse.org/m2m/atl/doc/ATL_Installation_Guide%5B v0.1%5D.pdf
>
>
> Best regards,
>
> Frédéric Jouault
>
>
> Ian Bull wrote:
>> Nope, I have version 1.10 which is from head. I noticed that you have
>> 1.5.2.16 (this has the fix in it). Is this a separate branch?
>>
>> Cheers,
>> Ian
>>
>> Frédéric Jouault wrote:
>>> Hello,
>>>
>>>> Did you literally mean "%EMF" because I get an error that says:
>>>> ****** BEGIN Stack Trace
>>>> message: cannot find model %EMF
>>>>
>>>> I searched the source code for the String %EMF (It is probably
>>>> recognized somewhere and it wasn't found.
>>>
>>> Yes, I literally mean "%EMF".
>>>
>>> Here is the code that loads models in plugin
>>> org.atl.eclipse.adt.debug, class
>>> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate , line 317:
>>> toReturn.put("%" + modelHandler.get(mmName), mofmm);
>>>
>>> It registers the metametamodel of the model handler used to load the
>>> model under the name "%" + name of model handler.
>>> Therefore "%EMF" corresponds to the Ecore metametamodel when you load
>>> at least one model with EMF.
>>> This scheme enables the use of several model handlers in a single
>>> transformation.
>>>
>>>
>>>> Maybe I have the wrong version. I just checked out the plugins from
>>>> the gmt.atl project and added the missing libs (to engine).
>>>
>>> Can you please check if you have the code mentionned above?
>>> If not, then you might need to upgrade.
>>>
>>>
>>> Regards,
>>>
>>> Frédéric Jouault
|
|
|
Goto Forum:
Current Time: Fri Dec 27 09:14:29 GMT 2024
Powered by FUDForum. Page generated in 0.04889 seconds
|