Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Read OMG XMI resources with profile applications but w/o Ecore extensions
Read OMG XMI resources with profile applications but w/o Ecore extensions [message #599568] Fri, 16 March 2007 14:09
Peter Ellsiepen is currently offline Peter EllsiepenFriend
Messages: 19
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------010401040609020908080409
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I'm trying to write a converter that takes models from MagicDraw 12.x
(UML 2.0/XMI 2.1) and produces models in OMG XMI 2.1 for UML 2.1.1
format that can be read into Eclipse/UML2 2.x. [Note that I cannot use
MagicDraw's EMF XMI v1.x exporter for various reasons (it only supports
Eclipse/UML2 1.x, it requires the MagicDraw runtime and it re-writes all
xmi:id's such that I cannot trace back to my original model - only to
name a few).]

Converting the model itself is fairly straightforward since I "only"
need to translate the differences from UML 2.0 to UML 2.1.1. However,
I'm having a hard time converting profiles and applied stereotypes in
the models.

To do this I need to understand the exact mechanism for applying
profiles in OMG XMI files such that Eclipse/UML2 understands it and can
read the UML models *together* with the applied profiles. Note that I'm
fairly into XMI (since version 1.0) and UML (since version 1.2) and all
the different versions (XMI vs. MOF vs. UML vs. Eclipse/UML2 etc.), so I
think I understand all the issues about metamodels, profiles and so on.
Here is my problem:

Following, the article at
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html,
I managed to create a sample profile and model using the UML2 editor,
which largely resembles my original MagicDraw models in structure
(top-level XMI element and Data model, etc.). Then I saved both as OMG
XMI (by specifying the *.xmi extension in the Save As dialogue). Now my
problem is that even in the model stored as XMI the profile/stereotype
application only works if the Ecore extension "defining" the profile
exists at the beginning of the profile XMI file. Now obviously this is
specific to EMF/UML2 and should not be required when reading OMG XMI
models and profiles.

Attached I put my hand-crafted model and profile (in *.xmi format). As I
said, I would like to get this modified in such a way that the profile
does not have the Ecore extensions anymore and the model does not need
to reference the "contents" element in the Ecore extension at the
beginning via "xsi:schemaLocation" (apparently the "schema" of the
profile [NB: I know XML Schema but could not find a similarity here.]).
And obviously the stripped model and profile should still load into
Eclipse/UML2 with the stereotype(s) correctly applied.

Any help is greatly appreciated since I'm currently stuck.

Cheers, Peter

--------------010401040609020908080409
Content-Type: text/xml;
name="Model1.xmi"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Model1.xmi"

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Profile1="http:///schemas/Profile1/_rxXaUIDBEduPAOPCzCKebg/0" xmlns:Standard="http://schema.omg.org/spec/UML/2.1.1/StandardProfileL2" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://schema.omg.org/spec/UML/2.1.1" xsi:schemaLocation="http:///schemas/Profile1/_rxXaUIDBEduPAOPCzCKebg/0 Profile1.profile.xmi#_rxdg8IDBEduPAOPCzCKebg http://schema.omg.org/spec/UML/2.1.1/StandardProfileL2 http://schema.omg.org/spec/UML/2.1.1/StandardProfileL2.xmi#_ yzU58YinEdqtvbnfB2L_5w http://schema.omg.org/spec/UML/2.1.1 http://www.eclipse.org/uml2/2.0.0/UML">
<uml:Model xmi:id="_4uqT0H4nEdu2y_kSW8x_lA" name="Data">
<ownedComment xmi:type="uml:Comment" xmi:id="_Of5QEH5rEduZRZF7VtoXrg" annotatedElement="_4uqT0H4nEdu2y_kSW8x_lA">
<body>blabla</body>
</ownedComment>
<packagedElement xmi:type="uml:Package" xmi:id="_1W4jEIDBEduPAOPCzCKebg" name="Package1">
<packagedElement xmi:type="uml:Package" xmi:id="_mWUhwIEgEduPAOPCzCKebg" name="NestedPackage2">
<packagedElement xmi:type="uml:Class" xmi:id="_oNOZAIEgEduPAOPCzCKebg" name="ClassInNestedPackage"/>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_swg-AIEgEduPAOPCzCKebg">
<xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_swg-AYEgEduPAOPCzCKebg" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="Profile1.profile.xmi#_rxdg8IDBEduPAOPCzCKebg"/>
</eAnnotations>
</xmi:Extension>
<appliedProfile xmi:type="uml:Profile" href="Profile1.profile.xmi#_LtC68IBNEduYpP3CXp-3Mw"/>
</profileApplication>
</packagedElement>
<packagedElement xmi:type="uml:Class" xmi:id="_9e4hkH4nEdu2y_kSW8x_lA" name="Class1"/>
<packagedElement xmi:type="uml:Class" xmi:id="_DqpmMIEbEduPAOPCzCKebg" name="Class2"/>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4GPFQIDBEduPAOPCzCKebg">
<appliedProfile xmi:type="uml:Profile" href="Profile1.profile.xmi#_LtC68IBNEduYpP3CXp-3Mw"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_C9SJ4IEbEduPAOPCzCKebg">
<appliedProfile xmi:type="uml:Profile" href=" http://schema.omg.org/spec/UML/2.1.1/StandardProfileL2.xmi#_ 0"/>
</profileApplication>
</packagedElement>
</uml:Model>
<Profile1:Functional xmi:id="_5P9tcIDBEduPAOPCzCKebg" base_Class="_9e4hkH4nEdu2y_kSW8x_lA"/>
<Profile1:Functional xmi:id="_KfVz0IEgEduPAOPCzCKebg" base_Class="_DqpmMIEbEduPAOPCzCKebg"/>
<Profile1:Functional xmi:id="_tm2wIIEgEduPAOPCzCKebg" base_Class="_oNOZAIEgEduPAOPCzCKebg"/>
<Standard:Auxiliary xmi:id="_Ggl4kIEbEduPAOPCzCKebg" base_Class="_DqpmMIEbEduPAOPCzCKebg"/>
</xmi:XMI>

--------------010401040609020908080409
Content-Type: text/xml;
name="Profile1.profile.xmi"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Profile1.profile.xmi"

<?xml version="1.0" encoding="UTF-8"?>
<uml:Profile xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://schema.omg.org/spec/UML/2.1.1" xsi:schemaLocation="http://schema.omg.org/spec/UML/2.1.1 http://www.eclipse.org/uml2/2.0.0/UML" xmi:id="_LtC68IBNEduYpP3CXp-3Mw" name="Profile1" metaclassReference="_R0jrwIBNEduYpP3CXp-3Mw" metamodelReference="_QTL_oIBNEduYpP3CXp-3Mw">
<xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_rxXaUYDBEduPAOPCzCKebg" source="http://www.eclipse.org/uml2/2.0.0/UML">
<contents xmi:type="ecore:EPackage" xmi:id="_rxdg8IDBEduPAOPCzCKebg" name="Profile1" nsURI="http:///schemas/Profile1/_rxXaUIDBEduPAOPCzCKebg/0" nsPrefix="Profile1">
<eClassifiers xmi:type="ecore:EClass" xmi:id="_rxdg8YDBEduPAOPCzCKebg" name="Functional">
<xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_rxdg8oDBEduPAOPCzCKebg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_Ueka8IBNEduYpP3CXp-3Mw"/>
</xmi:Extension>
<eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_rxdg84DBEduPAOPCzCKebg" name="base_Class" ordered="false" lowerBound="1">
<eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/2.0.0/UML#//Class"/>
</eStructuralFeatures>
</eClassifiers>
</contents>
</eAnnotations>
</xmi:Extension>
<elementImport xmi:type="uml:ElementImport" xmi:id="_R0jrwIBNEduYpP3CXp-3Mw">
<importedElement xmi:type="uml:Class" href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#Class"/>
</elementImport>
<packageImport xmi:type="uml:PackageImport" xmi:id="_QTL_oIBNEduYpP3CXp-3Mw">
<importedPackage xmi:type="uml:Model" href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#_0"/>
</packageImport>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_Ueka8IBNEduYpP3CXp-3Mw" name="Functional">
<ownedAttribute xmi:type="uml:Property" xmi:id="_XsB1coBNEduYpP3CXp-3Mw" name="base_Class" association="_XsB1cIBNEduYpP3CXp-3Mw">
<type xmi:type="uml:Class" href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#Class"/>
</ownedAttribute>
<icon xmi:type="uml:Image" xmi:id="EOperation-_icon.0" location="../icons/full/ovr16/EOperation.gif"/>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_XsB1cIBNEduYpP3CXp-3Mw" name="Class_Stereotype1" memberEnd="_XsB1cYBNEduYpP3CXp-3Mw _XsB1coBNEduYpP3CXp-3Mw">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_XsB1cYBNEduYpP3CXp-3Mw" name="extension_Stereotype1" type="_Ueka8IBNEduYpP3CXp-3Mw" aggregation="composite" association="_XsB1cIBNEduYpP3CXp-3Mw"/>
</packagedElement>
</uml:Profile>

--------------010401040609020908080409--
Previous Topic:How to model "Exception throwing" for operartion in uml 2 class diagram
Next Topic:problem extending "Getting Started with UML2"
Goto Forum:
  


Current Time: Thu Nov 27 00:15:06 GMT 2014

Powered by FUDForum. Page generated in 0.05848 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software