Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » How can I access Ecore elements of an input metamodel in ATL code
How can I access Ecore elements of an input metamodel in ATL code [message #1415396] Tue, 02 September 2014 17:35 Go to next message
Hamid Qartal is currently offline Hamid QartalFriend
Messages: 33
Registered: December 2013
Member
I would like to know if it is possible to access to ecore Elements of a Metamodel inside ATL code reflexively.

suppose I have a metamodel MM1, inside the metamodel I have a Class A, I would like to know how can I access to features of this class inside the code. More concretely suppose I have a helper:

helper def : getRef(a : OclAny) : Collection(OclAny) =
     ....


I would like to pass a Class to this helper and get back the list of all its references; i.e., I call

thisModule.getRef(MM1!A)


and this returns a collection of A's features; for example, if A has two references called called b1 and c1. I expect the above code to return {b1,c1}

Thanks
Re: How can I access Ecore elements of an input metamodel in ATL code [message #1415398 is a reply to message #1415396] Tue, 02 September 2014 17:40 Go to previous message
Hamid Qartal is currently offline Hamid QartalFriend
Messages: 33
Registered: December 2013
Member
I found a solution to the question:

What I need to do is to complete the above helper code as bellow:

helper def : getRef(a : OclAny) : Collection(OclAny) =
        a->getEReferences();


The function getEReferences() does all the job for me! so simple!

if you would like to see all the accessible functions look at the methods for the EClass interface in the link bellow (or search "EClass interface javadoc"):


http://download.eclipse.org/modeling/emf/emf/javadoc/2.4.3/org/eclipse/emf/ecore/EClass.html#getEReferences()


Calling thisModule.getRef(MM1!A) would return a collection that contains all the references inside the MM1!A class!


Thanks
Previous Topic:Initialize a Map to be empty
Next Topic:ATL and JAVA code communication
Goto Forum:
  


Current Time: Fri Apr 26 07:06:33 GMT 2024

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

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

Back to the top