This service is archived, please use www.eclipse.org/forums


Home » Capella » Capella Studio » Transform XSD (via Ecore) to Capella Data Model
Transform XSD (via Ecore) to Capella Data Model [message #3233] Mon, 27 May 2019 13:56 Go to next message
dsryzhov.gmail.com is currently offline  dsryzhov.gmail.com
Messages: 80
Registered: February 2015
Member
I've created transformation from Ecore model to Capella Data Model using Kitalpha Transposer.

I use the following launch configuration to run Transposer trandformation in Capella.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type=" org.polarsys.kitalpha.transposer.ui.launch.TransposerConfigu rationType ">
<stringAttribute key="mapping_id" value="rds.capella.ecore.to.capella.id1"/>
<mapAttribute key="paramActivities">
<mapEntry key="org.polarsys.kitalpha.transposer.after.rule.execution" value=" org.polarsys.kitalpha.transposer.emf.toolbox.activities.mode ls.saver; "/>
<mapEntry key="org.polarsys.kitalpha.transposer.before.analysis" value=" org.polarsys.kitalpha.transposer.emf.toolbox.activities.mode ls.initializer:nsUri=http://www.polarsys.org/capella/core/modeller/1.3.0,EClass name=Library;"/>
<mapEntry key="org.polarsys.kitalpha.transposer.before.rule.execution " value=""/>
<mapEntry key="org.polarsys.kitalpha.transposer.before.scheduling" value=""/>
</mapAttribute>
<stringAttribute key="purpose_name" value="rds.capella.ecore.to.capella.mapping"/>
</launchConfiguration>

Can somebody help me with encoding of the result file?
How the encoding (UTF-8) of Capella xml file can be specified in launch configuration?
The default one is ASCII.
Re: Transform XSD (via Ecore) to Capella Data Model [message #3234 is a reply to message #3233] Mon, 27 May 2019 14:24 Go to previous messageGo to next message
dsryzhov.gmail.com is currently offline  dsryzhov.gmail.com
Messages: 80
Registered: February 2015
Member
Was able to chenge encoding to UTF-8 but did not solve my problem.

In the package transformation rule added encoding for resource.

ResourceSet res = (ResourceSet) context_p.get(ResourceUtil.TRANSPOSER_RESOURCE_SET); //get the EMF ResourceSet
Resource resource = res.getResources().get(0); // get the first
org.eclipse.emf.ecore.xmi.XMLResource xml_resource;
xml_resource = (org.eclipse.emf.ecore.xmi.XMLResource) resource;
xml_resource.setEncoding("UTF-8");


Annotation in my ecore model contains non-ASCII characters. When added to Capella model they are not present in result xml file.
There is no such problem with ASCCI annotations transformations.
Re: Transform XSD (via Ecore) to Capella Data Model [message #3236 is a reply to message #3234] Mon, 27 May 2019 14:40 Go to previous messageGo to next message
felix.dorner.gmail.com is currently offline  felix.dorner.gmail.com
Messages: 117
Registered: November 2015
Senior Member
IIRC the setEncoding() does nothing but actually set the value of the encoding attribute. You must still make sure that the streams that are used to read/write your files are using the proper encoding themselves.
Re: Transform XSD (via Ecore) to Capella Data Model [message #3249 is a reply to message #3236] Thu, 30 May 2019 13:47 Go to previous message
dsryzhov.gmail.com is currently offline  dsryzhov.gmail.com
Messages: 80
Registered: February 2015
Member
In fact xml_resource.setEncoding("UTF-8"); have solved my problem.
Previous Topic: VPDSL ecore package capitalized
Next Topic: Capella project -> ecore -> generation stubs for new viewpoint
Goto Forum:
  


Current Time: Sat Mar 28 04:02:50 EST 2020

Total time taken to generate the page: 0.01608 seconds