Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » ATL Transformation and invalid names saved on annotations
ATL Transformation and invalid names saved on annotations [message #1716306] Wed, 02 December 2015 19:12 Go to next message
Humberto Carvalho is currently offline Humberto CarvalhoFriend
Messages: 6
Registered: September 2013
Junior Member
Hello !

I'm looking to transform my own model into an Ofbiz Entity Ecore model which has been reversed engineered from this XML schema:

ofbiz.apache.org/dtds/entitymodel.xsd



Entity FrameWork (my model) ----ATL----> Ofbiz EntityModel.

However the ofbiz entity model includes some invalid names, for example the entity node includes the entity-name attribute, which is renamed to entityName when reverse engineered. Additionally xml TAGS with text in them such as <description> text </description> become attributes of the parent node.

I've managed to produce instances of the ofbiz EntityModel which are correct by altering the ecore model factory implementation, and adding the following lines:

		
result.getDefaultLoadOptions().put(XMLResource.OPTION_RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS, Boolean.TRUE);


However i have no idea how to perform the same on ATL.

Here is the transformation code:
-- @path EntityFramework=/EntityFramework/model/entityFramework.ecore
-- @path EntityModel=/OfbizEntityModel/model/Entitymodel.ecore

module EntityFrameworkToOfbizService;
create OUT : EntityModel from IN : EntityFramework;
rule EFEntity2EMEntity {
	from
		s: EntityFramework!Entity
	to
		t: EntityModel!EntityType(
			entityName <- s.name,
			description  <- s.description,
			packageName <- s.package.name,
			field <- s.atributes
		)
}


Best Regards,
Humberto Carvalho
Re: ATL Transformation and invalid names saved on annotations [message #1716634 is a reply to message #1716306] Mon, 07 December 2015 04:21 Go to previous messageGo to next message
Humberto Carvalho is currently offline Humberto CarvalhoFriend
Messages: 6
Registered: September 2013
Junior Member
Bump, no one?

I was thinking maybe if ATL generates the model code, i could maybe edit the ATL source code and configure the resource factory to "RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS"
Re: ATL Transformation and invalid names saved on annotations [message #1716739 is a reply to message #1716634] Mon, 07 December 2015 21:39 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 350
Registered: September 2012
Location: Belgium
Senior Member

If you use the EMF namespace URIs to reference your metamodels in ATL, then ATL should already use your *ResourceFactoryImpl classes. Your example ATL code shows "@path" tags for the metamodels; these should be "@nsURI" tags ideally.

Cheers,
Dennis
Previous Topic:Promotion of XMI to Ecore
Next Topic:XML schema as source file
Goto Forum:
  


Current Time: Fri Sep 22 22:38:20 GMT 2017

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

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