Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Working with Dates
Working with Dates [message #61315] Mon, 10 September 2007 01:05 Go to next message
Eclipse UserFriend
Originally posted by: jconlon.apache.org

Hi,

I'm a ATL newbee still trying to come up to speed. Having problems with
models that contain java.util.Date attributes.

To simplify and reproduce the problem, I modified the Author2Person
examples to include an Author birthDate attribute and a Person birthday
attribute. (By Adding each attribute as a EDate EType in the
Author.ecore and Person.ecore metamodels.)

After those metamodel changes I was able to use the Sample ECore Model
Editor to edit the authors.ecore model and add the values to the
birthDate attributes.

My authors.ecore model now looks like this...
---------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns="Author">
<Author name="David" surname="Touzet"
birthDate="2000-11-11T00:00:00.000-0600"/>
<Author name="Freddy" surname="Allilaire"
birthDate="2001-08-22T01:00:00.000-0500"/>
</xmi:XMI>
----------------------------------------------



Here is my modified Author2Person.atl ...
--------------------------------------------
module Author2Person; -- Module Template
create OUT : Person from IN : Author;

rule Author {
from
a: Author!Author

to
p: Person!Person (
name <- a.name,
surname <- a.surname,
birthday <- a.birthDate
)
}
---------------------------------------------




When I run the atl I get the following console errors:

SEVERE: ****** BEGIN Stack Trace
SEVERE: message: ERROR: cannot convert Sat Nov 11 00:00:00 CST 2000 :
class java.util.Date from EMF.
SEVERE: A.main() : ??#24 null
SEVERE: local variables = {self=Author2Person : ASMModule}
SEVERE: local stack = []
SEVERE: A.__exec__() : ??#8 null
SEVERE: local variables = {self=Author2Person : ASMModule,
e=TransientLink {rule = 'Author', sourceElements = {a = IN!David},
targetElements = {p = OUT!David}, variables = {}}}
SEVERE: local stack = []
SEVERE: A.__applyAuthor(1 : NTransientLink;) : ??#24 12:20-12:31
SEVERE: local variables = {p=OUT!David, a=IN!David, self=Author2Person
: ASMModule, link=TransientLink {rule = 'Author', sourceElements = {a =
IN!David}, targetElements = {p = OUT!David}, variables = {}}}
SEVERE: local stack = [OUT!David, OUT!David, Author2Person : ASMModule]
SEVERE: ****** END Stack Trace
INFO: Execution terminated due to error (see launch configuration to
allow continuation after errors).
SEVERE: ERROR: cannot convert Sat Nov 11 00:00:00 CST 2000 : class
java.util.Date from EMF.
java.lang.RuntimeException: ERROR: cannot convert Sat Nov 11 00:00:00
CST 2000 : class java.util.Date from EMF.
at
org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:185)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:81)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.emf2A SM(ASMEMFModelElement.java:186)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.get(A SMEMFModelElement.java:134)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:288)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:155)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

------------------------------------------------------------ ----------------


Any one have any ideas as to what I am doing wrong and/or what is the
proper approach when working with Date dataTypes.

thanks for any help?
John Conlon
[ATL] Re: Working with Dates [message #61367 is a reply to message #61315] Mon, 10 September 2007 08:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Hi John,

First, could you please try to stick with this newsgroup rules and
prefix all of your messages about ATL with an [ATL] prefix. The reason
is explained there http://wiki.eclipse.org/M2M. Thanks in advance.

Concerning your question, the fact is that ATL does not support Date
primitive type (or any other "Java" primitive types wrapped by EMF other
than the ones detailed there
http://wiki.eclipse.org/ATL_Standard_Library#Primitive_Types).
Your next question would be why? The answer is that ATL has been
developed as a model handler (like EMF) agnostic model transformation
language and as a superset of OCL. Then, being able to use some
implementation specific primitive types would break those foundations.

I suggest you to use String for your date, or to define a meta class
Date in your metamodel.

Hope this helps.

Regards,
Mikael

John E. Conlon wrote:
> Hi,
>
> I'm a ATL newbee still trying to come up to speed. Having problems with
> models that contain java.util.Date attributes.
>
> To simplify and reproduce the problem, I modified the Author2Person
> examples to include an Author birthDate attribute and a Person birthday
> attribute. (By Adding each attribute as a EDate EType in the
> Author.ecore and Person.ecore metamodels.)
>
> After those metamodel changes I was able to use the Sample ECore Model
> Editor to edit the authors.ecore model and add the values to the
> birthDate attributes.
>
> My authors.ecore model now looks like this...
> ---------------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI" xmlns="Author">
> <Author name="David" surname="Touzet"
> birthDate="2000-11-11T00:00:00.000-0600"/>
> <Author name="Freddy" surname="Allilaire"
> birthDate="2001-08-22T01:00:00.000-0500"/>
> </xmi:XMI>
> ----------------------------------------------
>
>
>
> Here is my modified Author2Person.atl ...
> --------------------------------------------
> module Author2Person; -- Module Template
> create OUT : Person from IN : Author;
>
> rule Author {
> from
> a: Author!Author
>
> to
> p: Person!Person (
> name <- a.name,
> surname <- a.surname,
> birthday <- a.birthDate
> )
> }
> ---------------------------------------------
>
>
>
>
> When I run the atl I get the following console errors:
>
> SEVERE: ****** BEGIN Stack Trace
> SEVERE: message: ERROR: cannot convert Sat Nov 11 00:00:00 CST 2000
> : class java.util.Date from EMF.
> SEVERE: A.main() : ??#24 null
> SEVERE: local variables = {self=Author2Person : ASMModule}
> SEVERE: local stack = []
> SEVERE: A.__exec__() : ??#8 null
> SEVERE: local variables = {self=Author2Person : ASMModule,
> e=TransientLink {rule = 'Author', sourceElements = {a = IN!David},
> targetElements = {p = OUT!David}, variables = {}}}
> SEVERE: local stack = []
> SEVERE: A.__applyAuthor(1 : NTransientLink;) : ??#24 12:20-12:31
> SEVERE: local variables = {p=OUT!David, a=IN!David,
> self=Author2Person : ASMModule, link=TransientLink {rule = 'Author',
> sourceElements = {a = IN!David}, targetElements = {p = OUT!David},
> variables = {}}}
> SEVERE: local stack = [OUT!David, OUT!David, Author2Person : ASMModule]
> SEVERE: ****** END Stack Trace
> INFO: Execution terminated due to error (see launch configuration to
> allow continuation after errors).
> SEVERE: ERROR: cannot convert Sat Nov 11 00:00:00 CST 2000 : class
> java.util.Date from EMF.
> java.lang.RuntimeException: ERROR: cannot convert Sat Nov 11 00:00:00
> CST 2000 : class java.util.Date from EMF.
> at
> org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:185)
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
>
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:81)
>
> at
> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.emf2A SM(ASMEMFModelElement.java:186)
>
> at
> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.get(A SMEMFModelElement.java:134)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:288)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
> at
> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
>
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:155)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
> ------------------------------------------------------------ ----------------
>
>
>
> Any one have any ideas as to what I am doing wrong and/or what is the
> proper approach when working with Date dataTypes.
>
> thanks for any help?
> John Conlon



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: [ATL] Re: Working with Dates [message #61392 is a reply to message #61367] Mon, 10 September 2007 08:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

To complete my previous post. You could also develop your own model
handler implementation that support these primitive types. It may be
valid if one of your metamodel is defined by a third party, but try to
avoid it in other cases (especially just for a Date ;)), because it can
be costly.

Regards,
Mikael


Mikaël Barbero wrote:
> Hi John,
>
> First, could you please try to stick with this newsgroup rules and
> prefix all of your messages about ATL with an [ATL] prefix. The reason
> is explained there http://wiki.eclipse.org/M2M. Thanks in advance.
>
> Concerning your question, the fact is that ATL does not support Date
> primitive type (or any other "Java" primitive types wrapped by EMF other
> than the ones detailed there
> http://wiki.eclipse.org/ATL_Standard_Library#Primitive_Types).
> Your next question would be why? The answer is that ATL has been
> developed as a model handler (like EMF) agnostic model transformation
> language and as a superset of OCL. Then, being able to use some
> implementation specific primitive types would break those foundations.
>
> I suggest you to use String for your date, or to define a meta class
> Date in your metamodel.
>
> Hope this helps.
>
> Regards,
> Mikael
>
> John E. Conlon wrote:
>> Hi,
>>
>> I'm a ATL newbee still trying to come up to speed. Having problems
>> with models that contain java.util.Date attributes.
>>
>> To simplify and reproduce the problem, I modified the Author2Person
>> examples to include an Author birthDate attribute and a Person
>> birthday attribute. (By Adding each attribute as a EDate EType in the
>> Author.ecore and Person.ecore metamodels.)
>>
>> After those metamodel changes I was able to use the Sample ECore Model
>> Editor to edit the authors.ecore model and add the values to the
>> birthDate attributes.
>>
>> My authors.ecore model now looks like this...
>> ---------------------------------------------
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <xmi:XMI xmi:version="2.0"
>> xmlns:xmi="http://www.omg.org/XMI" xmlns="Author">
>> <Author name="David" surname="Touzet"
>> birthDate="2000-11-11T00:00:00.000-0600"/>
>> <Author name="Freddy" surname="Allilaire"
>> birthDate="2001-08-22T01:00:00.000-0500"/>
>> </xmi:XMI>
>> ----------------------------------------------
>>
>>
>>
>> Here is my modified Author2Person.atl ...
>> --------------------------------------------
>> module Author2Person; -- Module Template
>> create OUT : Person from IN : Author;
>>
>> rule Author {
>> from
>> a: Author!Author
>> to
>> p: Person!Person (
>> name <- a.name,
>> surname <- a.surname,
>> birthday <- a.birthDate
>> )
>> }
>> ---------------------------------------------
>>
>>
>>
>>
>> When I run the atl I get the following console errors:
>>
>> SEVERE: ****** BEGIN Stack Trace
>> SEVERE: message: ERROR: cannot convert Sat Nov 11 00:00:00 CST
>> 2000 : class java.util.Date from EMF.
>> SEVERE: A.main() : ??#24 null
>> SEVERE: local variables = {self=Author2Person : ASMModule}
>> SEVERE: local stack = []
>> SEVERE: A.__exec__() : ??#8 null
>> SEVERE: local variables = {self=Author2Person : ASMModule,
>> e=TransientLink {rule = 'Author', sourceElements = {a = IN!David},
>> targetElements = {p = OUT!David}, variables = {}}}
>> SEVERE: local stack = []
>> SEVERE: A.__applyAuthor(1 : NTransientLink;) : ??#24 12:20-12:31
>> SEVERE: local variables = {p=OUT!David, a=IN!David,
>> self=Author2Person : ASMModule, link=TransientLink {rule = 'Author',
>> sourceElements = {a = IN!David}, targetElements = {p = OUT!David},
>> variables = {}}}
>> SEVERE: local stack = [OUT!David, OUT!David, Author2Person :
>> ASMModule]
>> SEVERE: ****** END Stack Trace
>> INFO: Execution terminated due to error (see launch configuration to
>> allow continuation after errors).
>> SEVERE: ERROR: cannot convert Sat Nov 11 00:00:00 CST 2000 : class
>> java.util.Date from EMF.
>> java.lang.RuntimeException: ERROR: cannot convert Sat Nov 11 00:00:00
>> CST 2000 : class java.util.Date from EMF.
>> at
>> org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:185)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:81)
>>
>> at
>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.emf2A SM(ASMEMFModelElement.java:186)
>>
>> at
>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.get(A SMEMFModelElement.java:134)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:288)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
>>
>> at
>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:155)
>> at
>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
>> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
>>
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
>>
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
>>
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
>>
>> at
>> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
>>
>> at
>> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>>
>> at
>> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>>
>> at
>> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
>>
>> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>>
>> ------------------------------------------------------------ ----------------
>>
>>
>>
>> Any one have any ideas as to what I am doing wrong and/or what is the
>> proper approach when working with Date dataTypes.
>>
>> thanks for any help?
>> John Conlon
>
>
>



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: [ATL] Re: Working with Dates [message #61465 is a reply to message #61392] Mon, 10 September 2007 13:04 Go to previous message
Eclipse UserFriend
Originally posted by: jconlon.apache.org

Hi Mikaël,

Thank you for your fast response. See my a replies inline...

Mikaël Barbero wrote:
> To complete my previous post. You could also develop your own model
> handler implementation that support these primitive types. It may be
> valid if one of your metamodel is defined by a third party, but try to
> avoid it in other cases (especially just for a Date ;)), because it can
> be costly.
>
> Regards,
> Mikael
>
>
> Mikaël Barbero wrote:
>> Hi John,
>>
>> First, could you please try to stick with this newsgroup rules and
>> prefix all of your messages about ATL with an [ATL] prefix. The reason
>> is explained there http://wiki.eclipse.org/M2M. Thanks in advance.
Sorry - will do this next time.

>>
>> Concerning your question, the fact is that ATL does not support Date
>> primitive type (or any other "Java" primitive types wrapped by EMF
>> other than the ones detailed there
>> http://wiki.eclipse.org/ATL_Standard_Library#Primitive_Types).
>> Your next question would be why? The answer is that ATL has been
>> developed as a model handler (like EMF) agnostic model transformation
>> language and as a superset of OCL. Then, being able to use some
>> implementation specific primitive types would break those foundations.

Yes, that is a good reason.
>> I suggest you to use String for your date, or to define a meta class
>> Date in your metamodel.

I'll try one of your two suggestions.

thanks again for the support,
John Conlon

>>
>> Hope this helps.
>>
>> Regards,
>> Mikael
>>
>> John E. Conlon wrote:
>>> Hi,
>>>
>>> I'm a ATL newbee still trying to come up to speed. Having problems
>>> with models that contain java.util.Date attributes.
>>>
>>> To simplify and reproduce the problem, I modified the Author2Person
>>> examples to include an Author birthDate attribute and a Person
>>> birthday attribute. (By Adding each attribute as a EDate EType in
>>> the Author.ecore and Person.ecore metamodels.)
>>>
>>> After those metamodel changes I was able to use the Sample ECore
>>> Model Editor to edit the authors.ecore model and add the values to
>>> the birthDate attributes.
>>>
>>> My authors.ecore model now looks like this...
>>> ---------------------------------------------
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <xmi:XMI xmi:version="2.0"
>>> xmlns:xmi="http://www.omg.org/XMI" xmlns="Author">
>>> <Author name="David" surname="Touzet"
>>> birthDate="2000-11-11T00:00:00.000-0600"/>
>>> <Author name="Freddy" surname="Allilaire"
>>> birthDate="2001-08-22T01:00:00.000-0500"/>
>>> </xmi:XMI>
>>> ----------------------------------------------
>>>
>>>
>>>
>>> Here is my modified Author2Person.atl ...
>>> --------------------------------------------
>>> module Author2Person; -- Module Template
>>> create OUT : Person from IN : Author;
>>>
>>> rule Author {
>>> from
>>> a: Author!Author
>>> to
>>> p: Person!Person (
>>> name <- a.name,
>>> surname <- a.surname,
>>> birthday <- a.birthDate
>>> )
>>> }
>>> ---------------------------------------------
>>>
>>>
>>>
>>>
>>> When I run the atl I get the following console errors:
>>>
>>> SEVERE: ****** BEGIN Stack Trace
>>> SEVERE: message: ERROR: cannot convert Sat Nov 11 00:00:00 CST
>>> 2000 : class java.util.Date from EMF.
>>> SEVERE: A.main() : ??#24 null
>>> SEVERE: local variables = {self=Author2Person : ASMModule}
>>> SEVERE: local stack = []
>>> SEVERE: A.__exec__() : ??#8 null
>>> SEVERE: local variables = {self=Author2Person : ASMModule,
>>> e=TransientLink {rule = 'Author', sourceElements = {a = IN!David},
>>> targetElements = {p = OUT!David}, variables = {}}}
>>> SEVERE: local stack = []
>>> SEVERE: A.__applyAuthor(1 : NTransientLink;) : ??#24 12:20-12:31
>>> SEVERE: local variables = {p=OUT!David, a=IN!David,
>>> self=Author2Person : ASMModule, link=TransientLink {rule = 'Author',
>>> sourceElements = {a = IN!David}, targetElements = {p = OUT!David},
>>> variables = {}}}
>>> SEVERE: local stack = [OUT!David, OUT!David, Author2Person :
>>> ASMModule]
>>> SEVERE: ****** END Stack Trace
>>> INFO: Execution terminated due to error (see launch configuration to
>>> allow continuation after errors).
>>> SEVERE: ERROR: cannot convert Sat Nov 11 00:00:00 CST 2000 : class
>>> java.util.Date from EMF.
>>> java.lang.RuntimeException: ERROR: cannot convert Sat Nov 11 00:00:00
>>> CST 2000 : class java.util.Date from EMF.
>>> at
>>> org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:185)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:81)
>>>
>>> at
>>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.emf2A SM(ASMEMFModelElement.java:186)
>>>
>>> at
>>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.get(A SMEMFModelElement.java:134)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:288)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>>> at
>>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>>> at
>>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>>> at
>>> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
>>>
>>> at
>>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:155)
>>> at
>>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
>>> at
>>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
>>> at
>>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
>>>
>>> at
>>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
>>>
>>> at
>>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
>>>
>>> at
>>> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
>>>
>>> at
>>> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
>>>
>>> at
>>> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>>>
>>> at
>>> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>>>
>>> at
>>> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
>>>
>>> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>>>
>>> ------------------------------------------------------------ ----------------
>>>
>>>
>>>
>>> Any one have any ideas as to what I am doing wrong and/or what is the
>>> proper approach when working with Date dataTypes.
>>>
>>> thanks for any help?
>>> John Conlon
>>
>>
>>
>
>
>
Previous Topic:[ATL] UML2WSDL.
Next Topic:[ATL] getAppliedStereotypes returns emptyList
Goto Forum:
  


Current Time: Sun Apr 11 02:28:13 GMT 2021

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

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

Back to the top