Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: dannodj on January 26, 2010, 10:18:21 pm

Title: control of PSM for XSD generation
Post by: dannodj on January 26, 2010, 10:18:21 pm
Hi,

I am looking into using EA to support XSD generation, and the support for PIM / PSM conversion and xsd generation looks promising.  

However what I would like to be able to do is modify the following properties of the PSM model, forward generate a schema and then ensure that changes to the PIM do not overwrite the changes to the PSM when I re-run the model transform.
 
- CamelCase the Class and attribute names and strip out '_'
- Specify Navigability to control hierarchy in schema
- Map PIM datatypes to W3C xsd datatypes
- Change names of associations to control element names in schema.

From what I can see when I change names of associations, they get overwritten by the model transform, and specifying the navigability doesn't reliably ensure the creation of the schema hierarchy.

Can you  help with any of the above
Thanks
Dan
Title: Re: control of PSM for XSD generation
Post by: Christhonie on April 10, 2010, 02:24:27 am
Hi Dan,

If you have not found answers yet, or if someone else might have the same questions, here are some solutions to your problems;

So far we have not found a way not to overwrite values in subsequent transforms.  Only when you do not set a field in a transform will it remain untouched.

The camel case and replacement can be achieved by modifying the transformation templates.  I.e. To CamelCase the Class name you might want to do this in the Class template:

Code: [Select]
Class
{
  name=%qt%%CONVERT_NAME(className,"pascal case", "Camel Case")%%qt%
  %TRANSFORM_CURRENT("name")%
}

To map PIM to XSD types you can define it under Settings->Code Datatypes.  This require the use of the %CONVERT_TYPE()% function macro within the transformation templates.  We have implemented a more elaborate scheme where we defined our own "Primitive Data Types" and mapped those, using specific connectors, to XSD primitive types, imported from the XSD XMI file found on the Sparx website and using a special add-in which is called from the transform template.  We have reasons for doing it this way, which is out of scope here.

Chris