UML Profiles

Having not managed to solve my earlier problem relating to schema develoment in VP I have had a closer look at the UML profile that is being used.

Now please correct me if I am wrong, but the XSD stereotype side of things looks a little weird when compared back to the profile that I use with System Architect - there are no tagged values and a number of other differences.

So, can anyone tell me if there is a process to import a new profile into VP or do I have to edit the inbuilt stereotypes by hand?

Cheers

T

Hello TobyAnscombe,

Thank you for your post. I regret that we do not support importing UML profile currently. Could you provide us with some samples, so that we can study if we can support importing the UML profile you have?

Best regards,
Jick

Jick - Attached is the UML profile that I would normally use with SA.

In essence it is the stereotypes and the tagged values that interest me the most.

My workflow is to design a logical object model using classes first which act as placeholders for the logical development. In this phase an “object” can either be a true object or it may be an attribute - all I am doing is modeling the information sets that the Business Architecture highlights.

The second phase is to start to add attributes and stereotypes to the model, at this point it is still has a high level of inheritance with generalisations being used left, right and center.

The third phase is to use ORM to flatten back a number of classes into a normalized set of packages (Street, Town, City, Postcode, Country will be flattened back to a generic Address class). This allows me to keep a base conceptual model and to derive a number of logical views depending on the business process.

Finally I will transform the logical models into XML schema so that they can form the basis of a messaging model used by developers.

As I work in the EA space I have a responsibility to provide message definitions that are backed up by both a logical and conceptual models.
XSDProfile.xml

Hello TobyAnscombe,

Actually we also support importing and exporting stereotypes. But the structuring of elements in the exported file is different from yours. I attached a sample XML file for you as reference.

Best regards,
Jick
SampleStereotypes.xml

So if I re-phrased the XML file to include the stereotpyes and the tagged values then the XML generation routines would take these into account?

As I mentioned in an earlier message my background is in XML rather than UML - the one thing that I cannot do at the moment is to create named datatypes with restrictions for things like a string(20) or enabling facets such as restrictions which is really hindering me.

I don’t want to move back over to SA as it means that I have to go back to using windows - the sole reason for my purchase of VP was the fact that it supports OSX.

I had a look at MagicDraw last night and it may do what I require, its just rather expensive!

Hello TobyAnscombe,

Thanks for your reply. I will discuss with our developers and come back to you.

Best regards,
Jick

Hello TobyAnscombe,

I just reviewed your post and realized that you may want to add tagged values to the predefined XSD stereotypes, is it? If yes, please follow the steps below:

  1. Select Tools > Configure Stereotypes… from the main menu
  2. Expand the model element tree to reach Class -> Attribute
  3. Select one of the XSD stereotype and press Edit
  4. Edit the tagged value definitions from the 2nd tab

I hope this is what you were looking for. Sorry to keep you waiting.

Best regards,
Jick

Hi Jick,

Thanks for the reply; what I am trying to do is to model my XML schema in UML and then use the instant reverse to generate. For the XML stereotypes what I want to be able to do is to specify that a class should be created as xs:simpletype and to be able to add in the xs:restriction to be either xs:string or xs:int etc. Then, once that is working add in things facets ending up with something like this:

<xs:simpleType name="test">
	<xs:restriction base="xs:string">
		<xs:length value="55"/>
	</xs:restriction>
</xs:simpleType>

Whilst I can see that there is no direct support for it I am currently re-writing the InstantReverse code to my own specification (at the moment it is creating things like this:

<xs:complexType name="Age">
	<xs:sequence>
		<xs:element name="Age_Measure" type="ns0:AgeMeasureClass" minOccurs="0">
			<xs:annotation>
				<xs:documentation><![CDATA[

The means of denoting the unit in which the Body Description Age From and Age To Measure are expressed.
]]></xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name=“Higher_Age” type=“ns1:PersonAgeMeasure” minOccurs=“0”>
xs:annotation
xs:documentation</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name=“Lower_Age” type=“ns1:PersonAgeMeasure” minOccurs=“0”>
xs:annotation
xs:documentation</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>

From looking at what is avalible there are two ways to allow me to produce simpletypes and thus allow full modeling in UML:

  1. This feature is added to a future release - I am sure that it will come…

or

  1. I continue to use modified InstantGenerator templates to achieve what I want.

I have no issue with doing it myself but I could do with the following answers:

Is it possible to check a classes stereotype from the code? the samples and guide posted http://tinyurl.com/2oh74k seems to indicate that there are no operations that can be performed on stereotypes. If there is then I can script to check for a custom stereotype and then use tagged values to provide the facet information.

Or…do your developers have a better method? or am I trying to achive the impossible? I know that I can achive it through xslt on an XMI but I would rather keep it all in the app to make it consistent!

Obviously I will contribute the resulting instant generator code back to the community so that others can go down the same route; MDA is the way forward!

Hi TobyAnscombe,

Sorry to keep you waiting. Let me talk to our engineers and come back to you.

For not having operations for stereotype, stereotype only extends Object ( has getDocumentation(), getName() ), and have no extra operations. Do you mean that you want to support getting the tagged values for a stereotype?

Best regards,
Jick

I can code it to check for tagged values if that is the only option

Hi TobyAnscombe,

We are thinking of making the XSD able to be modeled, and of course to be able to generate code eventually. I will let you know if we have any conclusion.

Best regards,
Jick

If you want someone to help you evaluate both the process and the tool then please let me know; I have a considerable amount of experience in both XML and UML modeling and would be willing to help…

Hi TobyAnscombe,

Thank you very much. I will certainly let you know when we have done something to solve your problem.

Best regards,
Jick

Jick - I have sufficient confidence that I have just upgraded to the pro version as I can takle the other aspect in the interim…

I have now run into another problem which may help to highlight what I am trying to achive; it may be a limitation of UML that I am not aware of;-)

From my class diagram I have created an ERD. Obviously when the Entities are created they are created with string, int etc lengths being created to some default value. Int has a length of 10, string is varchar(255) etc.

What I need to be able to do is to go through and for each database entity to reflect our corporate model lengths in the column data types.

Thus, from the model I can create a database where the types for each column are complaint to our corporate model and can then generate a set of schema which developers can code against and provide a lingua franca for message integration in a Service Oriented Architecture environment. For example I may have a database field called SURNAME which is a varchar(50) - when I come to generate the XSD for the interface it has a maxLength facet of 50, any simple data errors are trapped at the schema and it removes a substantial amount of error checking in the application.

Some more of the business logic can then be implemented through RelaxNG at the schema level and thus allowing business rules to be placed outside of the application code which means that a very simple validation routine is required in the interface with the bulk of the work being done by an XML parser.

Make sense?

Hello TobyAnscombe,

Can I conclude by saying that you want to generate XSD from ERD, by including information like facet, which can be “derived” from the entities in ERD? If yes, I have 1 question.

When generating XSD, content can be formed by both the class model and entity model. Just like the case you suggested, you can create the class diagram first, and then the ERD, which result in having 2 models - class and data models. So which model to follow become a question. Can I suggest that, we form the XSD content by referring to class model, and then for information that cannot be found from class model, like length, as you suggested, we try to find from the entities.

If you agree with this approach, we will start our work. Please let me know about your thinking. Thank you.

Best regards,
Jick

Hi Jick,

That would be a great solution; I know that I am pushing the envelope a bit as to what the product will do but I think that it will be a good selling point; Design your DB, code and interface specs all from the same tool thus keeping everything in sync for a particular project.

Please drop me a line if you want any more info or some examples of what I am doing.

Thanks TobyAnscombe,

We will develop this feature first, and then let you know.

Best regards,
Jick

Hello TobyAnscombe,

Our engineers have raised several questions when discussing the changes that we should make.

  1. For modeling XSD, how “far” would you expect us to support? Just xsd:restriction (adding facet…)?

  2. For considering the ER model when generating XSD, we wonder if it is a perfect idea because numeric type in XSD usually use a min/max restriction which cannot obtain from ERD (while Length for string makes sense).

Best regards,
Jick

Hi Jick,

1 - a simple restriction (aka adding facets to ensure that the data type in the schema matches the data type in the database) is exactly what I am after.

2 - You raise a god point. It would work well for strings but as I have raised previously it would require the use of tagged values or similar in the class model to achive min/max lengths for numeric data items.

It all depends if this is something that you wish to include in a future version of the product or service pack. If it is just for me then I would be happy just to have a maxLength assigned to a string. If it is something that you think would be worthy of inclusion into the overall product then I would suggest that tagged values or the ability to assign stereotypes to a class with tagged values could be used. To this end, if the generation API http://tinyurl.com/2oh74k for classes supported getStereoTypes() as a collection with an associated iterator method then you could spin through the stereotypes, look for xs:maxLength, xs:minLength, xs:Length for strings xs:totalDigits, xs:minIncl, xs:maxIncl etc for numerics and so on.

Thus, you are making the stereotypes work for you - you already have the bulk of the stereotypes required in the box already.

My preferred route would be to make the code generation routine API broader so that you can customize the generation for both code and XSD’s. However, if I am the only one who wants this functionality then I don’t expect it! It would take a significant amount of development by your teams which seems a little pointless for just one customer…

By the way, Please call me Toby! I would like to applaud you for the level of support that you as a company offer, in todays climate it is a refreshing change and one that I am very greatful for.

TobyAnscombe, I will discuss with our engineers. Thanks for your feedback.