Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » How to load MagicDraw .uml file?
How to load MagicDraw .uml file? [message #483976] Thu, 03 September 2009 19:43 Go to next message
Scott is currently offline ScottFriend
Messages: 33
Registered: July 2009
Member
Hi,
I have hard time to load a MagicDraw (16.5) .uml file.
I followed most threads about this topic but still with no luck.

I’m not sure if it’s a big or small issue. Here is the code I’m struggling
with, can anyone please help?

=======
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(UML212UMLResource.UML_M ETAMODEL_NS_URI,
UMLPackage.eINSTANCE);

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
URI uri =
URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
uri.appendSegment("profiles").appendSegment(""));

Resource model = resourceSet.getResource(URI.createURI(inputFile), true);
==========

And here is the .uml file I want to load:

==========
<?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:MagicDrawProfile="http:///schemas/MagicDrawProfile/_1_2C0Ji9Ed6q1qHohKbyGg/0"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"

xsi:schemaLocation="http:///schemas/MagicDrawProfile/_1_2C0Ji9Ed6q1qHohKbyGg/0
UML_Standard_Profile.MagicDraw_Profile.profile.uml#_1__z05i9 Ed6q1qHohKbyGg "
>

<uml:Model xmi:id="eee_1045467100313_135436_1" name="Model1"
viewpoint="">
<ownedComment xmi:id="_16_5_3_abd02bc_1251701109265_804173_327"
body="Author:Scott.&#xA;Created:8/31/09 2:45
AM.&#xA;Title:.&#xA;Comment:.&#xA;"
annotatedElement="eee_1045467100313_135436_1"/>
<packageImport xmi:id="_0primitiveTypesModel1">
<importedPackage xmi:type="uml:Model"
href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>

<packageImport xmi:id="_0javaPrimitiveTypesModel1">
<importedPackage xmi:type="uml:Model"
href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
</packageImport>

<packagedElement xmi:type="uml:Class"
xmi:id="_16_5_3_abd02bc_1251701135265_504936_485" name="Party">
<ownedAttribute xmi:id="_16_5_3_abd02bc_1252003262984_28701_344"
name="id" visibility="private">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedAttribute>
</packagedElement>

<packagedElement xmi:type="uml:Class"
xmi:id="_16_5_3_abd02bc_1251701181265_269840_527" name="Person">
<generalization xmi:id="_16_5_3_abd02bc_1251701230265_212164_567"
isSubstitutable="true" general="_16_5_3_abd02bc_1251701135265_504936_485"/>
<ownedAttribute xmi:id="_16_5_3_abd02bc_1252003424078_454269_346"
name="firstName" visibility="private">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedAttribute>
<ownedAttribute xmi:id="_16_5_3_abd02bc_1252003476765_223420_348"
name="lastName" visibility="private">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedAttribute>
</packagedElement>

<packagedElement xmi:type="uml:Class"
xmi:id="_16_5_3_abd02bc_1251701207828_514562_547" name="Organization">
<generalization xmi:id="_16_5_3_abd02bc_1251701234796_430688_570"
isSubstitutable="true" general="_16_5_3_abd02bc_1251701135265_504936_485"/>
<ownedAttribute xmi:id="_16_5_3_abd02bc_1252003514750_486856_350"
name="type" visibility="private">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedAttribute>
<ownedAttribute xmi:id="_16_5_3_abd02bc_1252003533921_850191_352"
name="taxId" visibility="private">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Intege r"/>
</ownedAttribute>
</packagedElement>

<packagedElement xmi:type="uml:Package"
xmi:id="magicdraw_uml_standard_profile_v_0001" name="UML Standard Profile">
<ownedComment xmi:id="_be00301_1078843546940_242228_131" body="UML
Standard Profile contains several popular stereotypes, tag definitions and
constraints described in UML 2 Specifications."
annotatedElement="magicdraw_uml_standard_profile_v_0001"/>
</packagedElement>

<profileApplication
xmi:id=" _11_5_be00301_1153310565718_226811_161profileApplicationMode l1 ">
<eAnnotations xmi:id="_2AJDhJi9Ed6q1qHohKbyGg"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_2AJCtJi9Ed6q1qHohKbyGg "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_11_5_be00301_1153310565718_226811_161 "/>
</profileApplication>

<profileApplication
xmi:id="_be00301_1073394351331_445580_2profileApplicationModel1 ">
<eAnnotations xmi:id="_2ASuwZi9Ed6q1qHohKbyGg"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_1__z05i9 Ed6q1qHohKbyGg "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_ 1073394351331_445580_2 "/>
</profileApplication>

<profileApplication
xmi:id=" _11_5_f720368_1159529670215_231387_1profileApplicationModel1 ">
<eAnnotations xmi:id="_2ASuw5i9Ed6q1qHohKbyGg"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.Validation_Profile.profile.uml#_2AJArZi 9Ed6q1qHohKbyGg "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.Validation_Profile.profile.uml#_11_5_f7 20368_1159529670215_231387_1 "/>
</profileApplication>

<profileApplication
xmi:id=" _9_0_be00301_1108050582343_527400_10847profileApplicationMod el1 ">
<eAnnotations xmi:id="_2ASuxZi9Ed6q1qHohKbyGg"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_2AI-8 5i9Ed6q1qHohKbyGg "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_9_0_b e00301_1108050582343_527400_10847 "/>
</profileApplication>
</uml:Model>

<MagicDrawProfile:auxiliaryResource xmi:id="_2FW1Dpi9Ed6q1qHohKbyGg"
base_Element="magicdraw_uml_standard_profile_v_0001"
base_Package="magicdraw_uml_standard_profile_v_0001"/>
</xmi:XMI>
===========


Thanks,

Scott
Re: How to load MagicDraw .uml file? [message #483990 is a reply to message #483976] Thu, 03 September 2009 20:24 Go to previous messageGo to next message
Tim Myer is currently offline Tim MyerFriend
Messages: 81
Registered: July 2009
Member
Hi Scott,
From a cursory glance at your snippet, it looks like you are trying to
load the .uml file in stand-alone mode, the .uml file has dependencies
on MagicDraw profiles, but your Java code is not registering the
MagicDraw paths in the URI map. Are you able to load the .uml file in
MagicDraw? Are you able to open the .uml file when you are running Eclipse?
I tried opening this file in Eclipse (without the MagicDraw plugins
installed), and I get errors that the MagicDraw-specific profiles cannot
be located. Is that the problem you are seeing? Do you have access the
MagicDraw resources in a .jar (similar to the uml.resources jar below),
and do you need to register this jar and the MagicDraw pathmaps
similarly to how you are registering the UML resource pathmaps below?

Just a thought,
---Tim---

Scott wrote:
> Hi,
> I have hard time to load a MagicDraw (16.5) .uml file.
> I followed most threads about this topic but still with no luck.
>
> I�m not sure if it�s a big or small issue. Here is the code I�m
> struggling with, can anyone please help?
>
> =======
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getPackageRegistry().put(UML212UMLResource.UML_M ETAMODEL_NS_URI,
> UMLPackage.eINSTANCE);
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri =
> URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
>
> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));
>
> Resource model = resourceSet.getResource(URI.createURI(inputFile), true);
> ==========
>
> And here is the .uml file I want to load:
>
> ==========
> <?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:MagicDrawProfile="http:///schemas/MagicDrawProfile/_1_2C0Ji9Ed6q1qHohKbyGg/0"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
> xsi:schemaLocation="http:///schemas/MagicDrawProfile/_1_2C0Ji9Ed6q1qHohKbyGg/0
> UML_Standard_Profile.MagicDraw_Profile.profile.uml#_1__z05i9 Ed6q1qHohKbyGg "
>>
>
> <uml:Model xmi:id="eee_1045467100313_135436_1" name="Model1" viewpoint="">
> <ownedComment xmi:id="_16_5_3_abd02bc_1251701109265_804173_327"
> body="Author:Scott.&#xA;Created:8/31/09 2:45
> AM.&#xA;Title:.&#xA;Comment:.&#xA;"
> annotatedElement="eee_1045467100313_135436_1"/>
> <packageImport xmi:id="_0primitiveTypesModel1">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0javaPrimitiveTypesModel1">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Class"
> xmi:id="_16_5_3_abd02bc_1251701135265_504936_485" name="Party">
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003262984_28701_344"
> name="id" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Class"
> xmi:id="_16_5_3_abd02bc_1251701181265_269840_527" name="Person">
> <generalization xmi:id="_16_5_3_abd02bc_1251701230265_212164_567"
> isSubstitutable="true" general="_16_5_3_abd02bc_1251701135265_504936_485"/>
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003424078_454269_346"
> name="firstName" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003476765_223420_348"
> name="lastName" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Class"
> xmi:id="_16_5_3_abd02bc_1251701207828_514562_547" name="Organization">
> <generalization xmi:id="_16_5_3_abd02bc_1251701234796_430688_570"
> isSubstitutable="true" general="_16_5_3_abd02bc_1251701135265_504936_485"/>
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003514750_486856_350"
> name="type" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003533921_850191_352"
> name="taxId" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Intege r"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Package"
> xmi:id="magicdraw_uml_standard_profile_v_0001" name="UML Standard Profile">
> <ownedComment xmi:id="_be00301_1078843546940_242228_131" body="UML
> Standard Profile contains several popular stereotypes, tag definitions
> and constraints described in UML 2 Specifications."
> annotatedElement="magicdraw_uml_standard_profile_v_0001"/>
> </packagedElement>
> <profileApplication
> xmi:id=" _11_5_be00301_1153310565718_226811_161profileApplicationMode l1 ">
> <eAnnotations xmi:id="_2AJDhJi9Ed6q1qHohKbyGg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_2AJCtJi9Ed6q1qHohKbyGg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_11_5_be00301_1153310565718_226811_161 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id="_be00301_1073394351331_445580_2profileApplicationModel1 ">
> <eAnnotations xmi:id="_2ASuwZi9Ed6q1qHohKbyGg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_1__z05i9 Ed6q1qHohKbyGg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_ 1073394351331_445580_2 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id=" _11_5_f720368_1159529670215_231387_1profileApplicationModel1 ">
> <eAnnotations xmi:id="_2ASuw5i9Ed6q1qHohKbyGg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.Validation_Profile.profile.uml#_2AJArZi 9Ed6q1qHohKbyGg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.Validation_Profile.profile.uml#_11_5_f7 20368_1159529670215_231387_1 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id=" _9_0_be00301_1108050582343_527400_10847profileApplicationMod el1 ">
> <eAnnotations xmi:id="_2ASuxZi9Ed6q1qHohKbyGg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_2AI-8 5i9Ed6q1qHohKbyGg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_9_0_b e00301_1108050582343_527400_10847 "/>
>
> </profileApplication>
> </uml:Model>
>
> <MagicDrawProfile:auxiliaryResource xmi:id="_2FW1Dpi9Ed6q1qHohKbyGg"
> base_Element="magicdraw_uml_standard_profile_v_0001"
> base_Package="magicdraw_uml_standard_profile_v_0001"/>
> </xmi:XMI>
> ===========
>
>
> Thanks,
>
> Scott
>
>
Re: How to load MagicDraw .uml file? [message #484076 is a reply to message #483990] Fri, 04 September 2009 08:28 Go to previous messageGo to next message
Scott is currently offline ScottFriend
Messages: 33
Registered: July 2009
Member
Hi Tim,
Thanks for your quick reply.
It opened some other issues as following:

I created uml diagram in MagicDraw and exported as EMF UML 2.1, then 5
files were generated;
Model1.uml
UML_Standard_Profile.UML_Standard_Profile.profile.uml
UML_Standard_Profile.MagicDraw_Profile.profile.uml
UML_Standard_Profile.Validation_Profile.profile.uml
UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml

My data file is “Model1.uml”, and I think the other 4 files are the
dependencies. So, how to register/load these other 4 files?

I was able to find MD uml.resources jar and register it as following:
URI uri =
URI.createURI(" jar:file:/C:/MD-16.5/org.eclipse.uml2.uml.resources_2.0.3.ja r!/ ");

I tried opening “Model1.uml” in Eclipse (without the MagicDraw plugins
installed), and got java.lang.NullPointerException

If I omit/comment the last three profiles (in Model1.uml):
UML_Standard_Profile.MagicDraw_Profile.profile.uml
UML_Standard_Profile.Validation_Profile.profile.uml
UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml

And the line of:

<MagicDrawProfile:auxiliaryResource xmi:id="_2FW1Dpi9Ed6q1qHohKbyGg"
base_Element="magicdraw_uml_standard_profile_v_0001"
base_Package="magicdraw_uml_standard_profile_v_0001"/>

Then, I can load “Model1.uml” in Eclipse, but without data types, all
elements are XML AnyTypeImpl

If solving this problem is complicated, can you please point out to some
references to read?


Thanks,

Scott
Re: How to load MagicDraw .uml file? [message #484609 is a reply to message #484076] Tue, 08 September 2009 13:47 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
There is an effort going on at the OMG that address' interoperability:
http://www.omgwiki.org/model-interchange/doku.php?id=start

One of the issues with interchanging profiles is that the opensource
implementation expects a "defined" version of the profile (ecore
representation). Commercial tools build additional handling on top of the
opensource implementation to handle the various differences.

- James.


"Scott " <scottgraham03@gmail.com> wrote in message
news:85d1477a69a9ff12c805edb4fd54ca83$1@www.eclipse.org...
> Hi Tim,
> Thanks for your quick reply.
> It opened some other issues as following:
>
> I created uml diagram in MagicDraw and exported as EMF UML 2.1, then 5
> files were generated;
> Model1.uml
> UML_Standard_Profile.UML_Standard_Profile.profile.uml
> UML_Standard_Profile.MagicDraw_Profile.profile.uml
> UML_Standard_Profile.Validation_Profile.profile.uml
> UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml
>
> My data file is
Re: How to load MagicDraw .uml file? [message #627926 is a reply to message #483976] Thu, 03 September 2009 20:24 Go to previous message
Tim Myer is currently offline Tim MyerFriend
Messages: 81
Registered: July 2009
Member
Hi Scott,
From a cursory glance at your snippet, it looks like you are trying to
load the .uml file in stand-alone mode, the .uml file has dependencies
on MagicDraw profiles, but your Java code is not registering the
MagicDraw paths in the URI map. Are you able to load the .uml file in
MagicDraw? Are you able to open the .uml file when you are running Eclipse?
I tried opening this file in Eclipse (without the MagicDraw plugins
installed), and I get errors that the MagicDraw-specific profiles cannot
be located. Is that the problem you are seeing? Do you have access the
MagicDraw resources in a .jar (similar to the uml.resources jar below),
and do you need to register this jar and the MagicDraw pathmaps
similarly to how you are registering the UML resource pathmaps below?

Just a thought,
---Tim---

Scott wrote:
> Hi,
> I have hard time to load a MagicDraw (16.5) .uml file.
> I followed most threads about this topic but still with no luck.
>
> I�m not sure if it�s a big or small issue. Here is the code I�m
> struggling with, can anyone please help?
>
> =======
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getPackageRegistry().put(UML212UMLResource.UML_M ETAMODEL_NS_URI,
> UMLPackage.eINSTANCE);
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri =
> URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
>
> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));
>
> Resource model = resourceSet.getResource(URI.createURI(inputFile), true);
> ==========
>
> And here is the .uml file I want to load:
>
> ==========
> <?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:MagicDrawProfile="http:///schemas/MagicDrawProfile/_1_2C0Ji9Ed6q1qHohKbyGg/0"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
> xsi:schemaLocation="http:///schemas/MagicDrawProfile/_1_2C0Ji9Ed6q1qHohKbyGg/0
> UML_Standard_Profile.MagicDraw_Profile.profile.uml#_1__z05i9 Ed6q1qHohKbyGg "
>>
>
> <uml:Model xmi:id="eee_1045467100313_135436_1" name="Model1" viewpoint="">
> <ownedComment xmi:id="_16_5_3_abd02bc_1251701109265_804173_327"
> body="Author:Scott.&#xA;Created:8/31/09 2:45
> AM.&#xA;Title:.&#xA;Comment:.&#xA;"
> annotatedElement="eee_1045467100313_135436_1"/>
> <packageImport xmi:id="_0primitiveTypesModel1">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0javaPrimitiveTypesModel1">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Class"
> xmi:id="_16_5_3_abd02bc_1251701135265_504936_485" name="Party">
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003262984_28701_344"
> name="id" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Class"
> xmi:id="_16_5_3_abd02bc_1251701181265_269840_527" name="Person">
> <generalization xmi:id="_16_5_3_abd02bc_1251701230265_212164_567"
> isSubstitutable="true" general="_16_5_3_abd02bc_1251701135265_504936_485"/>
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003424078_454269_346"
> name="firstName" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003476765_223420_348"
> name="lastName" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Class"
> xmi:id="_16_5_3_abd02bc_1251701207828_514562_547" name="Organization">
> <generalization xmi:id="_16_5_3_abd02bc_1251701234796_430688_570"
> isSubstitutable="true" general="_16_5_3_abd02bc_1251701135265_504936_485"/>
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003514750_486856_350"
> name="type" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_16_5_3_abd02bc_1252003533921_850191_352"
> name="taxId" visibility="private">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Intege r"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Package"
> xmi:id="magicdraw_uml_standard_profile_v_0001" name="UML Standard Profile">
> <ownedComment xmi:id="_be00301_1078843546940_242228_131" body="UML
> Standard Profile contains several popular stereotypes, tag definitions
> and constraints described in UML 2 Specifications."
> annotatedElement="magicdraw_uml_standard_profile_v_0001"/>
> </packagedElement>
> <profileApplication
> xmi:id=" _11_5_be00301_1153310565718_226811_161profileApplicationMode l1 ">
> <eAnnotations xmi:id="_2AJDhJi9Ed6q1qHohKbyGg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_2AJCtJi9Ed6q1qHohKbyGg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_11_5_be00301_1153310565718_226811_161 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id="_be00301_1073394351331_445580_2profileApplicationModel1 ">
> <eAnnotations xmi:id="_2ASuwZi9Ed6q1qHohKbyGg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_1__z05i9 Ed6q1qHohKbyGg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_ 1073394351331_445580_2 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id=" _11_5_f720368_1159529670215_231387_1profileApplicationModel1 ">
> <eAnnotations xmi:id="_2ASuw5i9Ed6q1qHohKbyGg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.Validation_Profile.profile.uml#_2AJArZi 9Ed6q1qHohKbyGg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.Validation_Profile.profile.uml#_11_5_f7 20368_1159529670215_231387_1 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id=" _9_0_be00301_1108050582343_527400_10847profileApplicationMod el1 ">
> <eAnnotations xmi:id="_2ASuxZi9Ed6q1qHohKbyGg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_2AI-8 5i9Ed6q1qHohKbyGg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_9_0_b e00301_1108050582343_527400_10847 "/>
>
> </profileApplication>
> </uml:Model>
>
> <MagicDrawProfile:auxiliaryResource xmi:id="_2FW1Dpi9Ed6q1qHohKbyGg"
> base_Element="magicdraw_uml_standard_profile_v_0001"
> base_Package="magicdraw_uml_standard_profile_v_0001"/>
> </xmi:XMI>
> ===========
>
>
> Thanks,
>
> Scott
>
>
Re: How to load MagicDraw .uml file? [message #627928 is a reply to message #483990] Fri, 04 September 2009 08:28 Go to previous message
Scott is currently offline ScottFriend
Messages: 33
Registered: July 2009
Member
Hi Tim,
Thanks for your quick reply.
It opened some other issues as following:

I created uml diagram in MagicDraw and exported as EMF UML 2.1, then 5
files were generated;
Model1.uml
UML_Standard_Profile.UML_Standard_Profile.profile.uml
UML_Standard_Profile.MagicDraw_Profile.profile.uml
UML_Standard_Profile.Validation_Profile.profile.uml
UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml

My data file is “Model1.uml”, and I think the other 4 files are the
dependencies. So, how to register/load these other 4 files?

I was able to find MD uml.resources jar and register it as following:
URI uri =
URI.createURI(" jar:file:/C:/MD-16.5/org.eclipse.uml2.uml.resources_2.0.3.ja r!/ ");

I tried opening “Model1.uml” in Eclipse (without the MagicDraw plugins
installed), and got java.lang.NullPointerException

If I omit/comment the last three profiles (in Model1.uml):
UML_Standard_Profile.MagicDraw_Profile.profile.uml
UML_Standard_Profile.Validation_Profile.profile.uml
UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml

And the line of:

<MagicDrawProfile:auxiliaryResource xmi:id="_2FW1Dpi9Ed6q1qHohKbyGg"
base_Element="magicdraw_uml_standard_profile_v_0001"
base_Package="magicdraw_uml_standard_profile_v_0001"/>

Then, I can load “Model1.uml” in Eclipse, but without data types, all
elements are XML AnyTypeImpl

If solving this problem is complicated, can you please point out to some
references to read?


Thanks,

Scott
Re: How to load MagicDraw .uml file? [message #627931 is a reply to message #484076] Tue, 08 September 2009 13:47 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
There is an effort going on at the OMG that address' interoperability:
http://www.omgwiki.org/model-interchange/doku.php?id=start

One of the issues with interchanging profiles is that the opensource
implementation expects a "defined" version of the profile (ecore
representation). Commercial tools build additional handling on top of the
opensource implementation to handle the various differences.

- James.


"Scott " <scottgraham03@gmail.com> wrote in message
news:85d1477a69a9ff12c805edb4fd54ca83$1@www.eclipse.org...
> Hi Tim,
> Thanks for your quick reply.
> It opened some other issues as following:
>
> I created uml diagram in MagicDraw and exported as EMF UML 2.1, then 5
> files were generated;
> Model1.uml
> UML_Standard_Profile.UML_Standard_Profile.profile.uml
> UML_Standard_Profile.MagicDraw_Profile.profile.uml
> UML_Standard_Profile.Validation_Profile.profile.uml
> UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml
>
> My data file is
Previous Topic:Multi-user editing/merging
Next Topic:Problems with DerivedUnion during deserialization
Goto Forum:
  


Current Time: Fri Nov 24 03:58:09 GMT 2017

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

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