Bug 150154 - [Plan Item] XML Primitive Types
Summary: [Plan Item] XML Primitive Types
Status: VERIFIED FIXED
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: M4   Edit
Assignee: James Bruck CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, plan
Depends on:
Blocks:
 
Reported: 2006-07-10 11:08 EDT by Kenn Hussey CLA
Modified: 2012-05-22 11:32 EDT (History)
1 user (show)

See Also:


Attachments
first crack at support (12.97 KB, patch)
2006-11-28 14:20 EST, James Bruck CLA
no flags Details | Diff
2 of 4 (61.18 KB, patch)
2006-11-28 14:20 EST, James Bruck CLA
no flags Details | Diff
3 of 4 (13.07 KB, patch)
2006-11-28 14:20 EST, James Bruck CLA
no flags Details | Diff
4 of 4 (10.76 KB, patch)
2006-11-28 14:21 EST, James Bruck CLA
no flags Details | Diff
Updated patch (34.08 KB, patch)
2006-11-29 13:43 EST, Kenn Hussey CLA
no flags Details | Diff
update with all mods (66.97 KB, patch)
2006-11-29 16:39 EST, James Bruck CLA
Kenn.Hussey: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenn Hussey CLA 2006-07-10 11:08:57 EDT
Provide a model library to represent the types defined in the XMLType metamodel in EMF; be sure to update the Ecore/UML converters to make use of this new library.
Comment 1 Dave Carlson CLA 2006-11-11 14:41:29 EST
I propose that the XML Schema datatype library be implemented using UML DataType instances (instead of Class or PrimitiveType).  The XSD datatype spec describes the built-in types as being a small number of "primitives" and the others as "derived".  Because the UML2 spec prohibits a DataType from subclassing a PrimitiveType, it is not possible to implement the XSD type inheritance with the base types as primitive.

In addition, when creating UML models of schema designs, it is natural to represent complexType with simple content (i.e. a complexType that extends a simpleType, then adds XML attributes) as a UML DataType with properties for the complexType attributes.  If the entire library of XSD built-in types were represented as PrimitiveType, then they cannot be extended with a DataType that adds attributes.
Comment 2 Kenn Hussey CLA 2006-11-15 11:11:14 EST
How would you expect your specialized data types (with additional attributes) to be handled when converting the UML model to/from Ecore (given that data types in Ecore cannot have attributes)?
Comment 3 Dave Carlson CLA 2006-11-15 12:37:04 EST
Not all UML models are converted to Ecore...  my primary use case (and that of the companies I am working with) is to create UML models of XML schema designs and to generate XSD from the models.  They mostly use JAXB 2.0 or XMLBeans for Java binding.

However, I would expect the Ecore conversion to be handled in the same way that Ecore models are created while importing these same kinds of structures from XSD.   The structures I am referring to here is a complexType that extends a simpleType and adds attributes, a.k.a complexType with simple content.  EMF import from schema does handle this, but I have not studied how it is done.
Comment 4 James Bruck CLA 2006-11-28 14:20:00 EST
Created attachment 54660 [details]
first crack at support
Comment 5 James Bruck CLA 2006-11-28 14:20:30 EST
Created attachment 54661 [details]
2 of 4
Comment 6 James Bruck CLA 2006-11-28 14:20:50 EST
Created attachment 54662 [details]
3 of 4
Comment 7 James Bruck CLA 2006-11-28 14:21:20 EST
Created attachment 54663 [details]
4 of 4
Comment 8 James Bruck CLA 2006-11-29 09:03:05 EST
Comment on attachment 54660 [details]
first crack at support

small modifications to come.
Comment 9 Dave Carlson CLA 2006-11-29 11:03:36 EST
Thanks, James.  I was planning to test this patch today but will wait for your modification.  Are these patches applied against HEAD?  

Will this library be delivered with a 2.0.x or 2.1 build?  The sooner the better for me.  I have my own XSDDataTypes library (using my XSD profile) but would like to change to this common library asap.
Comment 10 James Bruck CLA 2006-11-29 11:46:22 EST
Hi Dave,

After discussing in more detail with Kenn (and Kenn speaking with Ed Merks) I will be making more changes shortly. ( ie complex types going to EClass not EDataTypes)

I will be delivering to the 2.1 (head).  This feature is targeted for M4 but I expect that this will be ready to go in the next couple of days.

Regards,

- James.




Comment 11 Dave Carlson CLA 2006-11-29 12:02:15 EST
Can we add the Generalizations between DataTypes, as defined by baseType restrictions in the XSD schema for schemas?  This is very helpful for modeling tools that provide constraints on property types, e.g. must inherit from XSD String type.

I can help add these Generalizations to the library model if you like.
Comment 12 James Bruck CLA 2006-11-29 12:36:23 EST
I can add those generalizations in (I'll have to add support for creating those automatically anyway).
Comment 13 Kenn Hussey CLA 2006-11-29 13:43:13 EST
Created attachment 54732 [details]
Updated patch

Here is an updated patch based on the discussion I had with Ed. Basically, the XML types library will contain primitive types that have generalizations between them based on the baseType annotations from Ecore.
Comment 14 James Bruck CLA 2006-11-29 14:35:30 EST
Dave, please hold off on applying the latest patch ... there are very minor issues with the menu items and the resources need to be updated.
Comment 15 James Bruck CLA 2006-11-29 16:39:51 EST
Created attachment 54749 [details]
update with all mods
Comment 16 Kenn Hussey CLA 2006-11-30 00:30:59 EST
The changes have been committed to CVS.
Comment 17 James Bruck CLA 2006-11-30 10:35:27 EST
Dave,

The XML data types in question are marked as PrimitiveTypes.
To get the kind of complex types you are looking for you need to:
1. Create a DataType.
2. Stereotype your new data type with <EClass>
3. Set the XML Content Kind to Simple
4. Create a property
5. Type the property with a Primitive type
6. Streotype your property with EAttribute.
7. Set the featureKind to "Simple".


Converting such a uml model to .ecore will now produce the kind of model you expect and also converting from .ecore to .uml will work as you want.

Let us know if you have any issues.


Comment 18 James Bruck CLA 2006-11-30 16:06:00 EST
Available in build: I200611301324
From:  http://www.eclipse.org/modeling/mdt/downloads/?project=uml2-uml
Comment 19 Nick Boldt CLA 2008-01-28 16:36:30 EST
Move to verified as per bug 206558.