Home » Modeling » OCL » Unable to resolve OCL pivot variable types in standalone mode during a M2M transformation
Unable to resolve OCL pivot variable types in standalone mode during a M2M transformation [message #1706653] |
Fri, 28 August 2015 12:35 |
Mathias K Messages: 16 Registered: March 2014 |
Junior Member |
|
|
Hello,
I have developped an ATL transformation using the OCL pivot abstract syntax metamodel as input.
I believe my problem (below) is related to OCL's standalone initialization, though it might be also related to some ATL mechanics.
The transformation runs without troubles when running the transformation directly inside Eclipse Modelling (using ATL's launch configuration for instance).
It also works when invoking programmatically the ATL transformation inside an Eclipse environment with the OCL/ATL plugins loaded.
However when I try to run the transformation standalone, the references "type" of OCL variables seems to be only partially defined (at least for ATL).
Concretely, a rule like the following one (the target object, here an ecore eclass, is only for the example and is not relevant to my problem, only the ATL debug messages on the input model matter) :
rule Variable2Debug {
from
s : OCL!Variable
to
t : ECORE!EClass (
name <- s.debug('Variable: ').type.debug('Variable type: ' + s.type.oclType()).name.debug('Variable type name: ')
)
}
will output the following when run directly (aka with OCL plugins loaded), which is OK :
Variable: : IN!self
Variable type: org.eclipse.emf.ecore.impl.EClassImpl@2753fdcc (name: Class) (instanceClassName: null) (abstract: false, interface: false): <unknown>!A
Variable type name: : 'A'
and will output this when trying to run it standalone :
Variable: : IN!self
Variable type: org.eclipse.emf.ecore.impl.EClassImpl@75487cd2 (name: Type) (instanceClassName: null) (abstract: false, interface: false): <unknown>!<unnamed>
Variable type name: : OclUndefined
In short, in this configuration I cannot access the name of the variable's type, which comes from the merged metamodel on which the constraints apply. The OCL reference target object is also different for some reason: "Class" / "Type".
I have created 2 small test projects, which I attach to this post, for reproducing the problem. One project is the ATL transformation plugin (and a saved ATL launch config), the other one is the standalone java application with the example OCL model (and a short README).
I believe I am missing something in the OCL standalone initialization, and there's probably more involved in the OCL/ATL mechanics that I don't understand. I have read all the OCL pivot documentation but still don't see where the problems lies.
Any help or hints on the problem and what to try would be appreciated. I can of course provide more input or clarifications if needed.
I am using Eclipse Luna, and the according latest versions of OCL and ATL.
Thank you,
MK
[Updated on: Mon, 31 August 2015 11:55] Report message to a moderator
|
|
| | | | | |
Re: Unable to resolve OCL pivot variable types in standalone mode during a M2M transformation [message #1706957 is a reply to message #1706901] |
Tue, 01 September 2015 07:53 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
I'm afraid that I cannot really help further. I'm not an ATL user.
I wouldn't really expect it to work at all, since ATL has its own
distinct proprietary OCL variant internally and such duplicates often
cause confusion. But since it works within Eclipse, ATL appears to have
successfully isolated tooling and user metamodels.
The org.eclipse.emf.ecore.impl.EClassImpl@2753fdcc in your original
message suggests that Pivot.ecore rather than
http://www.eclipse.org/ocl/2015/Pivot is in use.
You almost certainly have a problem populating the package registries.
Use the debugger to discover why the 'wrong' Resource is loaded. In
similar scenarios I often add a println to the Resource constructor.
Regards
Ed Willink
On 31/08/2015 18:23, Mathias K wrote:
> Hi,
>
> Thank you for the quick answer and taking time to look into the issue.
>
> I have indeed tried with Mars, following the doc (modifying where
> needed for parts where doc is not in sync with libraries).
> I just tried using the PivotStandaloneSetup for the same result as
> before.
> Though I only need the AS for this test, I did try with the xtext
> setups as well just to be sure, doesn't change the outcome.
>
> I don't know what else I could try. I can send the updated mars
> projects if you want, but it just the same as the luna ones except for
> the OCL init being updated.
>
> Regards,
> MK
|
|
|
Re: Unable to resolve OCL pivot variable types in standalone mode during a M2M transformation [message #1707112 is a reply to message #1706957] |
Wed, 02 September 2015 12:25 |
Mathias K Messages: 16 Registered: March 2014 |
Junior Member |
|
|
Thanks for your answer.
I have made some further tests based on your input.
This led me in two directions. The second one will probably interest you more.
1) Concerning your hint on package registrations. I've only used ns URIs all along and didn't see any path to any ecore file in all debugging messages, but I have checked a couple things anyway .
This is the package in the global EMF registry for the OCL Pivot metamodel from its NSURI (http://www.eclipse.org/ocl/2015/Pivot) :
org.eclipse.ocl.pivot.internal.PivotPackageImpl@1b86d76f (name: pivot) (nsURI: http://www.eclipse.org/ocl/2015/Pivot, nsPrefix: pivot)
And this is the (same) one registered in ATL's dedicated resource set after all models are loaded :
org.eclipse.ocl.pivot.internal.PivotPackageImpl@1b86d76f (name: pivot) (nsURI: http://www.eclipse.org/ocl/2015/Pivot, nsPrefix: pivot)
I have checked that the metamodel in ATL has the right ns URI, that the model (the abstract syntax) is loaded using the right metamodel, etc.
If anyone is interested, the corresponding ATL code for loading (meta)models is here :
http://git.eclipse.org/c/mmt/org.eclipse.atl.git/tree/plugins/org.eclipse.m2m.atl.core.emf/src/org/eclipse/m2m/atl/core/emf/EMFInjector.java
In short, it is a simple getResource(nsURI) on its dedicated resource set.
I have tried with initializing OCL standalone in the global registry, in ATLs resource set, and in both.
In all cases, the ATL output when debugging is still :
Variable: : IN!self
Variable type: org.eclipse.emf.ecore.impl.EClassImpl@75165e3e (name: Class) (instanceClassName: null) (abstract: false, interface: false): <unknown>!<unnamed>
Variable type name: : OclUndefined
2) since I couldn't seem to narrow the problem anymore, I tried to get rid of ATL. I've hence loaded the OCL abstract syntax resource similarly to how ATL does it and browsed it manually to get a variable "type" reference. The reference target is indeed undefined again so I must be doing something wrong. I have created a separate topic for these tests with the project attached and some additional info :
https://www.eclipse.org/forums/index.php?t=msg&th=1069939&goto=1707111&#msg_1707111
At this point, I'm waiting to solve this problem before I come back trying with ATL as it clearly seems related. Please recall that all of this is in standalone mode, running in an eclipse environment with OCL plugins works fine with or without ATL.
Regards,
MK
|
|
| |
Goto Forum:
Current Time: Thu Apr 18 08:44:49 GMT 2024
Powered by FUDForum. Page generated in 0.23852 seconds
|