ATL Transformation and invalid names saved on annotations [message #1716306] |
Wed, 02 December 2015 19:12 |
Humberto Carvalho 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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02755 seconds