Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: JayHollingsworth on August 26, 2014, 12:54:44 am
-
I'm trying to do something I thought would be really simple.
In EA I should be able to create an enumeration which is a specialization of any XSD simple type.
If I drag a Simple Type from the XMLSchema toolbox onto the canvas, then drag an Enum from the same toolbox onto the canvas and make its type the Simple Type just created the model fails validation. It says
MVR050002 - error (<anonymous> (Generalization)): Generalization is not legal for Enumeration1 --> SimpleType1
Validation complete - 1 error(s), 0 warning(s)
What am I doing wrong?
-
Try to reverse engineer it from an actual xml schema and see what EA makes of it.
Geert
-
Thanks for your reply. I tried what you suggested. If you import the following trivially simple XML schema it produces the UML I expect, but it won't validate.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="SimpleType1">
<xs:restriction base="xs:string">
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Enumeration1">
<xs:restriction base="SimpleType1">
<xs:enumeration value="enum1"/>
<xs:enumeration value="enum2"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
I have no idea what I'm doing wrong.
-
Ah, I see what you mean.
The model validation you are using validates the model against UML syntax rules.
And indeed, a enumeration that inherits from a class is probably a UML syntax error.
However, you shouldn't validate your XML shema model with the UML syntax rules. You aren't using plain UML, but an xml schema profile. So the model should be validated using the rules of the profile. (which aren't available)
Geert
PS. If the profile was really well written it would define it's own version of enumeration and not re-use the UML enumeration since apparently a different set of rules apply.
-
Thanks.
That is a problem. In UML, an enumeration is a special Data Type, not a specialization of a Class. In EA class diagrams you can't make an Enumeration a specialization of a Class (drawing the line fails).
But the XML Schema import tool creates just that. It maps an XML simple type to a class rather than a UML data type, which would be a valid parent for an enumeration.
I guess I'll have to configure the UML validator to turn off the generalization error message and hope I don't miss out on some other errors it would be good to catch.
Anyway, thanks for your help.
-
That is a problem. In UML, an enumeration is a special Data Type, not a specialization of a Class. In EA class diagrams you can't make an Enumeration a specialization of a Class (drawing the line fails).
You can, but then you have to turn the "strict UML syntax" option off
(Options|Diagram) but I just noticed that it seems to have disappeared from version 11 ?!?
Geert
-
You can, but then you have to turn the "strict UML syntax" option off
(Options|Diagram) but I just noticed that it seems to have disappeared from version 11 ?!?
It's always been on the links page. It has however been renamed in v12 as it is also being used to suppress BPMN validation at creation time.
-
I just looked at my co-workers pc, which still has EA v10, and there the "strict UML syntax" option is clearly on the Diagram page of the options.
On my v11 I do find a "strict connector syntax" option in the links, which supposedly does the same thing.
Now EA is really making it difficult for us. Not only moving an option, but renaming it at the same time :-?
Geert
-
Incidentally, the new Strict Connector Syntax checkbox on the Links page doesn't stop the validator from seeing this (<<enumeration>> as a specialization of a <<XSDsimpleType>>) as incorrect, even though it is correct per XML.