Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EOL] Get All Properties(How can I retrive the set of properties of any class)
[EOL] Get All Properties [message #759661] Tue, 29 November 2011 14:36 Go to next message
Vasco Sousa is currently offline Vasco SousaFriend
Messages: 23
Registered: September 2009
Junior Member
Hi,

The situation is I'm importing a model into another,
but the meta-model is not fixed and I cannot know
the types and properties at code time.

So the big question is, how do I get the set of Properties
of a class (Attributes and References, separated or all
in one set)in EOL, much like the OCL getAllProperties().

I tried to search in the documentation and the forum
and don't seem to be able to find any information on
this matter.


best regards
Vasco Sousa

[Updated on: Tue, 29 November 2011 14:38]

Report message to a moderator

Re: [EOL] Get All Properties [message #760733 is a reply to message #759661] Sun, 04 December 2011 22:28 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Vasco,

Apologies for the late reply. You'll need to use EMF Reflection for this (assuming that you're working with EMF-based models). For example, if x is your object, you can use x.eClass().getEAttributes() / getEReferences() to get all the attributes/references. See http://download.eclipse.org/modeling/emf/emf/javadoc/2.6.0/org/eclipse/emf/ecore/EClass.html for more details on the API of EClass and please let us know if you need any further assistance with this.

Cheers,
Dimitris
Re: [EOL] Get All Properties [message #760781 is a reply to message #760733] Mon, 05 December 2011 08:55 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Hi Vasco,

A word of warning, though: You can use reflection, but I don't think any
of the higher-level Epsilon languages will be of too much use to you
then. Dimitris, correct me if I'm wrong, but ETL/EGL, etc. do not
support reflection on the language level.

So, you can write plain EOL and use reflection directly. I don't think
this is going to be any more convenient or efficient than using Java
directly.

Alternatively, you can use higher-order transformations (HOTs); that is
transformations that generate transformations. In your case, you could,
for example, write an EGL script that takes a metamodel and generates an
ETL script for instances of this metamodel. This way you can make full
use of the features of EGL/ETL, while still being able to adapt your
transformations to arbitrary metamodels in a systematic fashion.

Best,

Steffen

On 04/12/2011 22:28, Dimitris Kolovos wrote:
> Hi Vasco,
>
> Apologies for the late reply. You'll need to use EMF Reflection for
> this (assuming that you're working with EMF-based models). For
> example, if x is your object, you can use x.eClass().getEAttributes()
> / getEReferences() to get all the attributes/references. See
> http://download.eclipse.org/modeling/emf/emf/javadoc/2.6.0/org/eclipse/emf/ecore/EClass.html
> for more details on the API of EClass and please let us know if you
> need any further assistance with this.
>
> Cheers,
> Dimitris
Re: [EOL] Get All Properties [message #760963 is a reply to message #760781] Mon, 05 December 2011 18:00 Go to previous message
Vasco Sousa is currently offline Vasco SousaFriend
Messages: 23
Registered: September 2009
Junior Member
Hi,

Thanks Dimitris and Steffen,

this is exactly what I needed( actualy getEAllAttributes(), but it the same documentation Smile ).

As for the HOT approach, it wold be nice to do HOT, but in this case I think it is overkill. The import process is really simple, so EOL is fine, readable and compact.

Cheers, see you next time,
Vasco
Previous Topic:How to execute ETL bundled by a plugin from within ANT
Next Topic:[Eugenia] Create a second label in a Rectangle Figure
Goto Forum:
  


Current Time: Fri Apr 19 07:12:42 GMT 2024

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

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

Back to the top