Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] EJavaClass
[ATL] EJavaClass [message #67897] Fri, 30 November 2007 15:55 Go to next message
Eclipse UserFriend
Originally posted by: marco.serina.txtgroup.com

Hi!
I'm an ATL newbie and I'm trying to run the following rule:

rule TagType{
from
tagTypeIn: Xirup!TagType
to
tagTypeOut: Xirup!TagType(
id <- tagTypeIn.id,
name <- tagTypeIn.name
type <- tagTypeIn.type
)

}

This is very simple, but troubles come out in "type" field because it's
been declared as EJavaClass.

Supposing having the following model:

....
<tagtype id="ComponentAgeTagType" name="ComponentAge"
type="java.lang.String"/>
....

I can't perform the mapping and the engine returns:

GRAVE: ****** BEGIN Stack Trace
GRAVE: message: ERROR: cannot convert class java.lang.String : class
java.lang.Class from EMF.
GRAVE: A.main() : ??#24 null
GRAVE: local variables = {self=TBMS2MS : ASMModule}
GRAVE: local stack = []
GRAVE: A.__exec__() : ??#8 null
GRAVE: local variables = {e=TransientLink {rule = 'TagType',
sourceElements = {tagTypeIn = IN!ComponentAge}, targetElements =
{tagTypeOut = OUT!ComponentAge}, variables = {}}, self=TBMS2MS : ASMModule}
GRAVE: local stack = []
GRAVE: A.__applyTagType(1 : NTransientLink;) : ??#24 13:12-13:26
GRAVE: local variables = {tagTypeOut=OUT!ComponentAge,
tagTypeIn=IN!ComponentAge, link=TransientLink {rule = 'TagType',
sourceElements = {tagTypeIn = IN!ComponentAge}, targetElements =
{tagTypeOut = OUT!ComponentAge}, variables = {}}, self=TBMS2MS : ASMModule}
GRAVE: local stack = [OUT!ComponentAge, OUT!ComponentAge, TBMS2MS :
ASMModule]
GRAVE: ****** END Stack Trace
INFO: Execution terminated due to error (see launch configuration to
allow continuation after errors).
GRAVE: ERROR: cannot convert class java.lang.String : class
java.lang.Class from EMF.
java.lang.RuntimeException: ERROR: cannot convert class java.lang.String
: class java.lang.Class from EMF.

....

Is there a way to manage it or would I better change the metamodel using
a "simpler" EType like EString?

Thank you very much in advance for your help!

-marco
Re: [ATL] EJavaClass [message #68069 is a reply to message #67897] Mon, 03 December 2007 18:07 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

> This is very simple, but troubles come out in "type" field because it's
> been declared as EJavaClass.

Model Engineering is about models as graphs of model elements typed by
metamodel elements from the metamodel (also a model) to which the model
conform. For more detailed definitions, see
http://www.sciences.univ-nantes.fr/lina/atl/bibliography/FMO ODS06

There is no "object" in this definition because Model Engineering and
Object Engineering are distinct technologies.

Now, if you add an object (e.g., a Java object) to the graph that you
are working with, then this is not a model anymore (according to the
definitions above). However, because model elements are implemented as
Java object in EMF, this is still a valid object graph.

So, you can use Java to work with your graph, but not model-to-model
transformation tools.


Note that we could (in theory) add a Java driver to ATL that would
consider objects as model elements, and their classes as metamodel
elements. However, some restrictions would probably be necessary. Plus,
if we did that, we would not need EMF any more. Therefore, I believe it
is better to use EMF only. Just make sure not to use EMF features
intended for Java developers, and not for model engineers :-).


> Is there a way to manage it or would I better change the metamodel using
> a "simpler" EType like EString?

If you want to use a primitive type, then use it directly.
If you want to use a complex type, then define it as an EClass.


Regards,

Frédéric Jouault
Previous Topic:[ATL] Latest EmfModelHandler CLONING referenced elements - possible bug?
Next Topic:[ATL] emfvm non-regression tests
Goto Forum:
  


Current Time: Fri Apr 26 03:40:22 GMT 2024

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

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

Back to the top