Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: kline on July 05, 2005, 05:14:56 am
-
Please help!
I have a UML class (Case) that has two UML associations to the same class (Party). These associations have different role names, distinguishing the 'company' from the 'applicant'.
Whenever I try to generate an XSD for this from EA 5, no matter how I alter the various tagged values for the XSD, the UML association rolenames do not appear in the schema. Instead, I get the following:
<xs:complexType name="Case">
<xs:sequence>
<xs:element ref="Party" minOccurs="0"/>
<xs:element ref="Party" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
How do I get EA to (correctly) generate an XSD that distinguishes each Party by its role name?
I've read through the 'XML Schema Generation' documentation, and it implies that what I want should be the default, but it isn't what I'm seeing.
Regards
Kline
-
Hi kline,
Set the value for the tag anonymousRole as "false" and anonymousType as "true" at the "Connector Source" and generate the schema.
You should get an output like :
<xs:complexType name="Case">
<xs:sequence>
<xs:element name="applicant" type="Party"/>
<xs:element name="company" type="Party"/>
</xs:sequence>
</xs:complexType>
Cheers
-
???
Hi
I'm not sure what vkumar meant by 'connector source'. Are you referring to the 'Case' as the connector source?
I've followed vkumar's instructions, but, no matter where I put them, the tagged value values have no effect on the XSD generation. I've tried several different approaches (see below), but none of them worked. EA seems to completely ignore the tag values and stubbornly produces the following (incorrect) XSD:
<xs:complexType name="Case">
<xs:sequence>
<xs:element ref="Party" minOccurs="0"/>
<xs:element ref="Party" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
Ironically, I've not had the same problems in EA4.1, where it worked just fine, thank you very much.
I have to make a purchase decision next week and until I can get this to work, I won't be able to justify the purchase of EA to my boss, so I need to get this working.
Here's the context for my attempts:
1. EA Program Version: 5.00.767
Not Registered - 30 day trial version (I'm not going to buy the bloody tool if it doesn't do what its supposed to!)
2. I imported the XSD data types XMI in XSDDataTypes.xml (downloaded from Sparx Systems site)
3. I imported the UML Profile for XML from XSDProfile.xml (downloaded from Sparx Systems site)
4. I have created a package called 'Test', which I refer to as the parent package, below. This package contains two classes (Case and Party). The following two associations exist between case and party:
- Case-Party, where Party has a target role of 'company' and multiplicity '0..1', and
- Case-Party, where Party has a target role of 'applicant' and multiplitiy '0..1'.
Here's a list of my attempts. (To be certain that I was starting from a 'clean' version of EA, I re-installed the trial version of EA5 before doing anything.)
During Attempts 1 and 2 I used the 'Code Engineering' two-step approach - first I transformed the parent package and then I code generated the XSD from the XSD stereotyped sub-package generated by the code transform.
During Attempt 3, I used code generated to XSD directly from the parent package.
Attempt 1:
1. I used 'Transform Current Package' and selected XSD.
2. EA generated a sub-package with the expected XSD stereotype tags.
3. I added the following tags to the 'Case' class:
- anonymousRole (set to false), and
- anonymousType (set to true)
4. I used 'Code Engineering -> Generate XML Schema' to generate the XSD.
5. When I examined the generated XSD, it was the same, wrong schema (see above.)
6. I deleted the sub-package generated by 'Transform Current Package', deleted the parent package, saved the model and then re-created the parent package and its contents.
Attempt 2:
1. I used 'Transform Current Package' and selected XSD.
2. EA generated a sub-package with the expected XSD stereotype tags.
3. I added the following tags to this sub-package:
- anonymousRole (set to false), and
- anonymousType (set to true)
4. I used 'Code Engineering -> Generate XML Schema' to generate the XSD.
5. When I examined the generated XSD, it was the same, wrong schema (see above.)
6. I deleted the sub-package generated by 'Transform Current Package', deleted the parent package, saved the model and then re-created the parent package and its contents.
Attempt 3:
1. I added the following tags to the 'Case' class:
- anonymousRole (set to false), and
- anonymousType (set to true)
2. I used 'Code Engineering -> Generate XML Schema' to generate the XSD.
3. When I examined the generated XSD, it was the same, wrong schema (see above.)
4. I deleted the sub-package generated by 'Transform Current Package', deleted the parent package, saved the model and then re-created the parent package and its contents.
Attempt 4:
1. I added the following tags to the parent package ('Test'):
- anonymousRole (set to false), and
- anonymousType (set to true)
2. I used 'Code Engineering -> Generate XML Schema' to generate the XSD.
3. When I examined the generated XSD, it was the same, wrong schema (see above.)
4. I deleted the sub-package generated by 'Transform Current Package', deleted the parent package, saved the model and then re-created the parent package and its contents.
Regards
Kline
-
Hi All
VKumar has sorted me out. Here's the details of his solution:
The tagged-values should be added to the connector - not to the class or the sub-package.
"Connector Source" implies one end of the association.
Follow the steps to set the tagged-values :
1. Select one of the connectors (lets say, the association with role 'company').
2. Goto its tagged-values window ( if the tagged-values window is not already visible, then goto: View -> Other Windows ->Tagged Values )
3. Since it's an association, you will see three classifications in the tagged-values window - Association, Connector Source and Connector Target.
4. Select 'Connector Source'.
5. Press Ctrl + N (to create a new tagged-values)
6. Create two tagged values with their values as:
anonymousRole - false
anonymousType - true
Follow the above steps to set the tagged-value for the other connector and generate the XSD.
Right now, you need to set these tagged-values to generate an XSD. But from Build 770, EA will generate it by default.
Regards
Kline