Book a Demo

Author Topic: XSD Generation and Relationships  (Read 8198 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
XSD Generation and Relationships
« on: February 19, 2018, 11:06:33 am »
We are experimenting with XSD round-tripping (but principally generation).  With RDBMS round-tripping there is the option of suppressing or including relationships are part of the process.

We have noticed that if we try and "visualise" the relationships between the XSD componentry (via composition and other relationships) when we generate we find an entry for the attribute and an entry for the relationship.  In the example below, the entries where the name and the type are the same are from the relationship, the others are from the attribute.
Is there any way to suppress/control the use of relationships?
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="Message">
<xs:sequence>
<xs:element name="Header" type="StandardMessageHeader" minOccurs="1" maxOccurs="1"/>
<xs:element name="Status" type="StandardStatusMetadata" minOccurs="1" maxOccurs="1"/>
<xs:element name="Payload" type="MessageSpecificPayload" minOccurs="1" maxOccurs="1"/>
<xs:element name="StandardMessageHeader" type="StandardMessageHeader" minOccurs="1" maxOccurs="1"/>
<xs:element name="StandardStatusMetadata" type="StandardStatusMetadata" minOccurs="1" maxOccurs="1"/>
<xs:element name="MessageSpecificPayload" type="MessageSpecificPayload" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MessageSpecificPayload">
<xs:sequence>
<xs:element name="element1" minOccurs="1" maxOccurs="1"/>
<xs:element name="element2" minOccurs="1" maxOccurs="1"/>
<xs:element name="element3" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="StandardMessageHeader">
<xs:sequence>
<xs:element name="element1" minOccurs="1" maxOccurs="1"/>
<xs:element name="element2" minOccurs="1" maxOccurs="1"/>
<xs:element name="element3" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="StandardStatusMetadata">
<xs:sequence>
<xs:element name="element1" minOccurs="1" maxOccurs="1"/>
<xs:element name="element2" minOccurs="1" maxOccurs="1"/>
<xs:element name="element3" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Elpis

  • EA User
  • **
  • Posts: 64
  • Karma: +7/-0
  • Make MDA/MBSE vital.
    • View Profile
Re: XSD Generation and Relationships
« Reply #1 on: February 28, 2018, 09:14:16 am »
If I understand you correctly, you want to use relationships only for "visualising" what is already specified in model by element attributes and its types.
I suggest to use non-association connectors for such visualising-only purpose - "Dependancy", for example, or more specialized, like Trace. They are not 'transfered' to generated XSD. For better model understanding, you can decorate such a connector (or one of it's end) with specific name or custom stereotype ("<<XSD.composition>>", for example).

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: XSD Generation and Relationships
« Reply #2 on: February 28, 2018, 10:33:16 am »
Thanks, Elpis, we came to the same conclusion.  We ended up using the serving relationship.

However, reviewing our requirements for XSD construction and specification, we are developing our own generator and so can use the correct (we believe) composition relationship between the XSD component structures.

Paoo

Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: XSD Generation and Relationships
« Reply #3 on: February 28, 2018, 06:01:29 pm »
Just a note: be careful when adding relations (even trace relations) to a model that will be used to generate XSD's.
I've seen it slow down the generation process considerably (something like 20 minutes instead of 40 seconds)

For some reason it seems to first see the relations at a certain level, decide to ignore them, and then start over again from the beginning, to see the relations at the next level, decide to ignore them, and .... you get the picture. ;D

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: XSD Generation and Relationships
« Reply #4 on: March 01, 2018, 10:34:55 am »
Just a note: be careful when adding relations (even trace relations) to a model that will be used to generate XSD's.
I've seen it slow down the generation process considerably (something like 20 minutes instead of 40 seconds)

For some reason it seems to first see the relations at a certain level, decide to ignore them, and then start over again from the beginning, to see the relations at the next level, decide to ignore them, and .... you get the picture. ;D

Geert
One of the reasons we're writing our own generator.   ;)
It will do exactly what we need and hook into our own MDG.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: XSD Generation and Relationships
« Reply #5 on: March 01, 2018, 06:15:54 pm »
There is no defined 1:1 relation between XSD and UML. We wrote our own generator and importer for that reason (for a famous "clean air motor" company here). We did put in quite some effort and it worked quite well. Probably that could be a product of its own since it's so complex.

q.

George

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: XSD Generation and Relationships
« Reply #6 on: March 06, 2018, 08:11:47 pm »
Regarding the association between element/attribute and its type, we use connector type "Dependency". When importing XSD into model, we use the option “Import XSD elements/attributes as UML attributes”. Then we run a script which generates the dependency connectors between attributes with their types. This way one can achieve both, complete view of the classes/types with all attributes (incl. their order in sequence!) and also visualization of the relationships, that everyone is likely to want.
« Last Edit: March 07, 2018, 12:44:22 am by George »