Home » Modeling » ATL » Checking whether ATL module may be used for given target MM and model
Checking whether ATL module may be used for given target MM and model [message #1713058] |
Fri, 30 October 2015 13:09 |
Dmitry Tatarinov Messages: 5 Registered: October 2015 |
Junior Member |
|
|
Hi.
We are developing a project with use of EMF, where we have one main metamodel (MM1) and a number of 'small' metamodels that are a 'subset' of MM1. Each of this small metamodels needs its own set of tools (parsers, analyzers, configuration generators), and we do not want to work with MM1 while developing them, as MM1 is redundunt. So, we need to transforms models.
We are currently using ATL/EMFTVM and for some reason allow users to transforms instances of MM1 to instance of any other metamodel with any ATL module. Instances of MM1 consist of a big number of 'components' and each also can be transformed using our wizard (we run emftvm programatically).
The problem is that there is a great total number of components that can be transformed, while only few the potentially may be used with given ATL module. So we need to filter models that can be IN models for some module. The obvious way to do it is just to run a module under each of these models and accept those, which do not fail (throw exceptions), but it may be time consuming and 'not academic'.
So the question is, aren't there any tools or ATL/EMFTVM SDK support for checking these condtions?
|
|
|
Re: Checking whether ATL module may be used for given target MM and model [message #1713527 is a reply to message #1713058] |
Wed, 04 November 2015 20:06 |
|
It depends what exactly you mean with "these conditions". The general problem of determining whether a transformation is going to throw an error is undecidable, just like determining whether or not it terminates. If it is a simple matter of checking that only a subset of MM1 metaclasses is used in the input model, things are much easier. The way to do it is to develop an extra "well-formedness check" ATL query that validates the input model, and returns "true" when it passes. I can see a few ways of implementing such a query:
- Write a separate validation query for each transformation module. Only the original input model is required as validation input.
- Write a single, reflective validation query that checks if the input model uses only metaclasses that occur in the output metamodel. This validation query requires the original input model as well as the targeted output metamodel.
- Write a single, reflective validation query that checks if the input model uses only metaclasses that are specified in the transformation module. This validation query requires the original input model as well as the transformation module EMFTVM bytecode (=model).
Cheers,
Dennis
|
|
| | |
Re: Checking whether ATL module may be used for given target MM and model [message #1716504 is a reply to message #1715172] |
Fri, 04 December 2015 12:54 |
Dmitry Tatarinov Messages: 5 Registered: October 2015 |
Junior Member |
|
|
Thanks, Dennis.
We've implemented some obvious 'checks', that emftvm module may be used with given MM (whether IN or OUT). We check, whether each rule of module uses only metaclasses, specified in MM. Another question is now how to check it in more academic way, as we just compare type literals, which may be unreliable.
The problem now is to think of a way to filter models (EObjects), that may be used with given IN MM, OUT MM and emftvm module (given that model conforms to IN MM). Is it appropriate to check for example that at least one rule of module will be executed? By 'executed' I mean, that input model (EObject) has in its content all the elements, specified in the FROM clause of module. Here we assume, that if no rule may be matched, the transformation has no semantic sense, despite technically it may be legal. Are there some other checks of this kind?
|
|
|
Re: Checking whether ATL module may be used for given target MM and model [message #1716738 is a reply to message #1716504] |
Mon, 07 December 2015 21:34 |
|
Dmitry Tatarinov wrote on Fri, 04 December 2015 13:54
We've implemented some obvious 'checks', that emftvm module may be used with given MM (whether IN or OUT). We check, whether each rule of module uses only metaclasses, specified in MM. Another question is now how to check it in more academic way, as we just compare type literals, which may be unreliable.
EMFTVM only links its modules against real metamodels at load-time, which is why the .emftvm files only contain lexical references to metaclasses. When loading an EMFTVM module into an ExecEnv instance, the actual metaclasses will be resolved against the registered metamodels, and the "eType" property of the various typed elements will have been filled in. Using such a loaded EMFTVM module should allow you to check - using the actual EMFTVM type resolver algorithm - whether the exact same metaclasses of the MM are also used in the EMFTVM module.
Dmitry Tatarinov wrote on Fri, 04 December 2015 13:54
The problem now is to think of a way to filter models (EObjects), that may be used with given IN MM, OUT MM and emftvm module (given that model conforms to IN MM). Is it appropriate to check for example that at least one rule of module will be executed? By 'executed' I mean, that input model (EObject) has in its content all the elements, specified in the FROM clause of module. Here we assume, that if no rule may be matched, the transformation has no semantic sense, despite technically it may be legal. Are there some other checks of this kind?
You may check whether the intersection of metaclasses referenced by the input model and the InputRuleElement instances of "#automaticSingle" Rules in the EMFTVM model is non-empty. That means that there are ATL matched rules that take instances of those metaclasses as input. Keep in mind that this approach ignores any OCL filter expression used on the rule's "from" part, however, and the actual rule may still not trigger due to the filter expression evaluating to"false".
Cheers,
Dennis
|
|
| |
Re: Checking whether ATL module may be used for given target MM and model [message #1717340 is a reply to message #1717271] |
Fri, 11 December 2015 22:02 |
|
Dmitry Tatarinov wrote on Fri, 11 December 2015 11:06
As you mentioned, the only other idea to filter raw EObjects may be to somehow evaluate the OCL expression in matcher block; is there any smart way to deal with these expressions (without reimplementing the whole engine =))?
If you could "pause" EMFTVM between the matching phase and the applying phase, you could introspect the matches model (ExecEnv.getMatches()) to see if any rule matched. After the user chooses to apply the transformation, you can simply resume the transformation with the existing matches.
With the current API, this is not possible: ExecEnv.run() will execute a transformation in its entirety. It is definitely possible to add API that enables the above scenario. Is this something you would be interested in? N.B. you need to consider that matching is often half the transformation execution time!
Cheers,
Dennis
|
|
| |
Goto Forum:
Current Time: Sun Sep 22 09:26:08 GMT 2024
Powered by FUDForum. Page generated in 0.03888 seconds
|