metamodel configuration for parsing in standalone mode [message #1440972] |
Thu, 09 October 2014 00:45  |
Eclipse User |
|
|
|
Hi,
i'm trying to export a qvtr file to its ast/pivot representaton in XMI. I'm able to get the pivots, but seems that transformation be serrialized because typedModels usedPackages cannot be resolved because have not been assigned to the corresponding epackage.
I think i'ts due to the metamodel manager, but after looking for the source code I cannot find how is the metamodelId matched with the corresponding epackage, so
when I parse a transformation like
transformation initialize_project ( empty : uml241 , target : uml241){
....
}
the corresponding typedModels usedPackages references to OclAnyImpl, not to the epackage I've registered dynamically.
How can i solve this?
My sample code is attached.
Thanks alot
|
|
|
|
|
Re: metamodel configuration for parsing in standalone mode [message #1441274 is a reply to message #1441254] |
Thu, 09 October 2014 09:43  |
Eclipse User |
|
|
|
Hi
For OCL you can follow the standalone direction in the OCL documentation.
You won't get far without xxxxStandalonmeSetup.doSetup();
For UML you won't get far without UMLResourcesUtil.init().
You will do much better to strip down a JUnit test that works rather
than build up bespoke code that doesn't.
Regards
Ed Willink
On 09/10/2014 14:06, pere joseph rodríguez wrote:
> Hi Ed,
> I've tried to créate a resource set and initialize its package registry
> with the metamodels loaded dinamically, and then initialize OCL with
> this package registry, but seems not to work. I supose some mapping from
> metamodel to it's modelId name is needed to resolve uml241 to its
> corresponding URL or package, but cannot find how to do it.
>
> EPackage.Registry registry=new EPackageRegistryImpl();
> EcorePackage ecore=EcorePackage.eINSTANCE;
> registry.put(ecore.getNsURI(), ecore);
>
> this.resourceSet=new ResourceSetImpl();
>
> this.resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
> new EcoreResourceFactoryImpl());
>
> this.resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
> new XMIResourceFactoryImpl());
>
> this.resourceSet.setPackageRegistry(registry);
>
> //this function loads the ecore metamodel files and put them into the
> registry of the resourceSet
> this.collectMetaModels(resourceSet);
>
>
> OCL ocl = OCL.newInstance(registry);
|
|
|
Powered by
FUDForum. Page generated in 0.03559 seconds