[ECL] Finding out "visited" features of an ECL rule [message #730189] |
Tue, 27 September 2011 20:19 |
|
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 |
|
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 #734929 is a reply to message #730189] |
Mon, 10 October 2011 13:02 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02073 seconds