Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] [newbie] acces to enumeration
[ATL] [newbie] acces to enumeration [message #32601] Thu, 19 April 2007 07:56 Go to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

Hi
I am new with ATL and i have to do model transformation from UML2 (Class /
statemachine) to IF (verification language)

I've made my metamodel IF and i have an ecore file and i don't have any
problem for some transformations but ....

i've defined an enumeration type in my ecore
<eClassifiers xsi:type="ecore:EEnum" name="ParametersMode">
<eLiterals name="null"/>
<eLiterals name="out" value="1"/>
<eLiterals name="inout" value="2"/>
<eLiterals name="in" value="3"/>
</eClassifiers>

and I don't know how to access to it from ATL rule
rule Property2Variables {
from
p : UML!Property
to
v : _IF!Vars (
name <- p.name,
mode <- ? ? ? ,
type <- p.getType()

)
}
at the launching I have a problem when i try to insert the mode because he
needs a parametersMode (my enum)

Thank you
Re: [ATL] [newbie] acces to enumeration [message #32635 is a reply to message #32601] Thu, 19 April 2007 08:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Hugo.Bruneliere.univ-nantes.fr

Hi Tristan,

Tristan FAURE wrote:
> Hi
> I am new with ATL and i have to do model transformation from UML2 (Class
> / statemachine) to IF (verification language)
>
> I've made my metamodel IF and i have an ecore file and i don't have any
> problem for some transformations but ....
>
> i've defined an enumeration type in my ecore
> <eClassifiers xsi:type="ecore:EEnum" name="ParametersMode">
> <eLiterals name="null"/>
> <eLiterals name="out" value="1"/>
> <eLiterals name="inout" value="2"/>
> <eLiterals name="in" value="3"/>
> </eClassifiers>
>
> and I don't know how to access to it from ATL rule
> rule Property2Variables {
> from p : UML!Property to
> v : _IF!Vars (
> name <- p.name,
> mode <- ? ? ? ,
> type <- p.getType()
>
> )
> }
> at the launching I have a problem when i try to insert the mode because
> he needs a parametersMode (my enum)
>
> Thank you

To set the value of the "mode" attribute (which is of an enumeration
type)you can write: "mode <- #null", "mode <- #out", etc

The way we often use is to define an helper that returns the right value
corresponding to a given parameter. Here is an example of such an helper
(the context and the parameter(s) may vary):

helper def: getParametersMode(p : String) : IF!ParametersMode =
if (p = ??) then
#null
else
if (p = ??) then
#out
else
...
endif;

Then you can call this helper in the matched rule:
"mode <- thisModule.getParametersNode(p.??),"


Best regards,

Hugo

--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
Re: [ATL] [newbie] acces to enumeration [message #32670 is a reply to message #32635] Thu, 19 April 2007 08:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

Hugo Bruneliere wrote:

> Hi Tristan,

> Tristan FAURE wrote:
>> Hi
>> I am new with ATL and i have to do model transformation from UML2 (Class
>> / statemachine) to IF (verification language)
>>
>> I've made my metamodel IF and i have an ecore file and i don't have any
>> problem for some transformations but ....
>>
>> i've defined an enumeration type in my ecore
>> <eClassifiers xsi:type="ecore:EEnum" name="ParametersMode">
>> <eLiterals name="null"/>
>> <eLiterals name="out" value="1"/>
>> <eLiterals name="inout" value="2"/>
>> <eLiterals name="in" value="3"/>
>> </eClassifiers>
>>
>> and I don't know how to access to it from ATL rule
>> rule Property2Variables {
>> from p : UML!Property to
>> v : _IF!Vars (
>> name <- p.name,
>> mode <- ? ? ? ,
>> type <- p.getType()
>>
>> )
>> }
>> at the launching I have a problem when i try to insert the mode because
>> he needs a parametersMode (my enum)
>>
>> Thank you

> To set the value of the "mode" attribute (which is of an enumeration
> type)you can write: "mode <- #null", "mode <- #out", etc

> The way we often use is to define an helper that returns the right value
> corresponding to a given parameter. Here is an example of such an helper
> (the context and the parameter(s) may vary):

> helper def: getParametersMode(p : String) : IF!ParametersMode =
> if (p = ??) then
> #null
> else
> if (p = ??) then
> #out
> else
> ...
> endif;

> Then you can call this helper in the matched rule:
> "mode <- thisModule.getParametersNode(p.??),"


> Best regards,

> Hugo

Thank you for your answer assigning the value with a sharp was what i
understanded from the documentation but when I insert #null or when I use
the helper you provide to me I have this launching error

java.lang.IllegalArgumentException: The value '' is not a valid enumerator
of 'ParametersMode'
at
org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:269)
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getDefault Value(EStructuralFeatureImpl.java:129)
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSetting Delegate(EStructuralFeatureImpl.java:780)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate (BasicEObjectImpl.java:1115)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:833)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1114)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2548)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1043)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:929)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2268)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1397)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2548)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1043)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:929)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2268)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1397)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2548)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:617)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:549)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:233)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:203)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1008)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:896)
at
org.atl.eclipse.engine.AtlEMFModelHandler.saveModel(AtlEMFMo delHandler.java:79)
at
org.atl.eclipse.engine.AtlEMFModelHandler.saveModel(AtlEMFMo delHandler.java:43)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:241)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:168)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:145)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:121)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .launch(AtlLaunchConfigurationDelegate.java:97)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:710)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:603)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:754)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlu gin.java:944)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Re: [ATL] [newbie] acces to enumeration [message #32705 is a reply to message #32670] Thu, 19 April 2007 09:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Hugo.Bruneliere.univ-nantes.fr

It seems that the transformation works but that the problem comes when
the produced model is saved (i.e. serialized).

Could you send the helper you use and the rule in which you call it?
Have you got other error messages from the console (I mean ATL ones)?


Tristan FAURE a écrit :
> Hugo Bruneliere wrote:
>
>> Hi Tristan,
>
>> Tristan FAURE wrote:
>>> Hi
>>> I am new with ATL and i have to do model transformation from UML2
>>> (Class / statemachine) to IF (verification language)
>>>
>>> I've made my metamodel IF and i have an ecore file and i don't have
>>> any problem for some transformations but ....
>>>
>>> i've defined an enumeration type in my ecore
>>> <eClassifiers xsi:type="ecore:EEnum" name="ParametersMode">
>>> <eLiterals name="null"/>
>>> <eLiterals name="out" value="1"/>
>>> <eLiterals name="inout" value="2"/>
>>> <eLiterals name="in" value="3"/>
>>> </eClassifiers>
>>>
>>> and I don't know how to access to it from ATL rule
>>> rule Property2Variables {
>>> from p : UML!Property to
>>> v : _IF!Vars (
>>> name <- p.name,
>>> mode <- ? ? ? ,
>>> type <- p.getType()
>>> )
>>> }
>>> at the launching I have a problem when i try to insert the mode
>>> because he needs a parametersMode (my enum)
>>>
>>> Thank you
>
>> To set the value of the "mode" attribute (which is of an enumeration
>> type)you can write: "mode <- #null", "mode <- #out", etc
>
>> The way we often use is to define an helper that returns the right
>> value corresponding to a given parameter. Here is an example of such
>> an helper (the context and the parameter(s) may vary):
>
>> helper def: getParametersMode(p : String) : IF!ParametersMode =
>> if (p = ??) then
>> #null
>> else
>> if (p = ??) then
>> #out
>> else
>> ...
>> endif;
>
>> Then you can call this helper in the matched rule:
>> "mode <- thisModule.getParametersNode(p.??),"
>
>
>> Best regards,
>
>> Hugo
>
> Thank you for your answer assigning the value with a sharp was what i
> understanded from the documentation but when I insert #null or when I
> use the helper you provide to me I have this launching error
>
> java.lang.IllegalArgumentException: The value '' is not a valid
> enumerator of 'ParametersMode'
> at
> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:269)
>
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getDefault Value(EStructuralFeatureImpl.java:129)
>
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSetting Delegate(EStructuralFeatureImpl.java:780)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate (BasicEObjectImpl.java:1115)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:833)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1114)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2548)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1043)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:929)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2268)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1397)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2548)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1043)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:929)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2268)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1397)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2548)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:617)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:549)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:233)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:203)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1008)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:896)
>
> at
> org.atl.eclipse.engine.AtlEMFModelHandler.saveModel(AtlEMFMo delHandler.java:79)
>
> at
> org.atl.eclipse.engine.AtlEMFModelHandler.saveModel(AtlEMFMo delHandler.java:43)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:241)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:168)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:145)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:121)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .launch(AtlLaunchConfigurationDelegate.java:97)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:710)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:603)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:754)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlu gin.java:944)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
>
>


--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
Re: [ATL] [newbie] acces to enumeration [message #32738 is a reply to message #32705] Thu, 19 April 2007 09:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

First i'm sorry because i'm using the web interface of the newsgroup and i
don't know if it is possible to join files so i will copy code here (if
you know a newsgroup software which works with proxy :/)

I'm also sorry the error was not the good there is no launching error but
there is this trace in the console :

============================================================ ===

****** BEGIN Stack Trace
message: cannot set feature _IF!Vars.mode to value null
exception:
java.lang.IllegalArgumentException: The value '' is not a valid enumerator
of 'ParametersMode'
at
org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:269)
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getDefault Value(EStructuralFeatureImpl.java:129)
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSetting Delegate(EStructuralFeatureImpl.java:780)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate (BasicEObjectImpl.java:1115)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:709)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:683)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:654)
at
org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:226)
at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:27 6)
at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 60)
at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 50)
at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:21 4)
at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:30 9)
at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 60)
at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 50)
at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:21 4)
at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
at org.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:276)
at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:1 36)
at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:9 4)
at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:6 8)
at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:6 4)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:230)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:168)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:145)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:121)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .launch(AtlLaunchConfigurationDelegate.java:97)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:710)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:603)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:754)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlu gin.java:944)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
A.main() : ??#24 null
local variables = {self=uml2if : ASMModule}
local stack = []
A.__exec__() : ??#38 null
local variables = {e=TransientLink {rule = 'Property2Variables',
sourceElements = {p = IN!cursor}, targetElements = {v = OUT!cursor},
variables = {}}, self=uml2if : ASMModule}
local stack = []
A.__applyProperty2Variables(1 : NTransientLink;) : ??#21 75:25-75:69
local variables = {v=OUT!cursor, p=IN!cursor, link=TransientLink {rule =
'Property2Variables', sourceElements = {p = IN!cursor}, targetElements =
{v = OUT!cursor}, variables = {}}, self=uml2if : ASMModule}
local stack = [OUT!cursor]
****** END Stack Trace
Execution terminated due to error (see launch configuration to allow
continuation after errors).

============================================================ ===

So this is my module it's just a prototype so it's not very big

============================================================ ===
module uml2if; -- Module Template
create OUT:_IF from IN:UML ;

-- getting the enum value from a string
helper def: getParametersMode(p : String) : IF!ParametersMode =
if (p = 'null') then
#null
else
if (p = 'out') then
#out
else
#null
endif
endif
;

helper context UML!Property def : getType() : String =
(
if (self.type = 'Integer') then
'integer'
else
'integer1'
endif
) ;

helper context UML!Package def : getProcesses() : Set(UML!Class) =
(
self.ownedMember->select(a|a.oclIsTypeOf(UML!Class))

);

rule Package2System {
from
p : UML!Package (p.oclIsTypeOf(UML!Package))
to
s : _IF!System (
id <- p.name,
process <- p.getProcesses()
)
}

rule Class2Process {
from
c : UML!Class (c.oclIsTypeOf(UML!Class))
to
s : _IF!Process (
id <- c.name ,
nbInstancesToStart <- '1',
vars
)
}

rule Vertex2State {
from
v : UML!Vertex (v.oclIsTypeOf(UML!Vertex))
to
s : _IF!State (
id <- v.name
)
}

rule Property2Variables {
from
p : UML!Property
to
v : _IF!Vars (
name <- p.name,
mode <- thisModule.getParametersNode('null') ,
type <- p.getType()

)
}
Re: [ATL] [newbie] acces to enumeration [message #32763 is a reply to message #32738] Thu, 19 April 2007 09:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Hugo.Bruneliere.univ-nantes.fr

Tristan FAURE a écrit :
> First i'm sorry because i'm using the web interface of the newsgroup and
> i don't know if it is possible to join files so i will copy code here
> (if you know a newsgroup software which works with proxy :/)
>
> I'm also sorry the error was not the good there is no launching error
> but there is this trace in the console :
>
> ============================================================ ===
>
> ****** BEGIN Stack Trace
> message: cannot set feature _IF!Vars.mode to value null
> exception: java.lang.IllegalArgumentException: The value '' is not a
> valid enumerator of 'ParametersMode'
> at
> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:269)
>
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getDefault Value(EStructuralFeatureImpl.java:129)
>
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSetting Delegate(EStructuralFeatureImpl.java:780)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate (BasicEObjectImpl.java:1115)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:709)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:683)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:654)
> at
> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:226)
>
> at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:27 6)
> at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
> at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 60)
> at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 50)
> at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:21 4)
> at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:30 9)
> at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
> at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 60)
> at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 50)
> at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:21 4)
> at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
> at org.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:276)
> at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:1 36)
> at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:9 4)
> at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:6 8)
> at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:6 4)
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:230)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:168)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:145)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:121)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .launch(AtlLaunchConfigurationDelegate.java:97)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:710)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:603)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:754)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlu gin.java:944)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
> A.main() : ??#24 null
> local variables = {self=uml2if : ASMModule}
> local stack = []
> A.__exec__() : ??#38 null
> local variables = {e=TransientLink {rule = 'Property2Variables',
> sourceElements = {p = IN!cursor}, targetElements = {v = OUT!cursor},
> variables = {}}, self=uml2if : ASMModule}
> local stack = []
> A.__applyProperty2Variables(1 : NTransientLink;) : ??#21 75:25-75:69
> local variables = {v=OUT!cursor, p=IN!cursor, link=TransientLink
> {rule = 'Property2Variables', sourceElements = {p = IN!cursor},
> targetElements = {v = OUT!cursor}, variables = {}}, self=uml2if :
> ASMModule}
> local stack = [OUT!cursor]
> ****** END Stack Trace
> Execution terminated due to error (see launch configuration to allow
> continuation after errors).
>
> ============================================================ ===
>
> So this is my module it's just a prototype so it's not very big
>
> ============================================================ ===
> module uml2if; -- Module Template
> create OUT:_IF from IN:UML ;
>
> -- getting the enum value from a string
> helper def: getParametersMode(p : String) : IF!ParametersMode =
> if (p = 'null') then
> #null
> else
> if (p = 'out') then
> #out
> else
> #null
> endif
> endif
> ;
>
> helper context UML!Property def : getType() : String =
> (
> if (self.type = 'Integer') then
> 'integer'
> else
> 'integer1'
> endif
> ) ;
>
> helper context UML!Package def : getProcesses() : Set(UML!Class) = (
> self.ownedMember->select(a|a.oclIsTypeOf(UML!Class))
>
> );
>
> rule Package2System {
> from
> p : UML!Package (p.oclIsTypeOf(UML!Package))
> to
> s : _IF!System (
> id <- p.name,
> process <- p.getProcesses()
> )
> }
>
> rule Class2Process {
> from
> c : UML!Class (c.oclIsTypeOf(UML!Class))
> to
> s : _IF!Process (
> id <- c.name ,
> nbInstancesToStart <- '1',
> vars
> )
> }
>
> rule Vertex2State {
> from v : UML!Vertex (v.oclIsTypeOf(UML!Vertex))
> to s : _IF!State (
> id <- v.name
> )
> }
>
> rule Property2Variables {
> from p : UML!Property to
> v : _IF!Vars (
> name <- p.name,
> mode <- thisModule.getParametersNode('null') ,
> type <- p.getType()
>
> )
> }
>

Is the IF!Vars.mode attribute of type IF!ParametersMode in your IF
metamodel?

--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
Re: [ATL] [newbie] acces to enumeration [message #32778 is a reply to message #32763] Thu, 19 April 2007 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

yes

this my declaration in my if.ecore (generated by topcased)

<eClassifiers xsi:type="ecore:EClass" name="Vars">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="mode"
lowerBound="1" eType="#//ParametersMode"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
Re: [ATL] [newbie] acces to enumeration [message #32842 is a reply to message #32778] Thu, 19 April 2007 12:08 Go to previous message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

I think I have a probleme with my meta model because I've just used
another enum and it's ok so I will check and notify if it still not work
Previous Topic:Comparative study between ATL and ETL
Next Topic:[ATL Plugin] Autocompletion doesn't work
Goto Forum:
  


Current Time: Fri Apr 26 09:29:02 GMT 2024

Powered by FUDForum. Page generated in 0.03208 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top