Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Load UML Model Standalone
Load UML Model Standalone [message #475573] Fri, 31 August 2007 07:54 Go to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hello,
I have created a simple class diagram with magic draw 12.5 and exported it
to EMF UML2 (v2.x).

Now I want to load the created *.uml model standalone with mdt uml2. While
trying to solve this task I get the following exception:
Exception in thread "main"
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
'http:///schemas/MagicDrawProfile/_V6VvkFeMEdyvu96OURhT_Q/0' not found.

How I have to register this package?
Re: Load UML Model Standalone [message #475575 is a reply to message #475573] Fri, 31 August 2007 10:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000904030408060306070901
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Matthias,

It sounds like these EMF FAQs:

2.17 I get a PackageNotFoundException: e.g., "Package with uri
'http://com.example.company.ecore' not found." What do I need to do?
< http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_PackageNot FoundException:_e.g..2C_.22Package_with_uri_.27http:.2F.2Fco m.example.company.ecore.27_not_found..22_What_do_I_need_to_d o.3F>
2.18 Do I have to pre-register my static, generated package when
running stand-alone (outside of Eclipse)?
< http://wiki.eclipse.org/index.php/EMF-FAQ#Do_I_have_to_pre-r egister_my_static.2C_generated_package_when_running_stand-al one_.28outside_of_Eclipse.29.3F>

Of course, being UML2, maybe this is solved some other way. It sounds
like your profile isn't being found so maybe you need to register that
profile like you would a dynamic package:

2.19 How do I register a dynamic package?
< http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_register_ a_dynamic_package.3F>


Matthias Krebber wrote:
> Hello,
> I have created a simple class diagram with magic draw 12.5 and
> exported it to EMF UML2 (v2.x).
>
> Now I want to load the created *.uml model standalone with mdt uml2.
> While trying to solve this task I get the following exception:
> Exception in thread "main"
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
> 'http:///schemas/MagicDrawProfile/_V6VvkFeMEdyvu96OURhT_Q/0' not found.
> How I have to register this package?
>


--------------000904030408060306070901
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
It sounds like these EMF FAQs:<br>
<blockquote><a style=""
href=" http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_PackageNot FoundException:_e.g..2C_.22Package_with_uri_.27http:.2F.2Fco m.example.company.ecore.27_not_found..22_What_do_I_need_to_d o.3F"><span
class="tocnumber">2.17</span> <span class="toctext">I get a
PackageNotFoundException: e.g., "Package with uri
'http://com.example.company.ecore' not found." What do I need to do?</span></a><br>
<a
href=" http://wiki.eclipse.org/index.php/EMF-FAQ#Do_I_have_to_pre-r egister_my_static.2C_generated_package_when_running_stand-al one_.28outside_of_Eclipse.29.3F"><span
class="tocnumber">2.18</span> <span class="toctext">Do I have to
pre-register my static, generated package when running stand-alone
(outside of Eclipse)?</span></a><br>
</blockquote>
Of course, being UML2, maybe this is solved some other way.
Re: Load UML Model Standalone [message #475576 is a reply to message #475575] Fri, 31 August 2007 12:59 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks for your reply,
I want to descripe my problem more precisely.

After exporting my test uml class diagram from magicdraw (functionality of
magic draw)I get the following files:
- UmlTest.uml
- UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml
- UML_Standard_Profile.MagicDraw_Profile.profile.uml
- UML_Standard_Profile.UML_Standard_Profile.profile.uml
- UML_Standard_Profile.Validation_Profile.profile.uml

The head of the created UmlTest model:
<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/_OgYtMFeREdyvu96OURhT_Q/0"
xmlns:UMLStandardProfile=" http:///schemas/UMLStandardProfile/_OgroIVeREdyvu96OURhT_Q/0"
xmlns:ValidationProfile="http:///schemas/ValidationProfile/_OgroIFeREdyvu96OURhT_Q/0"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
xsi:schemaLocation="http:///schemas/MagicDrawProfile/_OgYtMFeREdyvu96OURhT_Q/0
UML_Standard_Profile.MagicDraw_Profile.profile.uml#_Og1eg1eR Edyvu96OURhT_Q
http:///schemas/UMLStandardProfile/_OgroIVeREdyvu96OURhT_Q/0
UML_Standard_Profile.UML_Standard_Profile.profile.uml#_Og1ak 1eREdyvu96OURhT_Q
http:///schemas/ValidationProfile/_OgroIFeREdyvu96OURhT_Q/0
UML_Standard_Profile.Validation_Profile.profile.uml#_Og1cq1e REdyvu96OURhT_Q ">

I want to load this model standalone. How do I get the profile now in
order to register it like
EPackage.Registry.INSTANCE.put(companyPackage.getNsURI(), companyPackage);
?
Re: Load UML Model Standalone [message #475581 is a reply to message #475576] Fri, 31 August 2007 16:02 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Matthias,

If I'm not mistaken all you need to do is register a uri converter ...
something like

URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_ PATHMAP),
umlResourcePluginURI.appendSegment("profiles").appendSegment( ""));

Have a look at the serialized version of your model at the profile
application... you will see an annotation with reference to the actual
EPackage that points to the definition of your profile. With the proper
converter the href therein should be resolved.

Have a look at
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
near the bottom ( section called Programmatic Migration ) at the code that
runs standalone to set up your uri converter.

As a side note: from your profile application you can call
getAppliedDefinition() and getAppliedProfile() if you need to access the
definition.

Let me know if that works.

- James.

"Matthias Krebber" <jesus@rz.fh-augsburg.de> wrote in message
news:3f890c0041004d1180733b621d5e7d9d$1@www.eclipse.org...
> Thanks for your reply,
> I want to descripe my problem more precisely.
>
> After exporting my test uml class diagram from magicdraw (functionality of
> magic draw)I get the following files:
> - UmlTest.uml
> - UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml
> - UML_Standard_Profile.MagicDraw_Profile.profile.uml
> - UML_Standard_Profile.UML_Standard_Profile.profile.uml
> - UML_Standard_Profile.Validation_Profile.profile.uml
>
> The head of the created UmlTest model:
> <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/_OgYtMFeREdyvu96OURhT_Q/0"
> xmlns:UMLStandardProfile=" http:///schemas/UMLStandardProfile/_OgroIVeREdyvu96OURhT_Q/0"
> xmlns:ValidationProfile="http:///schemas/ValidationProfile/_OgroIFeREdyvu96OURhT_Q/0"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xsi:schemaLocation="http:///schemas/MagicDrawProfile/_OgYtMFeREdyvu96OURhT_Q/0
> UML_Standard_Profile.MagicDraw_Profile.profile.uml#_Og1eg1eR Edyvu96OURhT_Q
> http:///schemas/UMLStandardProfile/_OgroIVeREdyvu96OURhT_Q/0
> UML_Standard_Profile.UML_Standard_Profile.profile.uml#_Og1ak 1eREdyvu96OURhT_Q
> http:///schemas/ValidationProfile/_OgroIFeREdyvu96OURhT_Q/0
> UML_Standard_Profile.Validation_Profile.profile.uml#_Og1cq1e REdyvu96OURhT_Q ">
>
> I want to load this model standalone. How do I get the profile now in
> order to register it like
> EPackage.Registry.INSTANCE.put(companyPackage.getNsURI(), companyPackage);
> ?
Re: Load UML Model Standalone [message #475584 is a reply to message #475581] Sat, 01 September 2007 10:03 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
thank you for the reply.

I have already registered the URI Converter map.
My Code:
String umlResources = "jar:file:" + getUMLArchive(new
JarArchiveFileNameFilter("org.eclipse.uml2.uml.resources_")) + "!/";
String umlPluginUri = "jar:file:" + getUMLArchive(new
JarArchiveFileNameFilter("org.eclipse.ocl.uml_")) + "!/";

URIConverter.URI_MAP.put(URI.createURI("platform:/plugin/org.eclipse.uml2.uml/ "),
URI.createURI(umlPluginUri));

URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),URI.createURI(umlResources
+ "libraries/"));

URIConverter.URI_MAP.put(URI.createURI(UMLResource.METAMODEL S_PATHMAP),URI.createURI(umlResources
+ "/metamodels/"));

URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_ PATHMAP),URI.createURI(umlResources
+ "profiles/"));

I also already register the packages and file extensions like described in
UML2 migration.
But that doesnŽt work. I get the exception:
Package with uri
'http:///schemas/MagicDrawProfile/_V6VvkFeMEdyvu96OURhT_Q/0' not found
Re: Load UML Model Standalone [message #475586 is a reply to message #475584] Mon, 03 September 2007 04:11 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Matthias,

Can you open up the model with a text editor and look at the profile
application ( at the bottom of the file ). Please post the xml for that
profile application.

Cheers,
- James.


"Matthias Krebber" <jesus@rz.fh-augsburg.de> wrote in message
news:e287ec236c698e1b6cb936d35cfd53b6$1@www.eclipse.org...
> Hi,
> thank you for the reply.
>
> I have already registered the URI Converter map.
> My Code: String umlResources = "jar:file:" + getUMLArchive(new
> JarArchiveFileNameFilter("org.eclipse.uml2.uml.resources_")) + "!/";
> String umlPluginUri = "jar:file:" + getUMLArchive(new
> JarArchiveFileNameFilter("org.eclipse.ocl.uml_")) + "!/";
>
> URIConverter.URI_MAP.put(URI.createURI("platform:/plugin/org.eclipse.uml2.uml/ "),
> URI.createURI(umlPluginUri));
>
> URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),URI.createURI(umlResources
> + "libraries/"));
>
> URIConverter.URI_MAP.put(URI.createURI(UMLResource.METAMODEL S_PATHMAP),URI.createURI(umlResources
> + "/metamodels/"));
>
> URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_ PATHMAP),URI.createURI(umlResources
> + "profiles/"));
>
> I also already register the packages and file extensions like described in
> UML2 migration. But that doesn
Re: Load UML Model Standalone [message #475587 is a reply to message #475586] Mon, 03 September 2007 06:00 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
This is my test model I created with support of MagicDraw 12.5.

<?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/_V6VvkFeMEdyvu96OURhT_Q/0"
xmlns:UMLStandardProfile=" http:///schemas/UMLStandardProfile/_V6fgkVeMEdyvu96OURhT_Q/0"
xmlns:ValidationProfile="http:///schemas/ValidationProfile/_V6fgkFeMEdyvu96OURhT_Q/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/_V6VvkFeMEdyvu96OURhT_Q/0
UML_Standard_Profile.MagicDraw_Profile.profile.uml#_V6pW81eM Edyvu96OURhT_Q
http:///schemas/UMLStandardProfile/_V6fgkVeMEdyvu96OURhT_Q/0
UML_Standard_Profile.UML_Standard_Profile.profile.uml#_V6pRk 1eMEdyvu96OURhT_Q
http:///schemas/ValidationProfile/_V6fgkFeMEdyvu96OURhT_Q/0
UML_Standard_Profile.Validation_Profile.profile.uml#_V6pUjFe MEdyvu96OURhT_Q ">
<uml:Model xmi:id="eee_1045467100313_135436_1" name="Data">
<ownedComment xmi:id="_12_5_8ba027a_1188364696423_678121_98"
annotatedElement="eee_1045467100313_135436_1">
<body>Author:arkteb.
Created:29.08.07 07:18.
Title:.
Comment:.
</body>
</ownedComment>
<packageImport xmi:id="_0primitiveTypesData">
<importedPackage xmi:type="uml:Model"
href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packageImport xmi:id="_0javaPrimitiveTypesData">
<importedPackage xmi:type="uml:Model"
href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packagedElement xmi:type="uml:Package"
xmi:id="_12_5_8ba027a_1188364999105_478528_253" name="ocltest">
<packagedElement xmi:type="uml:Enumeration"
xmi:id="_12_5_8ba027a_1188365053648_783756_264" name="Color">
<ownedLiteral xmi:id="_12_5_8ba027a_1188365088621_942591_286"
name="+black"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365095800_582932_288"
name="+red"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365099439_367775_290"
name="+green"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365101430_633793_292"
name="+yellow"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365107578_335973_294"
name="+orange"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365111750_974980_296"
name="+brown"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365116659_644639_298"
name="+pink"/>
</packagedElement>
<packagedElement xmi:type="uml:Interface"
xmi:id="_12_5_8ba027a_1188365170548_380954_301" name="Edible">
<ownedAttribute xmi:id="_12_5_8ba027a_1188365191893_257223_322"
name="isTasty" visibility="public" isReadOnly="true"/>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188365260461_257763_325" name="Fruit"
clientDependency="_12_5_8ba027a_1188469080958_415966_270">
<ownedRule xmi:id="_12_5_8ba027a_1188368435951_241305_376"
name="not_black"
constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188368465592_295948_378" name="">
<language>OCL2.0</language>
<body>self.color &lt;> Color::black</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188368548062_984749_379"
name="not_foo" constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188368588719_789533_380" name="">
<language>OCL2.0</language>
<body>self.name &lt;> 'Foo'</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188368595703_324084_381"
name="not_pink"
constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188368620173_449061_382" name="">
<language>OCL2.0</language>
<body>self.color &lt;> Color::pink</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188370275338_160829_375"
name="friends_myFruit"
constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188370424739_97077_377" name="">
<language>OCL2.0</language>
<body>self.friends -> iterate(e; result : Sequence(String) =
Sequence{} | result -> append(e.name)) -> collectNested(toUpper()) ->
flatten () -> includes ('MY FRUIT')</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188374571194_748349_379"
name="operation_helper"
constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188374880532_777974_382" name="">
<language>OCL2.0</language>
<body>getOtherFruits(dummy : Boolean) : Set(Fruit) =
Fruit.allInstances() -> excluding (self)</body>
</specification>
</ownedRule>
<ownedAttribute xmi:id="_12_5_8ba027a_1188365277117_772420_347"
name="color" visibility="public"
type="_12_5_8ba027a_1188365053648_783756_264"/>
<ownedAttribute xmi:id="_12_5_8ba027a_1188365284723_183098_349"
name="name" visibility="public" isDerived="true">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<defaultValue xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188374461102_826835_245" name="">
<language>OCL2.0</language>
<body>if self.name.oclIsUndefined() then '' else
self.name</body>
</defaultValue>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188365308657_323089_353"
name="releatedFruit" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" isDerived="true">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188365326253_716488_356" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188365326253_667149_355" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188365326269_886449_357"
name="friends" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188365351833_403460_360" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188365351833_831642_359" name=""/>
</ownedAttribute>
<interfaceRealization
xmi:id="_12_5_8ba027a_1188469080958_415966_270" name=""
supplier="_12_5_8ba027a_1188365170548_380954_301"
client="_12_5_8ba027a_1188365260461_257763_325"
contract="_12_5_8ba027a_1188365170548_380954_301"/>
<ownedOperation xmi:id="_12_5_8ba027a_1188365448605_872382_419"
name="ripen" visibility="public" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188365763714_380834_421"
name="clolor" visibility="public"
type="_12_5_8ba027a_1188365053648_783756_264" direction="inout"/>
<ownedParameter xmi:id="_12_5_8ba027a_1188365763870_12124_422"
name="" visibility="public" direction="return">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Boolea n"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188365763870_408189_423"
name="preferredColor" visibility="public" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188365772361_517432_426"
name="" visibility="public" type="_12_5_8ba027a_1188365053648_783756_264"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188365772377_902198_427"
name="newFruit" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188365780054_836354_430"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188365780069_770619_431"
name="setColor" visibility="public">
<ownedParameter xmi:id="_12_5_8ba027a_1188365797036_871672_433"
name="fruit" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout"/>
<ownedParameter xmi:id="_12_5_8ba027a_1188365797036_125169_434"
name="newColor" visibility="public"
type="_12_5_8ba027a_1188365053648_783756_264" direction="inout"/>
</ownedOperation>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188366220308_910889_273" name="Apple">
<generalization xmi:id="_12_5_8ba027a_1188469097640_67981_286"
isSubstitutable="false" general="_12_5_8ba027a_1188365260461_257763_325"/>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366353019_835064_390"
name="tree" visibility="public"
type="_12_5_8ba027a_1188366248045_34995_296">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366370184_369064_393" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366370184_504519_392" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366370200_5298_394"
name="label" visibility="public">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366380615_136065_397" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366380615_537474_396" name=""/>
<defaultValue xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188387097252_976942_380" name="">
<body></body>
</defaultValue>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366380630_974260_398"
name="appleFriends" visibility="public"
type="_12_5_8ba027a_1188366220308_910889_273">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366398965_147714_401" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366398965_11083_400" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366957806_578362_637"
name="tree" visibility="public"
type="_12_5_8ba027a_1188366248045_34995_296"
association="_12_5_8ba027a_1188366957806_717587_636">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367087026_994843_708" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367087026_473426_707" name=""/>
</ownedAttribute>
<ownedOperation xmi:id="_12_5_8ba027a_1188366477436_708159_402"
name="label" visibility="public"
precondition="_12_5_8ba027a_1188371003435_168867_436
_12_5_8ba027a_1188371096544_923648_438"
postcondition="_12_5_8ba027a_1188371200074_697829_442
_12_5_8ba027a_1188371235574_528492_444">
<ownedRule xmi:id="_12_5_8ba027a_1188371003435_168867_436"
name="text_not_null">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371031904_159087_437" name="">
<language>OCL2.0</language>
<body>not text.oclIsUndefined()</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188371096544_923648_438"
name="text_not_label">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371130137_81793_439" name="">
<language>OCL2.0</language>
<body>text &lt;> self.label</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188371200074_697829_442"
name="label_is_set">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371219277_738796_443" name="">
<language>OCL2.0</language>
<body>self.label = text</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188371235574_528492_444"
name="label_is_changed">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371255683_830683_445" name="">
<language>OCL2.0</language>
<body>self.label &lt;> label@pre</body>
</specification>
</ownedRule>
<ownedParameter xmi:id="_12_5_8ba027a_1188366488675_294347_404"
name="text" visibility="public" direction="inout">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188366488691_858263_405"
name="newApple" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188366500133_419926_408"
name="" visibility="public" type="_12_5_8ba027a_1188366220308_910889_273"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188366500149_631618_409"
name="preferredLabel" visibility="public" isQuery="true"
bodyCondition="_12_5_8ba027a_1188371515330_669283_446">
<ownedRule xmi:id="_12_5_8ba027a_1188371515330_669283_446"
name="unnamed1">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371515330_411354_447" name="">
<language>OCL2.0</language>
<body>if text = self.label then '' else text endif</body>
</specification>
</ownedRule>
<ownedParameter xmi:id="_12_5_8ba027a_1188366509593_160993_411"
name="text" visibility="public" direction="inout">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188366509593_831147_412"
name="" visibility="public" direction="return">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedParameter>
</ownedOperation>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188366248045_34995_296" name="Tree">
<ownedAttribute xmi:id="_12_5_8ba027a_1188366649384_669520_417"
name="apples" visibility="public"
type="_12_5_8ba027a_1188366220308_910889_273">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366667446_266415_420" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366667446_276761_419" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366667446_111016_421"
name="height" visibility="public">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Intege r"/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366861724_279181_513"
name="forest" visibility="public"
type="_12_5_8ba027a_1188366268547_395671_319"
association="_12_5_8ba027a_1188366861724_20189_511">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367317508_921740_714" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367317508_64098_713" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366957806_74107_638"
name="apples" visibility="public"
type="_12_5_8ba027a_1188366220308_910889_273"
association="_12_5_8ba027a_1188366957806_717587_636">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367099937_846562_710" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367099937_258772_709" name=""/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188366268547_395671_319" name="Forest">
<ownedAttribute xmi:id="_12_5_8ba027a_1188366610358_200385_413"
name="trees" visibility="public"
type="_12_5_8ba027a_1188366248045_34995_296">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366622831_230526_416" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366622831_665587_415" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366861724_326944_512"
name="trees" visibility="public"
type="_12_5_8ba027a_1188366248045_34995_296" aggregation="shared"
association="_12_5_8ba027a_1188366861724_20189_511">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367306022_961251_712" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367306022_685842_711" name=""/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:PrimitiveType"
xmi:id="_12_5_8ba027a_1188366703584_150043_434" name="Real"/>
<packagedElement xmi:type="uml:Association"
xmi:id="_12_5_8ba027a_1188366861724_20189_511" name="A_Forest_Tree"
memberEnd="_12_5_8ba027a_1188366861724_326944_512
_12_5_8ba027a_1188366861724_279181_513"/>
<packagedElement xmi:type="uml:AssociationClass"
xmi:id="_12_5_8ba027a_1188366957806_717587_636" name="Stem"
memberEnd="_12_5_8ba027a_1188366957806_578362_637
_12_5_8ba027a_1188366957806_74107_638">
<ownedAttribute xmi:id="_12_5_8ba027a_1188367013499_79827_705"
name="length" visibility="public"/>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188367402661_37042_723" name="FruitUtil">
<ownedAttribute xmi:id="_12_5_8ba027a_1188367456495_391670_746"
name="bag" visibility="public" isStatic="true"
type="_12_5_8ba027a_1188365260461_257763_325">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367467762_417183_749" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367467762_922581_748" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188367467777_56549_750"
name="sequence" visibility="public" isStatic="true"
type="_12_5_8ba027a_1188365260461_257763_325" isOrdered="true">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367481419_522351_753" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367481419_65244_752" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188367481434_827597_754"
name="set" visibility="public" isStatic="true"
type="_12_5_8ba027a_1188365260461_257763_325">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367496717_988657_757" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367496717_384721_756" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188367496717_747935_758"
name="orderedSet" visibility="public" isStatic="true"
type="_12_5_8ba027a_1188365260461_257763_325" isOrdered="true">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367507983_40191_761" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367507983_534345_760" name=""/>
</ownedAttribute>
<ownedOperation xmi:id="_12_5_8ba027a_1188367519999_640971_762"
name="processBag" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188367551064_742753_769"
name="fruits" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367566580_823032_776" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367566580_567571_775" name=""/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188367566580_775510_777"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188367666743_575447_778"
name="processSequence" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188367692995_204058_780"
name="fruits" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367693010_794015_782" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367693010_649339_781" name=""/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188367693010_262182_783"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188367693010_921929_784"
name="processSet" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188367711543_118866_786"
name="fruits" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367711543_201481_788" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367711543_903331_787" name=""/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188367711543_747283_789"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188367711558_868790_790"
name="processOrderedSet" visibility="public" isStatic="true"
isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188367729544_471642_792"
name="fruits" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367729544_179094_794" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367729544_771675_793" name=""/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188367729544_383758_795"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
</packagedElement>
<profileApplication xmi:id="_nGyEEFelEdy-wIdECvQY7w">
<eAnnotations xmi:id="_nH-W4FelEdy-wIdECvQY7w"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_V6pW81eM Edyvu96OURhT_Q "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_ 1073394351331_445580_2 "/>
</profileApplication>
</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"
annotatedElement="magicdraw_uml_standard_profile_v_0001">
<body>UML Standard Profile contains several popular stereotypes,
tag definitions and constraints described in UML 1.4 and UML 2.0
Specifications.</body>
</ownedComment>
</packagedElement>
<profileApplication
xmi:id="_be00301_1073394351331_445580_2profileApplicationData ">
<eAnnotations xmi:id="_V6pW6leMEdyvu96OURhT_Q"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_V6pW81eM Edyvu96OURhT_Q "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_ 1073394351331_445580_2 "/>
</profileApplication>
<profileApplication
xmi:id="_11_5_f720368_1159529670215_231387_1profileApplicationData ">
<eAnnotations xmi:id="_V6pW7FeMEdyvu96OURhT_Q"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.Validation_Profile.profile.uml#_V6pUjFe MEdyvu96OURhT_Q "/>
</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_10847profileApplicationDat a ">
<eAnnotations xmi:id="_V6pW7leMEdyvu96OURhT_Q"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_V6pRk 1eMEdyvu96OURhT_Q "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_9_0_b e00301_1108050582343_527400_10847 "/>
</profileApplication>
<profileApplication
xmi:id=" _11_5_be00301_1153310565718_226811_161profileApplicationData ">
<eAnnotations xmi:id="_V6pW8FeMEdyvu96OURhT_Q"
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#_V6pTq1eMEdyvu96OURhT_Q "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_11_5_be00301_1153310565718_226811_161 "/>
</profileApplication>
</uml:Model>
<MagicDrawProfile:auxiliaryResource xmi:id="_V6pYo1eMEdyvu96OURhT_Q"
base_Package="magicdraw_uml_standard_profile_v_0001"/>
<ValidationProfile:invariant xmi:id="_V6ybgFeMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188368548062_984749_379"/>
<ValidationProfile:invariant xmi:id="_V6ybgVeMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188370275338_160829_375"/>
<ValidationProfile:invariant xmi:id="_V6ybgleMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188368595703_324084_381"/>
<ValidationProfile:invariant xmi:id="_V6ybg1eMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188368435951_241305_376"/>
<ValidationProfile:definition xmi:id="_V6ybhFeMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188374571194_748349_379"/>
<UMLStandardProfile:utility xmi:id="_V6ybhVeMEdyvu96OURhT_Q"
base_Class="_12_5_8ba027a_1188367402661_37042_723"/>
</xmi:XMI>
Re: Load UML Model Standalone [message #475765 is a reply to message #475586] Tue, 04 September 2007 07:30 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
okay I found out my problem. I registered for default extension the
following factory:
Resource.Factory.Registry.DEFAULT_EXTENSION = new XMIResourceFactoryImpl()

Instead of using for UMLResource.FILE_EXTENSION (*.uml) the factory
UMLResource.Factory.INSTANCE it always tried to load my uml model with xmi
resource factory impl.
Re: Load UML Model Standalone [message #475771 is a reply to message #475765] Wed, 05 September 2007 15:25 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
I have another question. Is it possible only to register the accordant
file extensions without explicitly register the
Resource.Factory.Registry.DEFAULT_EXTENSION. Because if I do not register
the default extension in my application with a default factory but
register for example the *.uml extension with a uml factory I get an
error.
"a registered resource factory is needed".

If I try to load a *.uml model always the registered default factory for
default extension is used.
Re: Load UML Model Standalone [message #475772 is a reply to message #475771] Wed, 05 September 2007 15:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
Mathias,

Are you registering just "uml" or literally "*.uml"? You need to do
the former.


Mathias Krebber wrote:
> Hi,
> I have another question. Is it possible only to register the accordant
> file extensions without explicitly register the
> Resource.Factory.Registry.DEFAULT_EXTENSION. Because if I do not
> register the default extension in my application with a default
> factory but register for example the *.uml extension with a uml
> factory I get an error. "a registered resource factory is needed".
> If I try to load a *.uml model always the registered default factory
> for default extension is used.
>
>
>
Re: Load UML Model Standalone [message #475773 is a reply to message #475772] Wed, 05 September 2007 15:59 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
thank you for the reply.
I register it that way:
Map<String,Object> globalExtensionMap =
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
globalExtensionMap.put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
globalExtensionMap.put(XMIResource.XMI_NS, new XMIResourceFactoryImpl());
...
Re: Load UML Model Standalone [message #475774 is a reply to message #475773] Wed, 05 September 2007 16:52 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
Mathias,

That looks right then. My guess would be that you are loading a
resource that has neither "xmi" extension nor "uml" extension in order
to get the message about no factory being registered. What is the URI
of the resource being created when you get that message?


Mathias Krebber wrote:
> Hi,
> thank you for the reply.
> I register it that way:
> Map<String,Object> globalExtensionMap =
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
> globalExtensionMap.put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> globalExtensionMap.put(XMIResource.XMI_NS, new XMIResourceFactoryImpl());
> ..
>
>
>
Re: Load UML Model Standalone [message #475776 is a reply to message #475774] Thu, 06 September 2007 05:52 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
the file extension is uml. The name of the file:
UMLTest.uml
Re: Load UML Model Standalone [message #475777 is a reply to message #475776] Thu, 06 September 2007 07:10 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
I found a solutions to solve my problem.
If I load my UML Model as follows:
if (!pathUMLModel.startsWith("file:")) {
pathUMLModel = "file:" + new File(pathUMLModel).getAbsolutePath();
}
Resource res = rs.getResource(URI.createURI(new
URL(pathUMLModel).toString(),true),true);

I get the exception: ... a registered resource factory is needed
Only if i register the default extension it works.

If I load the model as follows:
Resource res = rs.getResource(URI.createFileURI(new
File(pathUMLModel).getAbsolutePath()),true);
It works fine.
Can you explain me why?
Re: Load UML Model Standalone [message #475778 is a reply to message #475777] Thu, 06 September 2007 12:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
Matthias,

A URI with a scheme that's not immediately followed by a "/" is an
opaque URI rather than a hierarchical URI and an opaque URI only has an
opaquePart rather than a path. The file extension of a URI is the
string after that last "." in the last segment of the path, so an opaque
URI doesn't have such a thing since it doesn't have a path.


Matthias Krebber wrote:
> Hi,
> I found a solutions to solve my problem.
> If I load my UML Model as follows:
> if (!pathUMLModel.startsWith("file:")) { pathUMLModel = "file:" +
> new File(pathUMLModel).getAbsolutePath(); }
> Resource res = rs.getResource(URI.createURI(new
> URL(pathUMLModel).toString(),true),true);
>
> I get the exception: ... a registered resource factory is needed
> Only if i register the default extension it works.
>
> If I load the model as follows:
> Resource res = rs.getResource(URI.createFileURI(new
> File(pathUMLModel).getAbsolutePath()),true);
> It works fine.
> Can you explain me why?
>
Re: Load UML Model Standalone [message #475779 is a reply to message #475778] Thu, 06 September 2007 12:16 Go to previous messageGo to next message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Thank you for this precious information.

That means that I will register it as follows:
pathUMLModel = "file:/" + new File(pathUMLModel).getAbsolutePath();
Resource res = rs.getResource(URI.createURI(new
URL(pathUMLModel).toString(),true),true);
Matthias
Re: Load UML Model Standalone [message #475780 is a reply to message #475779] Thu, 06 September 2007 12:40 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000801000100080804010806
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Matthias,

It generally seems better to me to use either this because it's more
efficient

URI.createFileURI(new File(pathUMLModel).getAbsolutePath())

or to use this which is a bit less efficient but relies on the JVM to
produce the correct file URI:

URI.createURI(new File(pathUMLModel).toURI().toString())

I'm not sure I see the value in creating an intermediate URL especially
when java.io.File has a toURL method.


Matthias Krebber wrote:
> Thank you for this precious information.
>
> That means that I will register it as follows:
> pathUMLModel = "file:/" + new File(pathUMLModel).getAbsolutePath();
> Resource res = rs.getResource(URI.createURI(new
> URL(pathUMLModel).toString(),true),true);
> Matthias
>


--------------000801000100080804010806
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
It generally seems better to me to use either this because it's more
efficient<br>
<blockquote>URI.createFileURI(new File(pathUMLModel).getAbsolutePath())<br>
</blockquote>
or to use this which is a bit less efficient but relies on the JVM to
produce the correct file URI:<br>
<blockquote>URI.createURI(new File(pathUMLModel).toURI().toString())<br>
</blockquote>
I'm not sure I see the value in creating an intermediate URL especially
when java.io.File has a toURL method.<br>
<br>
<br>
Matthias Krebber wrote:
<blockquote
cite="mid:f32edb1db01bd10a447caa20e36b2929$1@www.eclipse.org"
type="cite">Thank you for this precious information.
<br>
<br>
That means that I will register it as follows:
<br>
pathUMLModel = <a class="moz-txt-link-rfc2396E" href="file:/">"file:/"</a> + new File(pathUMLModel).getAbsolutePath();
<br>
Resource res = rs.getResource(URI.createURI(new
URL(pathUMLModel).toString(),true),true);
<br>
Matthias
<br>
<br>
</blockquote>
<br>
</body>
</html>

--------------000801000100080804010806--
Re: Load UML Model Standalone [message #624602 is a reply to message #475573] Fri, 31 August 2007 10:46 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000904030408060306070901
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Matthias,

It sounds like these EMF FAQs:

2.17 I get a PackageNotFoundException: e.g., "Package with uri
'http://com.example.company.ecore' not found." What do I need to do?
< http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_PackageNot FoundException:_e.g..2C_.22Package_with_uri_.27http:.2F.2Fco m.example.company.ecore.27_not_found..22_What_do_I_need_to_d o.3F>
2.18 Do I have to pre-register my static, generated package when
running stand-alone (outside of Eclipse)?
< http://wiki.eclipse.org/index.php/EMF-FAQ#Do_I_have_to_pre-r egister_my_static.2C_generated_package_when_running_stand-al one_.28outside_of_Eclipse.29.3F>

Of course, being UML2, maybe this is solved some other way. It sounds
like your profile isn't being found so maybe you need to register that
profile like you would a dynamic package:

2.19 How do I register a dynamic package?
< http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_register_ a_dynamic_package.3F>


Matthias Krebber wrote:
> Hello,
> I have created a simple class diagram with magic draw 12.5 and
> exported it to EMF UML2 (v2.x).
>
> Now I want to load the created *.uml model standalone with mdt uml2.
> While trying to solve this task I get the following exception:
> Exception in thread "main"
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
> 'http:///schemas/MagicDrawProfile/_V6VvkFeMEdyvu96OURhT_Q/0' not found.
> How I have to register this package?
>


--------------000904030408060306070901
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
It sounds like these EMF FAQs:<br>
<blockquote><a style=""
href=" http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_PackageNot FoundException:_e.g..2C_.22Package_with_uri_.27http:.2F.2Fco m.example.company.ecore.27_not_found..22_What_do_I_need_to_d o.3F"><span
class="tocnumber">2.17</span> <span class="toctext">I get a
PackageNotFoundException: e.g., "Package with uri
'http://com.example.company.ecore' not found." What do I need to do?</span></a><br>
<a
href=" http://wiki.eclipse.org/index.php/EMF-FAQ#Do_I_have_to_pre-r egister_my_static.2C_generated_package_when_running_stand-al one_.28outside_of_Eclipse.29.3F"><span
class="tocnumber">2.18</span> <span class="toctext">Do I have to
pre-register my static, generated package when running stand-alone
(outside of Eclipse)?</span></a><br>
</blockquote>
Of course, being UML2, maybe this is solved some other way.
Re: Load UML Model Standalone [message #624603 is a reply to message #475575] Fri, 31 August 2007 12:59 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks for your reply,
I want to descripe my problem more precisely.

After exporting my test uml class diagram from magicdraw (functionality of
magic draw)I get the following files:
- UmlTest.uml
- UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml
- UML_Standard_Profile.MagicDraw_Profile.profile.uml
- UML_Standard_Profile.UML_Standard_Profile.profile.uml
- UML_Standard_Profile.Validation_Profile.profile.uml

The head of the created UmlTest model:
<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/_OgYtMFeREdyvu96OURhT_Q/0"
xmlns:UMLStandardProfile=" http:///schemas/UMLStandardProfile/_OgroIVeREdyvu96OURhT_Q/0"
xmlns:ValidationProfile="http:///schemas/ValidationProfile/_OgroIFeREdyvu96OURhT_Q/0"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
xsi:schemaLocation="http:///schemas/MagicDrawProfile/_OgYtMFeREdyvu96OURhT_Q/0
UML_Standard_Profile.MagicDraw_Profile.profile.uml#_Og1eg1eR Edyvu96OURhT_Q
http:///schemas/UMLStandardProfile/_OgroIVeREdyvu96OURhT_Q/0
UML_Standard_Profile.UML_Standard_Profile.profile.uml#_Og1ak 1eREdyvu96OURhT_Q
http:///schemas/ValidationProfile/_OgroIFeREdyvu96OURhT_Q/0
UML_Standard_Profile.Validation_Profile.profile.uml#_Og1cq1e REdyvu96OURhT_Q ">

I want to load this model standalone. How do I get the profile now in
order to register it like
EPackage.Registry.INSTANCE.put(companyPackage.getNsURI(), companyPackage);
?
Re: Load UML Model Standalone [message #624608 is a reply to message #475576] Fri, 31 August 2007 16:02 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Matthias,

If I'm not mistaken all you need to do is register a uri converter ...
something like

URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_ PATHMAP),
umlResourcePluginURI.appendSegment("profiles").appendSegment( ""));

Have a look at the serialized version of your model at the profile
application... you will see an annotation with reference to the actual
EPackage that points to the definition of your profile. With the proper
converter the href therein should be resolved.

Have a look at
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
near the bottom ( section called Programmatic Migration ) at the code that
runs standalone to set up your uri converter.

As a side note: from your profile application you can call
getAppliedDefinition() and getAppliedProfile() if you need to access the
definition.

Let me know if that works.

- James.

"Matthias Krebber" <jesus@rz.fh-augsburg.de> wrote in message
news:3f890c0041004d1180733b621d5e7d9d$1@www.eclipse.org...
> Thanks for your reply,
> I want to descripe my problem more precisely.
>
> After exporting my test uml class diagram from magicdraw (functionality of
> magic draw)I get the following files:
> - UmlTest.uml
> - UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml
> - UML_Standard_Profile.MagicDraw_Profile.profile.uml
> - UML_Standard_Profile.UML_Standard_Profile.profile.uml
> - UML_Standard_Profile.Validation_Profile.profile.uml
>
> The head of the created UmlTest model:
> <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/_OgYtMFeREdyvu96OURhT_Q/0"
> xmlns:UMLStandardProfile=" http:///schemas/UMLStandardProfile/_OgroIVeREdyvu96OURhT_Q/0"
> xmlns:ValidationProfile="http:///schemas/ValidationProfile/_OgroIFeREdyvu96OURhT_Q/0"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xsi:schemaLocation="http:///schemas/MagicDrawProfile/_OgYtMFeREdyvu96OURhT_Q/0
> UML_Standard_Profile.MagicDraw_Profile.profile.uml#_Og1eg1eR Edyvu96OURhT_Q
> http:///schemas/UMLStandardProfile/_OgroIVeREdyvu96OURhT_Q/0
> UML_Standard_Profile.UML_Standard_Profile.profile.uml#_Og1ak 1eREdyvu96OURhT_Q
> http:///schemas/ValidationProfile/_OgroIFeREdyvu96OURhT_Q/0
> UML_Standard_Profile.Validation_Profile.profile.uml#_Og1cq1e REdyvu96OURhT_Q ">
>
> I want to load this model standalone. How do I get the profile now in
> order to register it like
> EPackage.Registry.INSTANCE.put(companyPackage.getNsURI(), companyPackage);
> ?
Re: Load UML Model Standalone [message #624611 is a reply to message #475581] Sat, 01 September 2007 10:03 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
thank you for the reply.

I have already registered the URI Converter map.
My Code:
String umlResources = "jar:file:" + getUMLArchive(new
JarArchiveFileNameFilter("org.eclipse.uml2.uml.resources_")) + "!/";
String umlPluginUri = "jar:file:" + getUMLArchive(new
JarArchiveFileNameFilter("org.eclipse.ocl.uml_")) + "!/";

URIConverter.URI_MAP.put(URI.createURI("platform:/plugin/org.eclipse.uml2.uml/ "),
URI.createURI(umlPluginUri));

URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),URI.createURI(umlResources
+ "libraries/"));

URIConverter.URI_MAP.put(URI.createURI(UMLResource.METAMODEL S_PATHMAP),URI.createURI(umlResources
+ "/metamodels/"));

URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_ PATHMAP),URI.createURI(umlResources
+ "profiles/"));

I also already register the packages and file extensions like described in
UML2 migration.
But that doesnŽt work. I get the exception:
Package with uri
'http:///schemas/MagicDrawProfile/_V6VvkFeMEdyvu96OURhT_Q/0' not found
Re: Load UML Model Standalone [message #624613 is a reply to message #475584] Mon, 03 September 2007 04:11 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Matthias,

Can you open up the model with a text editor and look at the profile
application ( at the bottom of the file ). Please post the xml for that
profile application.

Cheers,
- James.


"Matthias Krebber" <jesus@rz.fh-augsburg.de> wrote in message
news:e287ec236c698e1b6cb936d35cfd53b6$1@www.eclipse.org...
> Hi,
> thank you for the reply.
>
> I have already registered the URI Converter map.
> My Code: String umlResources = "jar:file:" + getUMLArchive(new
> JarArchiveFileNameFilter("org.eclipse.uml2.uml.resources_")) + "!/";
> String umlPluginUri = "jar:file:" + getUMLArchive(new
> JarArchiveFileNameFilter("org.eclipse.ocl.uml_")) + "!/";
>
> URIConverter.URI_MAP.put(URI.createURI("platform:/plugin/org.eclipse.uml2.uml/ "),
> URI.createURI(umlPluginUri));
>
> URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),URI.createURI(umlResources
> + "libraries/"));
>
> URIConverter.URI_MAP.put(URI.createURI(UMLResource.METAMODEL S_PATHMAP),URI.createURI(umlResources
> + "/metamodels/"));
>
> URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_ PATHMAP),URI.createURI(umlResources
> + "profiles/"));
>
> I also already register the packages and file extensions like described in
> UML2 migration. But that doesn
Re: Load UML Model Standalone [message #624614 is a reply to message #475586] Mon, 03 September 2007 06:00 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
This is my test model I created with support of MagicDraw 12.5.

<?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/_V6VvkFeMEdyvu96OURhT_Q/0"
xmlns:UMLStandardProfile=" http:///schemas/UMLStandardProfile/_V6fgkVeMEdyvu96OURhT_Q/0"
xmlns:ValidationProfile="http:///schemas/ValidationProfile/_V6fgkFeMEdyvu96OURhT_Q/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/_V6VvkFeMEdyvu96OURhT_Q/0
UML_Standard_Profile.MagicDraw_Profile.profile.uml#_V6pW81eM Edyvu96OURhT_Q
http:///schemas/UMLStandardProfile/_V6fgkVeMEdyvu96OURhT_Q/0
UML_Standard_Profile.UML_Standard_Profile.profile.uml#_V6pRk 1eMEdyvu96OURhT_Q
http:///schemas/ValidationProfile/_V6fgkFeMEdyvu96OURhT_Q/0
UML_Standard_Profile.Validation_Profile.profile.uml#_V6pUjFe MEdyvu96OURhT_Q ">
<uml:Model xmi:id="eee_1045467100313_135436_1" name="Data">
<ownedComment xmi:id="_12_5_8ba027a_1188364696423_678121_98"
annotatedElement="eee_1045467100313_135436_1">
<body>Author:arkteb.
Created:29.08.07 07:18.
Title:.
Comment:.
</body>
</ownedComment>
<packageImport xmi:id="_0primitiveTypesData">
<importedPackage xmi:type="uml:Model"
href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packageImport xmi:id="_0javaPrimitiveTypesData">
<importedPackage xmi:type="uml:Model"
href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packagedElement xmi:type="uml:Package"
xmi:id="_12_5_8ba027a_1188364999105_478528_253" name="ocltest">
<packagedElement xmi:type="uml:Enumeration"
xmi:id="_12_5_8ba027a_1188365053648_783756_264" name="Color">
<ownedLiteral xmi:id="_12_5_8ba027a_1188365088621_942591_286"
name="+black"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365095800_582932_288"
name="+red"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365099439_367775_290"
name="+green"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365101430_633793_292"
name="+yellow"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365107578_335973_294"
name="+orange"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365111750_974980_296"
name="+brown"/>
<ownedLiteral xmi:id="_12_5_8ba027a_1188365116659_644639_298"
name="+pink"/>
</packagedElement>
<packagedElement xmi:type="uml:Interface"
xmi:id="_12_5_8ba027a_1188365170548_380954_301" name="Edible">
<ownedAttribute xmi:id="_12_5_8ba027a_1188365191893_257223_322"
name="isTasty" visibility="public" isReadOnly="true"/>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188365260461_257763_325" name="Fruit"
clientDependency="_12_5_8ba027a_1188469080958_415966_270">
<ownedRule xmi:id="_12_5_8ba027a_1188368435951_241305_376"
name="not_black"
constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188368465592_295948_378" name="">
<language>OCL2.0</language>
<body>self.color &lt;> Color::black</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188368548062_984749_379"
name="not_foo" constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188368588719_789533_380" name="">
<language>OCL2.0</language>
<body>self.name &lt;> 'Foo'</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188368595703_324084_381"
name="not_pink"
constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188368620173_449061_382" name="">
<language>OCL2.0</language>
<body>self.color &lt;> Color::pink</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188370275338_160829_375"
name="friends_myFruit"
constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188370424739_97077_377" name="">
<language>OCL2.0</language>
<body>self.friends -> iterate(e; result : Sequence(String) =
Sequence{} | result -> append(e.name)) -> collectNested(toUpper()) ->
flatten () -> includes ('MY FRUIT')</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188374571194_748349_379"
name="operation_helper"
constrainedElement="_12_5_8ba027a_1188365260461_257763_325" >
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188374880532_777974_382" name="">
<language>OCL2.0</language>
<body>getOtherFruits(dummy : Boolean) : Set(Fruit) =
Fruit.allInstances() -> excluding (self)</body>
</specification>
</ownedRule>
<ownedAttribute xmi:id="_12_5_8ba027a_1188365277117_772420_347"
name="color" visibility="public"
type="_12_5_8ba027a_1188365053648_783756_264"/>
<ownedAttribute xmi:id="_12_5_8ba027a_1188365284723_183098_349"
name="name" visibility="public" isDerived="true">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<defaultValue xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188374461102_826835_245" name="">
<language>OCL2.0</language>
<body>if self.name.oclIsUndefined() then '' else
self.name</body>
</defaultValue>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188365308657_323089_353"
name="releatedFruit" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" isDerived="true">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188365326253_716488_356" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188365326253_667149_355" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188365326269_886449_357"
name="friends" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188365351833_403460_360" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188365351833_831642_359" name=""/>
</ownedAttribute>
<interfaceRealization
xmi:id="_12_5_8ba027a_1188469080958_415966_270" name=""
supplier="_12_5_8ba027a_1188365170548_380954_301"
client="_12_5_8ba027a_1188365260461_257763_325"
contract="_12_5_8ba027a_1188365170548_380954_301"/>
<ownedOperation xmi:id="_12_5_8ba027a_1188365448605_872382_419"
name="ripen" visibility="public" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188365763714_380834_421"
name="clolor" visibility="public"
type="_12_5_8ba027a_1188365053648_783756_264" direction="inout"/>
<ownedParameter xmi:id="_12_5_8ba027a_1188365763870_12124_422"
name="" visibility="public" direction="return">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Boolea n"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188365763870_408189_423"
name="preferredColor" visibility="public" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188365772361_517432_426"
name="" visibility="public" type="_12_5_8ba027a_1188365053648_783756_264"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188365772377_902198_427"
name="newFruit" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188365780054_836354_430"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188365780069_770619_431"
name="setColor" visibility="public">
<ownedParameter xmi:id="_12_5_8ba027a_1188365797036_871672_433"
name="fruit" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout"/>
<ownedParameter xmi:id="_12_5_8ba027a_1188365797036_125169_434"
name="newColor" visibility="public"
type="_12_5_8ba027a_1188365053648_783756_264" direction="inout"/>
</ownedOperation>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188366220308_910889_273" name="Apple">
<generalization xmi:id="_12_5_8ba027a_1188469097640_67981_286"
isSubstitutable="false" general="_12_5_8ba027a_1188365260461_257763_325"/>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366353019_835064_390"
name="tree" visibility="public"
type="_12_5_8ba027a_1188366248045_34995_296">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366370184_369064_393" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366370184_504519_392" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366370200_5298_394"
name="label" visibility="public">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366380615_136065_397" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366380615_537474_396" name=""/>
<defaultValue xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188387097252_976942_380" name="">
<body></body>
</defaultValue>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366380630_974260_398"
name="appleFriends" visibility="public"
type="_12_5_8ba027a_1188366220308_910889_273">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366398965_147714_401" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366398965_11083_400" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366957806_578362_637"
name="tree" visibility="public"
type="_12_5_8ba027a_1188366248045_34995_296"
association="_12_5_8ba027a_1188366957806_717587_636">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367087026_994843_708" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367087026_473426_707" name=""/>
</ownedAttribute>
<ownedOperation xmi:id="_12_5_8ba027a_1188366477436_708159_402"
name="label" visibility="public"
precondition="_12_5_8ba027a_1188371003435_168867_436
_12_5_8ba027a_1188371096544_923648_438"
postcondition="_12_5_8ba027a_1188371200074_697829_442
_12_5_8ba027a_1188371235574_528492_444">
<ownedRule xmi:id="_12_5_8ba027a_1188371003435_168867_436"
name="text_not_null">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371031904_159087_437" name="">
<language>OCL2.0</language>
<body>not text.oclIsUndefined()</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188371096544_923648_438"
name="text_not_label">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371130137_81793_439" name="">
<language>OCL2.0</language>
<body>text &lt;> self.label</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188371200074_697829_442"
name="label_is_set">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371219277_738796_443" name="">
<language>OCL2.0</language>
<body>self.label = text</body>
</specification>
</ownedRule>
<ownedRule xmi:id="_12_5_8ba027a_1188371235574_528492_444"
name="label_is_changed">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371255683_830683_445" name="">
<language>OCL2.0</language>
<body>self.label &lt;> label@pre</body>
</specification>
</ownedRule>
<ownedParameter xmi:id="_12_5_8ba027a_1188366488675_294347_404"
name="text" visibility="public" direction="inout">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188366488691_858263_405"
name="newApple" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188366500133_419926_408"
name="" visibility="public" type="_12_5_8ba027a_1188366220308_910889_273"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188366500149_631618_409"
name="preferredLabel" visibility="public" isQuery="true"
bodyCondition="_12_5_8ba027a_1188371515330_669283_446">
<ownedRule xmi:id="_12_5_8ba027a_1188371515330_669283_446"
name="unnamed1">
<specification xmi:type="uml:OpaqueExpression"
xmi:id="_12_5_8ba027a_1188371515330_411354_447" name="">
<language>OCL2.0</language>
<body>if text = self.label then '' else text endif</body>
</specification>
</ownedRule>
<ownedParameter xmi:id="_12_5_8ba027a_1188366509593_160993_411"
name="text" visibility="public" direction="inout">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188366509593_831147_412"
name="" visibility="public" direction="return">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedParameter>
</ownedOperation>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188366248045_34995_296" name="Tree">
<ownedAttribute xmi:id="_12_5_8ba027a_1188366649384_669520_417"
name="apples" visibility="public"
type="_12_5_8ba027a_1188366220308_910889_273">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366667446_266415_420" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366667446_276761_419" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366667446_111016_421"
name="height" visibility="public">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Intege r"/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366861724_279181_513"
name="forest" visibility="public"
type="_12_5_8ba027a_1188366268547_395671_319"
association="_12_5_8ba027a_1188366861724_20189_511">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367317508_921740_714" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367317508_64098_713" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366957806_74107_638"
name="apples" visibility="public"
type="_12_5_8ba027a_1188366220308_910889_273"
association="_12_5_8ba027a_1188366957806_717587_636">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367099937_846562_710" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367099937_258772_709" name=""/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188366268547_395671_319" name="Forest">
<ownedAttribute xmi:id="_12_5_8ba027a_1188366610358_200385_413"
name="trees" visibility="public"
type="_12_5_8ba027a_1188366248045_34995_296">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188366622831_230526_416" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188366622831_665587_415" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188366861724_326944_512"
name="trees" visibility="public"
type="_12_5_8ba027a_1188366248045_34995_296" aggregation="shared"
association="_12_5_8ba027a_1188366861724_20189_511">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367306022_961251_712" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367306022_685842_711" name=""/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:PrimitiveType"
xmi:id="_12_5_8ba027a_1188366703584_150043_434" name="Real"/>
<packagedElement xmi:type="uml:Association"
xmi:id="_12_5_8ba027a_1188366861724_20189_511" name="A_Forest_Tree"
memberEnd="_12_5_8ba027a_1188366861724_326944_512
_12_5_8ba027a_1188366861724_279181_513"/>
<packagedElement xmi:type="uml:AssociationClass"
xmi:id="_12_5_8ba027a_1188366957806_717587_636" name="Stem"
memberEnd="_12_5_8ba027a_1188366957806_578362_637
_12_5_8ba027a_1188366957806_74107_638">
<ownedAttribute xmi:id="_12_5_8ba027a_1188367013499_79827_705"
name="length" visibility="public"/>
</packagedElement>
<packagedElement xmi:type="uml:Class"
xmi:id="_12_5_8ba027a_1188367402661_37042_723" name="FruitUtil">
<ownedAttribute xmi:id="_12_5_8ba027a_1188367456495_391670_746"
name="bag" visibility="public" isStatic="true"
type="_12_5_8ba027a_1188365260461_257763_325">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367467762_417183_749" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367467762_922581_748" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188367467777_56549_750"
name="sequence" visibility="public" isStatic="true"
type="_12_5_8ba027a_1188365260461_257763_325" isOrdered="true">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367481419_522351_753" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367481419_65244_752" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188367481434_827597_754"
name="set" visibility="public" isStatic="true"
type="_12_5_8ba027a_1188365260461_257763_325">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367496717_988657_757" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367496717_384721_756" name=""/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_8ba027a_1188367496717_747935_758"
name="orderedSet" visibility="public" isStatic="true"
type="_12_5_8ba027a_1188365260461_257763_325" isOrdered="true">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367507983_40191_761" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367507983_534345_760" name=""/>
</ownedAttribute>
<ownedOperation xmi:id="_12_5_8ba027a_1188367519999_640971_762"
name="processBag" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188367551064_742753_769"
name="fruits" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367566580_823032_776" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367566580_567571_775" name=""/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188367566580_775510_777"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188367666743_575447_778"
name="processSequence" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188367692995_204058_780"
name="fruits" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367693010_794015_782" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367693010_649339_781" name=""/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188367693010_262182_783"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188367693010_921929_784"
name="processSet" visibility="public" isStatic="true" isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188367711543_118866_786"
name="fruits" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367711543_201481_788" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367711543_903331_787" name=""/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188367711543_747283_789"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
<ownedOperation xmi:id="_12_5_8ba027a_1188367711558_868790_790"
name="processOrderedSet" visibility="public" isStatic="true"
isQuery="true">
<ownedParameter xmi:id="_12_5_8ba027a_1188367729544_471642_792"
name="fruits" visibility="public"
type="_12_5_8ba027a_1188365260461_257763_325" direction="inout">
<upperValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_5_8ba027a_1188367729544_179094_794" name="" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_12_5_8ba027a_1188367729544_771675_793" name=""/>
</ownedParameter>
<ownedParameter xmi:id="_12_5_8ba027a_1188367729544_383758_795"
name="" visibility="public" type="_12_5_8ba027a_1188365260461_257763_325"
direction="return"/>
</ownedOperation>
</packagedElement>
<profileApplication xmi:id="_nGyEEFelEdy-wIdECvQY7w">
<eAnnotations xmi:id="_nH-W4FelEdy-wIdECvQY7w"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_V6pW81eM Edyvu96OURhT_Q "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_ 1073394351331_445580_2 "/>
</profileApplication>
</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"
annotatedElement="magicdraw_uml_standard_profile_v_0001">
<body>UML Standard Profile contains several popular stereotypes,
tag definitions and constraints described in UML 1.4 and UML 2.0
Specifications.</body>
</ownedComment>
</packagedElement>
<profileApplication
xmi:id="_be00301_1073394351331_445580_2profileApplicationData ">
<eAnnotations xmi:id="_V6pW6leMEdyvu96OURhT_Q"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_V6pW81eM Edyvu96OURhT_Q "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_ 1073394351331_445580_2 "/>
</profileApplication>
<profileApplication
xmi:id="_11_5_f720368_1159529670215_231387_1profileApplicationData ">
<eAnnotations xmi:id="_V6pW7FeMEdyvu96OURhT_Q"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.Validation_Profile.profile.uml#_V6pUjFe MEdyvu96OURhT_Q "/>
</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_10847profileApplicationDat a ">
<eAnnotations xmi:id="_V6pW7leMEdyvu96OURhT_Q"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_V6pRk 1eMEdyvu96OURhT_Q "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_9_0_b e00301_1108050582343_527400_10847 "/>
</profileApplication>
<profileApplication
xmi:id=" _11_5_be00301_1153310565718_226811_161profileApplicationData ">
<eAnnotations xmi:id="_V6pW8FeMEdyvu96OURhT_Q"
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#_V6pTq1eMEdyvu96OURhT_Q "/>
</eAnnotations>
<appliedProfile
href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_11_5_be00301_1153310565718_226811_161 "/>
</profileApplication>
</uml:Model>
<MagicDrawProfile:auxiliaryResource xmi:id="_V6pYo1eMEdyvu96OURhT_Q"
base_Package="magicdraw_uml_standard_profile_v_0001"/>
<ValidationProfile:invariant xmi:id="_V6ybgFeMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188368548062_984749_379"/>
<ValidationProfile:invariant xmi:id="_V6ybgVeMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188370275338_160829_375"/>
<ValidationProfile:invariant xmi:id="_V6ybgleMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188368595703_324084_381"/>
<ValidationProfile:invariant xmi:id="_V6ybg1eMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188368435951_241305_376"/>
<ValidationProfile:definition xmi:id="_V6ybhFeMEdyvu96OURhT_Q"
base_Constraint="_12_5_8ba027a_1188374571194_748349_379"/>
<UMLStandardProfile:utility xmi:id="_V6ybhVeMEdyvu96OURhT_Q"
base_Class="_12_5_8ba027a_1188367402661_37042_723"/>
</xmi:XMI>
Re: Load UML Model Standalone [message #624617 is a reply to message #475586] Tue, 04 September 2007 07:30 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
okay I found out my problem. I registered for default extension the
following factory:
Resource.Factory.Registry.DEFAULT_EXTENSION = new XMIResourceFactoryImpl()

Instead of using for UMLResource.FILE_EXTENSION (*.uml) the factory
UMLResource.Factory.INSTANCE it always tried to load my uml model with xmi
resource factory impl.
Re: Load UML Model Standalone [message #624723 is a reply to message #475765] Wed, 05 September 2007 15:25 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
I have another question. Is it possible only to register the accordant
file extensions without explicitly register the
Resource.Factory.Registry.DEFAULT_EXTENSION. Because if I do not register
the default extension in my application with a default factory but
register for example the *.uml extension with a uml factory I get an
error.
"a registered resource factory is needed".

If I try to load a *.uml model always the registered default factory for
default extension is used.
Re: Load UML Model Standalone [message #624724 is a reply to message #475771] Wed, 05 September 2007 15:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
Mathias,

Are you registering just "uml" or literally "*.uml"? You need to do
the former.


Mathias Krebber wrote:
> Hi,
> I have another question. Is it possible only to register the accordant
> file extensions without explicitly register the
> Resource.Factory.Registry.DEFAULT_EXTENSION. Because if I do not
> register the default extension in my application with a default
> factory but register for example the *.uml extension with a uml
> factory I get an error. "a registered resource factory is needed".
> If I try to load a *.uml model always the registered default factory
> for default extension is used.
>
>
>
Re: Load UML Model Standalone [message #624725 is a reply to message #475772] Wed, 05 September 2007 15:59 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
thank you for the reply.
I register it that way:
Map<String,Object> globalExtensionMap =
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
globalExtensionMap.put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
globalExtensionMap.put(XMIResource.XMI_NS, new XMIResourceFactoryImpl());
...
Re: Load UML Model Standalone [message #624726 is a reply to message #475773] Wed, 05 September 2007 16:52 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
Mathias,

That looks right then. My guess would be that you are loading a
resource that has neither "xmi" extension nor "uml" extension in order
to get the message about no factory being registered. What is the URI
of the resource being created when you get that message?


Mathias Krebber wrote:
> Hi,
> thank you for the reply.
> I register it that way:
> Map<String,Object> globalExtensionMap =
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
> globalExtensionMap.put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> globalExtensionMap.put(XMIResource.XMI_NS, new XMIResourceFactoryImpl());
> ..
>
>
>
Re: Load UML Model Standalone [message #624728 is a reply to message #475774] Thu, 06 September 2007 05:52 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
the file extension is uml. The name of the file:
UMLTest.uml
Re: Load UML Model Standalone [message #624729 is a reply to message #475776] Thu, 06 September 2007 07:10 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,
I found a solutions to solve my problem.
If I load my UML Model as follows:
if (!pathUMLModel.startsWith("file:")) {
pathUMLModel = "file:" + new File(pathUMLModel).getAbsolutePath();
}
Resource res = rs.getResource(URI.createURI(new
URL(pathUMLModel).toString(),true),true);

I get the exception: ... a registered resource factory is needed
Only if i register the default extension it works.

If I load the model as follows:
Resource res = rs.getResource(URI.createFileURI(new
File(pathUMLModel).getAbsolutePath()),true);
It works fine.
Can you explain me why?
Re: Load UML Model Standalone [message #624730 is a reply to message #475777] Thu, 06 September 2007 12:03 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
Matthias,

A URI with a scheme that's not immediately followed by a "/" is an
opaque URI rather than a hierarchical URI and an opaque URI only has an
opaquePart rather than a path. The file extension of a URI is the
string after that last "." in the last segment of the path, so an opaque
URI doesn't have such a thing since it doesn't have a path.


Matthias Krebber wrote:
> Hi,
> I found a solutions to solve my problem.
> If I load my UML Model as follows:
> if (!pathUMLModel.startsWith("file:")) { pathUMLModel = "file:" +
> new File(pathUMLModel).getAbsolutePath(); }
> Resource res = rs.getResource(URI.createURI(new
> URL(pathUMLModel).toString(),true),true);
>
> I get the exception: ... a registered resource factory is needed
> Only if i register the default extension it works.
>
> If I load the model as follows:
> Resource res = rs.getResource(URI.createFileURI(new
> File(pathUMLModel).getAbsolutePath()),true);
> It works fine.
> Can you explain me why?
>
Re: Load UML Model Standalone [message #624731 is a reply to message #475778] Thu, 06 September 2007 12:16 Go to previous message
Matthias Krebber is currently offline Matthias KrebberFriend
Messages: 21
Registered: July 2009
Junior Member
Thank you for this precious information.

That means that I will register it as follows:
pathUMLModel = "file:/" + new File(pathUMLModel).getAbsolutePath();
Resource res = rs.getResource(URI.createURI(new
URL(pathUMLModel).toString(),true),true);
Matthias
Re: Load UML Model Standalone [message #624732 is a reply to message #475779] Thu, 06 September 2007 12:40 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29034
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000801000100080804010806
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Matthias,

It generally seems better to me to use either this because it's more
efficient

URI.createFileURI(new File(pathUMLModel).getAbsolutePath())

or to use this which is a bit less efficient but relies on the JVM to
produce the correct file URI:

URI.createURI(new File(pathUMLModel).toURI().toString())

I'm not sure I see the value in creating an intermediate URL especially
when java.io.File has a toURL method.


Matthias Krebber wrote:
> Thank you for this precious information.
>
> That means that I will register it as follows:
> pathUMLModel = "file:/" + new File(pathUMLModel).getAbsolutePath();
> Resource res = rs.getResource(URI.createURI(new
> URL(pathUMLModel).toString(),true),true);
> Matthias
>


--------------000801000100080804010806
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
It generally seems better to me to use either this because it's more
efficient<br>
<blockquote>URI.createFileURI(new File(pathUMLModel).getAbsolutePath())<br>
</blockquote>
or to use this which is a bit less efficient but relies on the JVM to
produce the correct file URI:<br>
<blockquote>URI.createURI(new File(pathUMLModel).toURI().toString())<br>
</blockquote>
I'm not sure I see the value in creating an intermediate URL especially
when java.io.File has a toURL method.<br>
<br>
<br>
Matthias Krebber wrote:
<blockquote
cite="mid:f32edb1db01bd10a447caa20e36b2929$1@www.eclipse.org"
type="cite">Thank you for this precious information.
<br>
<br>
That means that I will register it as follows:
<br>
pathUMLModel = <a class="moz-txt-link-rfc2396E" href="file:/">"file:/"</a> + new File(pathUMLModel).getAbsolutePath();
<br>
Resource res = rs.getResource(URI.createURI(new
URL(pathUMLModel).toString(),true),true);
<br>
Matthias
<br>
<br>
</blockquote>
<br>
</body>
</html>

--------------000801000100080804010806--
Previous Topic:UML OCL -> Switch to UML 2.2.0
Next Topic:Creating Activity model using the UML2 API
Goto Forum:
  


Current Time: Wed Dec 13 16:59:57 GMT 2017

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

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