Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » AM3 » KM3 <-> Ecore probelm(Datatypes lose their instanceClass property)
KM3 <-> Ecore probelm [message #634707] Fri, 22 October 2010 15:26 Go to next message
Arun  is currently offline Arun
Messages: 16
Registered: October 2010
Junior Member
Hi Guys,

In the Ecore mode i have the the following package defined

<ecore:EPackage name="PrimitiveTypes">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="java.lang.Boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="java.lang.Integer"/>
<eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
</ecore:EPackage>

When i perform "Extract ecore metamodel to KM3", I get the following:

package PrimitiveTypes {
datatype Boolean;
datatype Integer;
datatype String;
}

Now on the KM3 model, when I perform "Inject KM3 to Ecore metamodel", I get

<ecore:EPackage name="PrimitiveTypes">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean" />
<eClassifiers xsi:type="ecore:EDataType" name="Integer" />
<eClassifiers xsi:type="ecore:EDataType" name="String" />
</ecore:EPackage>

I lose the instanceClassName property for these eClassifier objects.

How do I fix this problem?

All suggestions are welcome.

regards
Arun Smile
Re: KM3 <-> Ecore probelm [message #634970 is a reply to message #634707] Mon, 25 October 2010 05:48 Go to previous messageGo to next message
Guillaume Doux is currently offline Guillaume Doux
Messages: 56
Registered: July 2009
Member
Hi Arun,

The behavior that you describe is the expected one when you convert Ecore to KM3 and back again to Ecore.

It is due to the fact that KM3 is not a textual Ecore specific language, It is more generic. It involves that the features which are not needed for KM3, such as the Java corresponding type for a datatype are lost. (It's also because KM3 could be implemented with .net for example and so the instance class type in Java will not work.)

So you need to add the instance class name yourself to the generated Ecore metamodel. (or maybe you can modify the KM3 injector to add this automatically)

I hope this explanation will help you.

Best regards,

Guillaume
Re: KM3 <-> Ecore probelm [message #635008 is a reply to message #634707] Mon, 25 October 2010 08:09 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 522
Registered: July 2009
Senior Member
There was a mechanism with an external file containing such informations allowing a bijectionnal transformation between KM3 and ecore. There was that datatypes case but also the namespace URI, the prefix and so on...

You have to call that file the same name as the .km3 or the .ecore with the extension ann.

Sample file :
annotate XXXX {
	annotate XXXX with
		nsURI='XXXX',
		nsPrefix='XXXX';

	annotate PrimitiveTypes with
		nsURI='XXXX-PrimitiveTypes',
		nsPrefix='pt';

	annotate "PrimitiveTypes::Boolean" with
		instanceClassName='boolean';

	annotate "PrimitiveTypes::Double" with
		instanceClassName='double';

	annotate "PrimitiveTypes::Integer" with
		instanceClassName='int';

	annotate "PrimitiveTypes::String" with
		instanceClassName='java.lang.String';
}
Re: KM3 <-> Ecore probelm [message #636771 is a reply to message #634707] Tue, 02 November 2010 13:47 Go to previous message
Arun  is currently offline Arun
Messages: 16
Registered: October 2010
Junior Member
Thanks guys!!

I will look into it.

regards
Arun
Previous Topic:Interesting problem
Next Topic:[AM3] Extending AM3 Metamodel
Goto Forum:
  


Current Time: Sat Jul 26 01:18:03 EDT 2014

Powered by FUDForum. Page generated in 0.16175 seconds