[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt.uml2] How to load MagicDraw .uml file?

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_METAMODEL_NS_URI, UMLPackage.eINSTANCE);


resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().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.resources_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__z05i9Ed6q1qHohKbyGg"


<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#Integer"/>
</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_161profileApplicationModel1">
<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.profile.uml#_2AJCtJi9Ed6q1qHohKbyGg"/>
</eAnnotations>
<appliedProfile href="UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.profile.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__z05i9Ed6q1qHohKbyGg"/>
</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#_2AJArZi9Ed6q1qHohKbyGg"/>
</eAnnotations>
<appliedProfile href="UML_Standard_Profile.Validation_Profile.profile.uml#_11_5_f720368_1159529670215_231387_1"/>
</profileApplication>
<profileApplication xmi:id="_9_0_be00301_1108050582343_527400_10847profileApplicationModel1">
<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-85i9Ed6q1qHohKbyGg"/>
</eAnnotations>
<appliedProfile href="UML_Standard_Profile.UML_Standard_Profile.profile.uml#_9_0_be00301_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