Author Topic: UML Class model to XSD  (Read 13379 times)

Andreas1975

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
UML Class model to XSD
« on: November 29, 2012, 08:14:30 pm »
Hi everyone.

I need to model a corporate information model, preferrably using UML Class modelling, since the knowledge skill of the informations modellers are primary that.
From the UML Class models I want to generate documentations and XSD's, as well as in the next steps generate external webservice documentations based upon that model / schemas.

Question is...
Is it possible to generate complete XSD Schemas from UML Class models including xsd attributes such as "maxLength", "totalDigits", "nillable" and so on ?, or do I have to model "the foundation" using the XML Schema profile?

My information modellers are well familiar with UML Class modelling, and I'm hoping to not be forced to have to teach them everything about XML Schema concepts.

best regards
Andreas

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13283
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: UML Class model to XSD
« Reply #1 on: November 29, 2012, 09:05:21 pm »
Andreas,

I've never tried so myself, but in theory you should be able to:
- Define a logical data model (regular classes, attributes, associations,...)
- Execute an MDA transformation to create an XSD model
- Generate the xsd from this XSD model.

The XSD model should contain all specific properties you need to manipulate the XSD.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13283
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: UML Class model to XSD
« Reply #2 on: November 29, 2012, 09:06:01 pm »
Andreas,

I've never tried so myself, but in theory you should be able to:
- Define a logical data model (regular classes, attributes, associations,...)
- Execute an MDA transformation to create an XSD model
- Generate the xsd from this XSD model.

The XSD model should contain all specific properties you need to manipulate the XSD.

Geert

salayande

  • EA User
  • **
  • Posts: 224
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: UML Class model to XSD
« Reply #3 on: December 01, 2012, 11:35:26 am »
Yes, you can and that is the best approach if you want to define an enterprise canonical model for implementation on the corporate enterprise service bus.

Process:

1. Define your information model
2. Generate your XSD model using the in-built transformation (I had to modify this to generate global XSDsimpletypes for maximum reuse)
3. Generate your schema files
4. The files are re-used as a library

Andreas1975

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: UML Class model to XSD
« Reply #4 on: December 03, 2012, 10:40:41 pm »
Thanks for the replies.

Will check this out in detail.

regards
Andreas

Andreas1975

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: UML Class model to XSD
« Reply #5 on: December 04, 2012, 01:39:42 am »
After spending a day of transforming back and forwards, please let me know if I got this right when trying to get a classdiagram attribute "maxLength" generated into the xml schema...

Directly generate this from standard class-diagram is not possible, since you cant modify the Code Generation Templates for XML Schema? (At least I couldnt find them in the dropdown list of all other code generation technlogies)

I have to explicit transform the model using MDA transformation, since it seems like a direct XML Schema Generation behind the scenes does not do MDA Generation (At least it doesnt pick up my changes to the templates)

I have to go through modifying the MDA transformation, creating SimpleTypes for all attributes, just to have things like "maxLength", "minLength" etc on the schema?

... What I really want is to modify the actual scripts creating the XSD.. - Is that possible?

regards
Andreas

« Last Edit: December 04, 2012, 01:42:05 am by Andreas1975 »

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: UML Class model to XSD
« Reply #6 on: December 04, 2012, 05:21:41 am »
Quote
... What I really want is to modify the actual scripts creating the XSD.. - Is that possible?

Seems that you can only adapt the transformation scripts to generate the UML XSD schema representation. See 'Settings->Transformation Templates'. Maybe a XSLT transformation applied after generating the actual XSD schema may help to adapt the results to your needs.

Otherwise this document may also be helpful: http://www.sparxsystems.com.au/downloads/resources/booklets/uml_code_engineering.pdf.

HTH
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Andreas1975

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: UML Class model to XSD
« Reply #7 on: December 06, 2012, 08:32:49 pm »
Great document! - Exactly what I was looking for.

thanks!

Andreas1975

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: UML Class model to XSD
« Reply #8 on: February 07, 2013, 09:59:53 pm »
Hi all.

Bumping up this old thread again - I've spent quite some time getting this to work.

I as well need to modify the MDA Transformation to create XSDsimpleType objects when transforming from Class model to XSD model.

I just cant figure out how to set the "type" attribute (string, short, etc) on the XSDsimpleType object in the transformation template?

salayande - How did you solve this?, anyone else?

thanks