Book a Demo

Author Topic: Schema Composer: how to create simple types?  (Read 6550 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Schema Composer: how to create simple types?
« on: November 04, 2015, 07:45:50 pm »
Hi,

We haven been asked to provide our logical data model as an XSD to an implementor.
I started looking at the new Schema Composer, as it seems to be designed for tasks like this.

The first try was rather successful, but now I'm a bit stuck with the datatypes we defined.
For example we have a datatype called GUID_Type. In XSD this should look like this:
Code: [Select]
<xs:simpleType name="GUID_Type">
      <xs:restriction base="xs:string">
            <xs:pattern value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"/>
      </xs:restriction>
</xs:simpleType>
But all I get from the Schema composer is
Code: [Select]
<xs:complexType name="GUID_Type">
      <xs:sequence/>
</xs:complexType>

Is there any way I can tell the schema composer to translate my datatype as a simpleType?

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Schema Composer: how to create simple types?
« Reply #1 on: November 05, 2015, 09:40:04 am »
I'm not sure if the generic schema profile provides any way to do this. (From what I can see, it only emits a simpleType for enumerations)

I know that at least one of the other profiles does export simpleTypes and the facets (such as pattern) on them. But then they have profiles etc that allow that additional information to be defined.

How are you trying to model it? If it's generally applicable we could get the generator extended.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Schema Composer: how to create simple types?
« Reply #2 on: November 05, 2015, 02:59:55 pm »
The first idea was to model them as Datatypes.
I'm not sure yet on how to define which XML datatype it extends, and how to define the restriction.

After playing around a bit I've decided to use the XSD transformation instead.
Our use case is that we need to provide the whole data model as an XSD on a weekly basis.
In the Schema composer there's really no practical way to export all classes in a package (you have to click on the "all" button for each class).
Its gets worse if you have to do it again the week afterwards. I haven't found a practical way to produce an updated schema that reflects the changes in the data model, except for starting all over again.

Furthermore we had issues resolving primitive types such as Date and DateTime to the proper xs: datatypes. It sometimes worked for things like String and Integer, but we never got it working for DateTime.

There are issues with the XSD transformation as well, but at least I can fix those in the transformation macro myself (I'll send you a bug report about the issues with the XSD transformation macro next week)

Geert

Rodrigo Nascimento

  • EA User
  • **
  • Posts: 33
  • Karma: +3/-0
    • View Profile
Re: Schema Composer: how to create simple types?
« Reply #3 on: November 07, 2015, 01:40:58 am »
Hi Geert,

What is the main reason you are providing the logical data model as an XSD? are they building and application based on this model? or are they using as a reference for interoperability (i.e. APIs)?

If you are providing the entire logical data model as XSD, I would probably recommend to use the old Schema Generator. I found the Schema Composer very useful to create schema subsets (usually used as message models in systems integration - APIs, SOA...).

Regarding the XSD transformation (I believe you are talking about MDA Transformation), I usually have to customise the datatypes mapping according to the clients rules (i.e. sometimes clients want to simplify the datatype translation to a specific technology - e.g. all numeric types translated to xs:decimal), so the sparx original template needs to be customised.

I wrote few articles about deriving XSD models from Enterprise Information/Data Models, using both old XSD Schema Generator and the new Schema Composer:

http://connection.rnascimento.com

I'm also writing a new article about Schema Composer extension... as I had to customise it to clients' needs.

Cheers,
Rod
Please check my blog for more EA related articles!

http://connection.rnascimento.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Schema Composer: how to create simple types?
« Reply #4 on: November 07, 2015, 04:23:18 pm »
Thanks Rod,

I don't know the exact details, but the implementor is building a service layer in something they call "Software AG"  (which is more of a software company then a product I guess).
They can either build the data model manually with this tool, or import it using an XSD file.

We have now using the classic approach with the MDA transformation to an XSD model and then generating that to XSD.

I'm looking forward to your Schema Composer extension article. I might be doing the same thing for another customer shortly.

Geert

Rodrigo Nascimento

  • EA User
  • **
  • Posts: 33
  • Karma: +3/-0
    • View Profile
Re: Schema Composer: how to create simple types?
« Reply #5 on: December 07, 2015, 08:51:49 pm »
Here is the promised article about extending Schema Composer:

http://connection.rnascimento.com/2015/12/03/extending-sparx-ea-schema-composer/

Regards,
Rod
Please check my blog for more EA related articles!

http://connection.rnascimento.com