Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ECL] Finding out "visited" features of an ECL rule
[ECL] Finding out "visited" features of an ECL rule [message #730189] Tue, 27 September 2011 20:19 Go to next message
Philip Langer is currently offline Philip LangerFriend
Messages: 6
Registered: December 2010
Location: Vienna, Austria
Junior Member

I was wondering whether there is an "easy" possibility to programmatically find the metamodel features that are visited/read by an ECL match rule. I'm interested in such a technique to know for any match rule after which changes applied to a model it has to be matched with another model again. Obviously, it only has to be re-matched if a feature value changes, which is visited/read by the corresponding match rule.

Let me give you a short example. I have the following match rule:

rule EClass2EClass
match o : Origin ! EClass
with r : Revised ! EClass {
compare : o.name = r.name
}


Now I have two evolving Ecore models and I would like to determine after which change I have to rerun the comparison for which instances of EClass. In this example, this is obviously only necessary if the name of an instance of an EClass has been changed.

In other words, is there a way to statically parse the abstract syntax of a rule and collect for each rule the metamodel features it reads for matching two objects (e.g., EClass.name)?

Thank you very much in advance for any advice!

Philip
Re: [ECL] Finding out "visited" features of an ECL rule [message #730870 is a reply to message #730189] Thu, 29 September 2011 12:23 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

Hello Philip,

I am not the Epsilon expert but imho the short answer is yes. As I see it you would have to invoke your ecl module via java (i.e. stand alone mode). All Epsilon modules (in your case org.eclipse.epsilon.ecl.EclModule) have a parse method. The argument to this method is the ecl file with the match rules. After you have parsed the source the AST (abstract syntax tree) is populated. You could then access the AST and extract the metamodel elements referenced by each rule. You would have to take some time to understand the AST in order to find the info you are looking for.

However, is running the match every time you make a change so "expensive"? Depending on your model editor you could listen the save event and launch the match ant each time or something similar.

Best regards,

Horacio


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: [ECL] Finding out "visited" features of an ECL rule [message #734897 is a reply to message #730189] Mon, 10 October 2011 10:29 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Dear Philip,

Epsilon doesn't provide much support for this kind of impact analysis right now (though I've recently been making some changes that might make it easier to achieve this).

I'd be interested on working on this with you. Could you send me a mail (louis AT cs DOT york DOT ac DOT uk), and we can chat further about your specific requirements.

Best,
Louis.
Re: [ECL] Finding out "visited" features of an ECL rule [message #734929 is a reply to message #730189] Mon, 10 October 2011 13:02 Go to previous message
Philip Langer is currently offline Philip LangerFriend
Messages: 6
Registered: December 2010
Location: Vienna, Austria
Junior Member

Hi Horacio, hi Louis,

thanks a lot for your replies!

I already conducted some first tests concerning the approach proposed by Horacio. Accessing the AST works as expected; when knowing what and where to search for, it is possible to collect all metamodel features that are visited by the respective rule. It is not a very convenient way though as you'd have to "know" the feature names and class names of the metamodel that is being matched in advance. There is no explicit link to the respective metamodel.

Thus, I'd be very interested in collaborating regarding this feature with you, Louis.

I'll write you an email with my requirements soon to find out what we both can to do.

Thanks,

Philip
Previous Topic:labels new line character
Next Topic:Using EOL to build test models
Goto Forum:
  


Current Time: Thu Mar 28 18:04:23 GMT 2024

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

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

Back to the top