Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-Relations » metamodel configuration for parsing in standalone mode
metamodel configuration for parsing in standalone mode [message #1440972] Thu, 09 October 2014 04:45 Go to next message
pere joseph rodríguez is currently offline pere joseph rodríguezFriend
Messages: 12
Registered: October 2014
Junior Member
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 #1441234 is a reply to message #1440972] Thu, 09 October 2014 12:34 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5883
Registered: July 2009
Senior Member
Hi


metamodelsPaths.add("C:/Users/pere/Documents/devel/workspace/QVTRelation/standalone/qvtrelation.ecore");

is absolutely not the way to do things.

Have a look at the JUnit tests or trace along the editor.

If you just want the AS, you can use OCL->SAve Anstract Syntax
interactively in the editor.

Regards

Ed Willink



On 09/10/2014 12:43, pere joseph rodríguez wrote:
> 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 #1441254 is a reply to message #1441234] Thu, 09 October 2014 13:06 Go to previous messageGo to next message
pere joseph rodríguez is currently offline pere joseph rodríguezFriend
Messages: 12
Registered: October 2014
Junior Member
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);
Re: metamodel configuration for parsing in standalone mode [message #1441274 is a reply to message #1441254] Thu, 09 October 2014 13:43 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5883
Registered: July 2009
Senior Member
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);
Previous Topic:ModelMorf metamodel with references
Next Topic:QVT 1.2
Goto Forum:
  


Current Time: Sun May 20 16:09:26 GMT 2018

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

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

Back to the top