Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Problems with profile "file:" URI in UML Model Editor
Problems with profile "file:" URI in UML Model Editor [message #477057] Tue, 11 March 2008 12:48 Go to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

Greetings,

I'm working on an Eclipse "translator" plugin project that will take a model
encapsulated in a custom Microsoft Access DB and translate it into a UML2
model in Eclipse. The plugin loads a custom profile programmatically,
creates the model and all the elements (applying stereotypes and setting
tagged values from the profile as appropriate), and finally saves the model
to the designated folder in the workspace. The final model can then be
viewed in Eclipse using the UML Model Editor or similar.

All of that is working perfectly well so far. The problem I am having is
occurring when I try to change the URI scheme by which I locate the profile.
By default, the plugin accesses the profile using a "platform:/" URI
(profiles for the translator are stored within their own plugin). I would
like to have an alternative option to use a "file:/" URI to locate the
profile, because the output model is sometimes loaded into an external UML
editor (VP-UML, to be specific) and of course the "platform:" URI doesn't
mean anything to that tool. (The model loads fine in the external editor,
but because the original profile file is not accessible, certain aspects of
the stereotype definition are not loaded. I have been working with Visual
Paradigm to clarify the requirements.)

I can get the "file:" URI for the profile's location, and when I pass it to
the translator, it works just fine-- the profile can be loaded from that URI
and applied to the model. The problem occurs when I then try to open the
model in the UML Model Editor in Eclipse: when the model is opened/expanded,
I get an "Error" message. The problem is that the "href" for the profile is
getting saved incorrectly, as evidenced by the following:

<profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
<eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
</eAnnotations>
<appliedProfile
href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
</profileApplication>

As you can see from the "../../../../../..", the URIs are getting garbled
when the profile URI is stored in the model.

Any thoughts or suggestions on what may be going wrong and how to avoid it
would be greatly appreciated. I am not that knowledgeable about URL/URI
handling in Eclipse and I may well be doing something wrong. I'll be happy
to provide further information or code snippets on request.
Re: Problems with profile "file:" URI in UML Model Editor [message #477060 is a reply to message #477057] Tue, 11 March 2008 17:52 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Ellen,

Have you tried creating a uri mapping .. something like this:
<extension
point="org.eclipse.emf.ecore.uri_mapping">

<mapping

source="pathmap://MY_PROFILES/"

target="platform:/plugin/a.b.c.d/model/">

</mapping>

</extension>



When you next try to refer to your profile you can use something like :
pathmap://MY_PROFILES/MyProfile.profile.uml



This might help?

Cheers

- James







"Ellen Badgley" <ebadgley@mitre.org> wrote in message
news:fr5v2s$hf8$1@build.eclipse.org...
> Greetings,
>
> I'm working on an Eclipse "translator" plugin project that will take a
> model encapsulated in a custom Microsoft Access DB and translate it into a
> UML2 model in Eclipse. The plugin loads a custom profile
> programmatically, creates the model and all the elements (applying
> stereotypes and setting tagged values from the profile as appropriate),
> and finally saves the model to the designated folder in the workspace.
> The final model can then be viewed in Eclipse using the UML Model Editor
> or similar.
>
> All of that is working perfectly well so far. The problem I am having is
> occurring when I try to change the URI scheme by which I locate the
> profile. By default, the plugin accesses the profile using a "platform:/"
> URI (profiles for the translator are stored within their own plugin). I
> would like to have an alternative option to use a "file:/" URI to locate
> the profile, because the output model is sometimes loaded into an external
> UML editor (VP-UML, to be specific) and of course the "platform:" URI
> doesn't mean anything to that tool. (The model loads fine in the external
> editor, but because the original profile file is not accessible, certain
> aspects of the stereotype definition are not loaded. I have been working
> with Visual Paradigm to clarify the requirements.)
>
> I can get the "file:" URI for the profile's location, and when I pass it
> to the translator, it works just fine-- the profile can be loaded from
> that URI and applied to the model. The problem occurs when I then try to
> open the model in the UML Model Editor in Eclipse: when the model is
> opened/expanded, I get an "Error" message. The problem is that the "href"
> for the profile is getting saved incorrectly, as evidenced by the
> following:
>
> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
> </eAnnotations>
> <appliedProfile
> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
> </profileApplication>
>
> As you can see from the "../../../../../..", the URIs are getting garbled
> when the profile URI is stored in the model.
>
> Any thoughts or suggestions on what may be going wrong and how to avoid it
> would be greatly appreciated. I am not that knowledgeable about URL/URI
> handling in Eclipse and I may well be doing something wrong. I'll be
> happy to provide further information or code snippets on request.
>
Re: Problems with profile "file:" URI in UML Model Editor [message #477065 is a reply to message #477060] Tue, 11 March 2008 18:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

I did some experimenting with pathmaps a while back and was not able to get
them to work successfully, but I will try again. Thanks for the advice.

- Ellen

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fr6gsn$i4e$2@build.eclipse.org...
> Hi Ellen,
>
> Have you tried creating a uri mapping .. something like this:
> <extension
> point="org.eclipse.emf.ecore.uri_mapping">
>
> <mapping
>
> source="pathmap://MY_PROFILES/"
>
> target="platform:/plugin/a.b.c.d/model/">
>
> </mapping>
>
> </extension>
>
>
>
> When you next try to refer to your profile you can use something like :
> pathmap://MY_PROFILES/MyProfile.profile.uml
>
>
>
> This might help?
>
> Cheers
>
> - James
>
>
>
>
>
>
>
> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
> news:fr5v2s$hf8$1@build.eclipse.org...
>> Greetings,
>>
>> I'm working on an Eclipse "translator" plugin project that will take a
>> model encapsulated in a custom Microsoft Access DB and translate it into
>> a UML2 model in Eclipse. The plugin loads a custom profile
>> programmatically, creates the model and all the elements (applying
>> stereotypes and setting tagged values from the profile as appropriate),
>> and finally saves the model to the designated folder in the workspace.
>> The final model can then be viewed in Eclipse using the UML Model Editor
>> or similar.
>>
>> All of that is working perfectly well so far. The problem I am having is
>> occurring when I try to change the URI scheme by which I locate the
>> profile. By default, the plugin accesses the profile using a "platform:/"
>> URI (profiles for the translator are stored within their own plugin). I
>> would like to have an alternative option to use a "file:/" URI to locate
>> the profile, because the output model is sometimes loaded into an
>> external UML editor (VP-UML, to be specific) and of course the
>> "platform:" URI doesn't mean anything to that tool. (The model loads
>> fine in the external editor, but because the original profile file is not
>> accessible, certain aspects of the stereotype definition are not loaded.
>> I have been working with Visual Paradigm to clarify the requirements.)
>>
>> I can get the "file:" URI for the profile's location, and when I pass it
>> to the translator, it works just fine-- the profile can be loaded from
>> that URI and applied to the model. The problem occurs when I then try to
>> open the model in the UML Model Editor in Eclipse: when the model is
>> opened/expanded, I get an "Error" message. The problem is that the
>> "href" for the profile is getting saved incorrectly, as evidenced by the
>> following:
>>
>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>> </eAnnotations>
>> <appliedProfile
>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>> </profileApplication>
>>
>> As you can see from the "../../../../../..", the URIs are getting garbled
>> when the profile URI is stored in the model.
>>
>> Any thoughts or suggestions on what may be going wrong and how to avoid
>> it would be greatly appreciated. I am not that knowledgeable about
>> URL/URI handling in Eclipse and I may well be doing something wrong.
>> I'll be happy to provide further information or code snippets on request.
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #477073 is a reply to message #477060] Wed, 12 March 2008 06:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

The pathmap approach is working-- but I don't see how it helps in my
situation. When viewing the model in an external tool, that tool still has
no understanding of what the "pathmap://" URI points to, because that's
Eclipse-specific...

(Thanks for the pointers for getting the pathmap approach working-- when I
tried it previously, I had switched the source and target entries by
mistake. Oops!)

- Ellen


"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fr6gsn$i4e$2@build.eclipse.org...
> Hi Ellen,
>
> Have you tried creating a uri mapping .. something like this:
> <extension
> point="org.eclipse.emf.ecore.uri_mapping">
>
> <mapping
>
> source="pathmap://MY_PROFILES/"
>
> target="platform:/plugin/a.b.c.d/model/">
>
> </mapping>
>
> </extension>
>
>
>
> When you next try to refer to your profile you can use something like :
> pathmap://MY_PROFILES/MyProfile.profile.uml
>
>
>
> This might help?
>
> Cheers
>
> - James
>
>
>
>
>
>
>
> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
> news:fr5v2s$hf8$1@build.eclipse.org...
>> Greetings,
>>
>> I'm working on an Eclipse "translator" plugin project that will take a
>> model encapsulated in a custom Microsoft Access DB and translate it into
>> a UML2 model in Eclipse. The plugin loads a custom profile
>> programmatically, creates the model and all the elements (applying
>> stereotypes and setting tagged values from the profile as appropriate),
>> and finally saves the model to the designated folder in the workspace.
>> The final model can then be viewed in Eclipse using the UML Model Editor
>> or similar.
>>
>> All of that is working perfectly well so far. The problem I am having is
>> occurring when I try to change the URI scheme by which I locate the
>> profile. By default, the plugin accesses the profile using a "platform:/"
>> URI (profiles for the translator are stored within their own plugin). I
>> would like to have an alternative option to use a "file:/" URI to locate
>> the profile, because the output model is sometimes loaded into an
>> external UML editor (VP-UML, to be specific) and of course the
>> "platform:" URI doesn't mean anything to that tool. (The model loads
>> fine in the external editor, but because the original profile file is not
>> accessible, certain aspects of the stereotype definition are not loaded.
>> I have been working with Visual Paradigm to clarify the requirements.)
>>
>> I can get the "file:" URI for the profile's location, and when I pass it
>> to the translator, it works just fine-- the profile can be loaded from
>> that URI and applied to the model. The problem occurs when I then try to
>> open the model in the UML Model Editor in Eclipse: when the model is
>> opened/expanded, I get an "Error" message. The problem is that the
>> "href" for the profile is getting saved incorrectly, as evidenced by the
>> following:
>>
>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>> </eAnnotations>
>> <appliedProfile
>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>> </profileApplication>
>>
>> As you can see from the "../../../../../..", the URIs are getting garbled
>> when the profile URI is stored in the model.
>>
>> Any thoughts or suggestions on what may be going wrong and how to avoid
>> it would be greatly appreciated. I am not that knowledgeable about
>> URL/URI handling in Eclipse and I may well be doing something wrong.
>> I'll be happy to provide further information or code snippets on request.
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #477079 is a reply to message #477073] Wed, 12 March 2008 14:05 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Ellen,

Something else that might be of some use is the following:
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html

Go to the section "Programmatic Migration" (toward the bottom) to see how
to programatically set up pathmaps.

Cheers,
- James


"Ellen Badgley" <ebadgley@mitre.org> wrote in message
news:fr7u3e$dfs$1@build.eclipse.org...
> The pathmap approach is working-- but I don't see how it helps in my
> situation. When viewing the model in an external tool, that tool still
> has no understanding of what the "pathmap://" URI points to, because
> that's Eclipse-specific...
>
> (Thanks for the pointers for getting the pathmap approach working-- when I
> tried it previously, I had switched the source and target entries by
> mistake. Oops!)
>
> - Ellen
>
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:fr6gsn$i4e$2@build.eclipse.org...
>> Hi Ellen,
>>
>> Have you tried creating a uri mapping .. something like this:
>> <extension
>> point="org.eclipse.emf.ecore.uri_mapping">
>>
>> <mapping
>>
>> source="pathmap://MY_PROFILES/"
>>
>> target="platform:/plugin/a.b.c.d/model/">
>>
>> </mapping>
>>
>> </extension>
>>
>>
>>
>> When you next try to refer to your profile you can use something like :
>> pathmap://MY_PROFILES/MyProfile.profile.uml
>>
>>
>>
>> This might help?
>>
>> Cheers
>>
>> - James
>>
>>
>>
>>
>>
>>
>>
>> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
>> news:fr5v2s$hf8$1@build.eclipse.org...
>>> Greetings,
>>>
>>> I'm working on an Eclipse "translator" plugin project that will take a
>>> model encapsulated in a custom Microsoft Access DB and translate it into
>>> a UML2 model in Eclipse. The plugin loads a custom profile
>>> programmatically, creates the model and all the elements (applying
>>> stereotypes and setting tagged values from the profile as appropriate),
>>> and finally saves the model to the designated folder in the workspace.
>>> The final model can then be viewed in Eclipse using the UML Model Editor
>>> or similar.
>>>
>>> All of that is working perfectly well so far. The problem I am having
>>> is occurring when I try to change the URI scheme by which I locate the
>>> profile. By default, the plugin accesses the profile using a
>>> "platform:/" URI (profiles for the translator are stored within their
>>> own plugin). I would like to have an alternative option to use a
>>> "file:/" URI to locate the profile, because the output model is
>>> sometimes loaded into an external UML editor (VP-UML, to be specific)
>>> and of course the "platform:" URI doesn't mean anything to that tool.
>>> (The model loads fine in the external editor, but because the original
>>> profile file is not accessible, certain aspects of the stereotype
>>> definition are not loaded. I have been working with Visual Paradigm to
>>> clarify the requirements.)
>>>
>>> I can get the "file:" URI for the profile's location, and when I pass it
>>> to the translator, it works just fine-- the profile can be loaded from
>>> that URI and applied to the model. The problem occurs when I then try
>>> to open the model in the UML Model Editor in Eclipse: when the model is
>>> opened/expanded, I get an "Error" message. The problem is that the
>>> "href" for the profile is getting saved incorrectly, as evidenced by the
>>> following:
>>>
>>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>> <references xmi:type="ecore:EPackage"
>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>>> </eAnnotations>
>>> <appliedProfile
>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>>> </profileApplication>
>>>
>>> As you can see from the "../../../../../..", the URIs are getting
>>> garbled when the profile URI is stored in the model.
>>>
>>> Any thoughts or suggestions on what may be going wrong and how to avoid
>>> it would be greatly appreciated. I am not that knowledgeable about
>>> URL/URI handling in Eclipse and I may well be doing something wrong.
>>> I'll be happy to provide further information or code snippets on
>>> request.
>>>
>>
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #477089 is a reply to message #477079] Thu, 13 March 2008 07:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

James,

Thanks for the info, but I'm still not seeing how pathmaps are going to be
of assistance in my situation.

I need the profile file to be accessible via a file: URI in my model, since
that is what the external tool requires. Having it as a pathmap won't help,
will it? The pathmap URI is only meaningful within Eclipse.

The problem I'm running into is that even when I use a file URI for the
profile location, somehow it is getting garbled after I save the model, such
that the model produces error messages when opened in the UML Model Editor.
Hence, the profile URI passed in is something like this:

file:C:/Documents and Settings/ebadgley/My Documents/Projects/Geospatial
Registries/Eclipse
Modeling/javaEEWorkspace/org.mitre.nas2uml2.profiles/profile s/NAS.profile.uml

(Characters should actually be escaped, and they are in the processing, I
just didn't type that here.)

My translator is able to load the profile from this URI and create the
output model-- but when I look at the appliedProfile tag, the href looks
something like this:

.../../../../..(etc.)/org.mitre.nas2uml2.profiles/profiles/N AS.profile.uml

This is what is causing the UML Model Editor to choke.

When I can I'll access the profile using a pathmap URI, but that's not an
option for the flow I'm trying to support...

Thanks,
Ellen

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fr8o02$kjq$2@build.eclipse.org...
> Hi Ellen,
>
> Something else that might be of some use is the following:
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>
> Go to the section "Programmatic Migration" (toward the bottom) to see
> how to programatically set up pathmaps.
>
> Cheers,
> - James
>
>
> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
> news:fr7u3e$dfs$1@build.eclipse.org...
>> The pathmap approach is working-- but I don't see how it helps in my
>> situation. When viewing the model in an external tool, that tool still
>> has no understanding of what the "pathmap://" URI points to, because
>> that's Eclipse-specific...
>>
>> (Thanks for the pointers for getting the pathmap approach working-- when
>> I tried it previously, I had switched the source and target entries by
>> mistake. Oops!)
>>
>> - Ellen
>>
>>
>> "James Bruck" <jbruck@ca.ibm.com> wrote in message
>> news:fr6gsn$i4e$2@build.eclipse.org...
>>> Hi Ellen,
>>>
>>> Have you tried creating a uri mapping .. something like this:
>>> <extension
>>> point="org.eclipse.emf.ecore.uri_mapping">
>>>
>>> <mapping
>>>
>>> source="pathmap://MY_PROFILES/"
>>>
>>> target="platform:/plugin/a.b.c.d/model/">
>>>
>>> </mapping>
>>>
>>> </extension>
>>>
>>>
>>>
>>> When you next try to refer to your profile you can use something like :
>>> pathmap://MY_PROFILES/MyProfile.profile.uml
>>>
>>>
>>>
>>> This might help?
>>>
>>> Cheers
>>>
>>> - James
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
>>> news:fr5v2s$hf8$1@build.eclipse.org...
>>>> Greetings,
>>>>
>>>> I'm working on an Eclipse "translator" plugin project that will take a
>>>> model encapsulated in a custom Microsoft Access DB and translate it
>>>> into a UML2 model in Eclipse. The plugin loads a custom profile
>>>> programmatically, creates the model and all the elements (applying
>>>> stereotypes and setting tagged values from the profile as appropriate),
>>>> and finally saves the model to the designated folder in the workspace.
>>>> The final model can then be viewed in Eclipse using the UML Model
>>>> Editor or similar.
>>>>
>>>> All of that is working perfectly well so far. The problem I am having
>>>> is occurring when I try to change the URI scheme by which I locate the
>>>> profile. By default, the plugin accesses the profile using a
>>>> "platform:/" URI (profiles for the translator are stored within their
>>>> own plugin). I would like to have an alternative option to use a
>>>> "file:/" URI to locate the profile, because the output model is
>>>> sometimes loaded into an external UML editor (VP-UML, to be specific)
>>>> and of course the "platform:" URI doesn't mean anything to that tool.
>>>> (The model loads fine in the external editor, but because the original
>>>> profile file is not accessible, certain aspects of the stereotype
>>>> definition are not loaded. I have been working with Visual Paradigm to
>>>> clarify the requirements.)
>>>>
>>>> I can get the "file:" URI for the profile's location, and when I pass
>>>> it to the translator, it works just fine-- the profile can be loaded
>>>> from that URI and applied to the model. The problem occurs when I then
>>>> try to open the model in the UML Model Editor in Eclipse: when the
>>>> model is opened/expanded, I get an "Error" message. The problem is
>>>> that the "href" for the profile is getting saved incorrectly, as
>>>> evidenced by the following:
>>>>
>>>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>>>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>> <references xmi:type="ecore:EPackage"
>>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>>>> </eAnnotations>
>>>> <appliedProfile
>>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>>>> </profileApplication>
>>>>
>>>> As you can see from the "../../../../../..", the URIs are getting
>>>> garbled when the profile URI is stored in the model.
>>>>
>>>> Any thoughts or suggestions on what may be going wrong and how to avoid
>>>> it would be greatly appreciated. I am not that knowledgeable about
>>>> URL/URI handling in Eclipse and I may well be doing something wrong.
>>>> I'll be happy to provide further information or code snippets on
>>>> request.
>>>>
>>>
>>>
>>
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #477091 is a reply to message #477089] Thu, 13 March 2008 13:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

Well, I got it figured out-- to get a reliable file URI for my profile, I
first normalize the URI if I'm using a pathmap, then use
CommonPlugin.asLocalURI(normalizedURI) to get the file version, and it seems
to get saved in the model correctly...

Now that I've finally got the hang of URIs I've rewritten all the
unspeakable code I had in there previously, and it is a lot more
straightforward as a result!

Thanks for the information on the pathmaps; my code is a lot better as a
result.

- Ellen

"Ellen Badgley" <ebadgley@mitre.org> wrote in message
news:frakog$jea$1@build.eclipse.org...
> James,
>
> Thanks for the info, but I'm still not seeing how pathmaps are going to be
> of assistance in my situation.
>
> I need the profile file to be accessible via a file: URI in my model,
> since that is what the external tool requires. Having it as a pathmap
> won't help, will it? The pathmap URI is only meaningful within Eclipse.
>
> The problem I'm running into is that even when I use a file URI for the
> profile location, somehow it is getting garbled after I save the model,
> such that the model produces error messages when opened in the UML Model
> Editor. Hence, the profile URI passed in is something like this:
>
> file:C:/Documents and Settings/ebadgley/My Documents/Projects/Geospatial
> Registries/Eclipse
> Modeling/javaEEWorkspace/org.mitre.nas2uml2.profiles/profile s/NAS.profile.uml
>
> (Characters should actually be escaped, and they are in the processing, I
> just didn't type that here.)
>
> My translator is able to load the profile from this URI and create the
> output model-- but when I look at the appliedProfile tag, the href looks
> something like this:
>
> ../../../../..(etc.)/org.mitre.nas2uml2.profiles/profiles/NA S.profile.uml
>
> This is what is causing the UML Model Editor to choke.
>
> When I can I'll access the profile using a pathmap URI, but that's not an
> option for the flow I'm trying to support...
>
> Thanks,
> Ellen
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:fr8o02$kjq$2@build.eclipse.org...
>> Hi Ellen,
>>
>> Something else that might be of some use is the following:
>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>>
>> Go to the section "Programmatic Migration" (toward the bottom) to see
>> how to programatically set up pathmaps.
>>
>> Cheers,
>> - James
>>
>>
>> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
>> news:fr7u3e$dfs$1@build.eclipse.org...
>>> The pathmap approach is working-- but I don't see how it helps in my
>>> situation. When viewing the model in an external tool, that tool still
>>> has no understanding of what the "pathmap://" URI points to, because
>>> that's Eclipse-specific...
>>>
>>> (Thanks for the pointers for getting the pathmap approach working-- when
>>> I tried it previously, I had switched the source and target entries by
>>> mistake. Oops!)
>>>
>>> - Ellen
>>>
>>>
>>> "James Bruck" <jbruck@ca.ibm.com> wrote in message
>>> news:fr6gsn$i4e$2@build.eclipse.org...
>>>> Hi Ellen,
>>>>
>>>> Have you tried creating a uri mapping .. something like this:
>>>> <extension
>>>> point="org.eclipse.emf.ecore.uri_mapping">
>>>>
>>>> <mapping
>>>>
>>>> source="pathmap://MY_PROFILES/"
>>>>
>>>> target="platform:/plugin/a.b.c.d/model/">
>>>>
>>>> </mapping>
>>>>
>>>> </extension>
>>>>
>>>>
>>>>
>>>> When you next try to refer to your profile you can use something like :
>>>> pathmap://MY_PROFILES/MyProfile.profile.uml
>>>>
>>>>
>>>>
>>>> This might help?
>>>>
>>>> Cheers
>>>>
>>>> - James
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
>>>> news:fr5v2s$hf8$1@build.eclipse.org...
>>>>> Greetings,
>>>>>
>>>>> I'm working on an Eclipse "translator" plugin project that will take a
>>>>> model encapsulated in a custom Microsoft Access DB and translate it
>>>>> into a UML2 model in Eclipse. The plugin loads a custom profile
>>>>> programmatically, creates the model and all the elements (applying
>>>>> stereotypes and setting tagged values from the profile as
>>>>> appropriate), and finally saves the model to the designated folder in
>>>>> the workspace. The final model can then be viewed in Eclipse using the
>>>>> UML Model Editor or similar.
>>>>>
>>>>> All of that is working perfectly well so far. The problem I am having
>>>>> is occurring when I try to change the URI scheme by which I locate the
>>>>> profile. By default, the plugin accesses the profile using a
>>>>> "platform:/" URI (profiles for the translator are stored within their
>>>>> own plugin). I would like to have an alternative option to use a
>>>>> "file:/" URI to locate the profile, because the output model is
>>>>> sometimes loaded into an external UML editor (VP-UML, to be specific)
>>>>> and of course the "platform:" URI doesn't mean anything to that tool.
>>>>> (The model loads fine in the external editor, but because the original
>>>>> profile file is not accessible, certain aspects of the stereotype
>>>>> definition are not loaded. I have been working with Visual Paradigm to
>>>>> clarify the requirements.)
>>>>>
>>>>> I can get the "file:" URI for the profile's location, and when I pass
>>>>> it to the translator, it works just fine-- the profile can be loaded
>>>>> from that URI and applied to the model. The problem occurs when I
>>>>> then try to open the model in the UML Model Editor in Eclipse: when
>>>>> the model is opened/expanded, I get an "Error" message. The problem
>>>>> is that the "href" for the profile is getting saved incorrectly, as
>>>>> evidenced by the following:
>>>>>
>>>>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>>>>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>> <references xmi:type="ecore:EPackage"
>>>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>>>>> </eAnnotations>
>>>>> <appliedProfile
>>>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>>>>> </profileApplication>
>>>>>
>>>>> As you can see from the "../../../../../..", the URIs are getting
>>>>> garbled when the profile URI is stored in the model.
>>>>>
>>>>> Any thoughts or suggestions on what may be going wrong and how to
>>>>> avoid it would be greatly appreciated. I am not that knowledgeable
>>>>> about URL/URI handling in Eclipse and I may well be doing something
>>>>> wrong. I'll be happy to provide further information or code snippets
>>>>> on request.
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #626180 is a reply to message #477057] Tue, 11 March 2008 17:52 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Ellen,

Have you tried creating a uri mapping .. something like this:
<extension
point="org.eclipse.emf.ecore.uri_mapping">

<mapping

source="pathmap://MY_PROFILES/"

target="platform:/plugin/a.b.c.d/model/">

</mapping>

</extension>



When you next try to refer to your profile you can use something like :
pathmap://MY_PROFILES/MyProfile.profile.uml



This might help?

Cheers

- James







"Ellen Badgley" <ebadgley@mitre.org> wrote in message
news:fr5v2s$hf8$1@build.eclipse.org...
> Greetings,
>
> I'm working on an Eclipse "translator" plugin project that will take a
> model encapsulated in a custom Microsoft Access DB and translate it into a
> UML2 model in Eclipse. The plugin loads a custom profile
> programmatically, creates the model and all the elements (applying
> stereotypes and setting tagged values from the profile as appropriate),
> and finally saves the model to the designated folder in the workspace.
> The final model can then be viewed in Eclipse using the UML Model Editor
> or similar.
>
> All of that is working perfectly well so far. The problem I am having is
> occurring when I try to change the URI scheme by which I locate the
> profile. By default, the plugin accesses the profile using a "platform:/"
> URI (profiles for the translator are stored within their own plugin). I
> would like to have an alternative option to use a "file:/" URI to locate
> the profile, because the output model is sometimes loaded into an external
> UML editor (VP-UML, to be specific) and of course the "platform:" URI
> doesn't mean anything to that tool. (The model loads fine in the external
> editor, but because the original profile file is not accessible, certain
> aspects of the stereotype definition are not loaded. I have been working
> with Visual Paradigm to clarify the requirements.)
>
> I can get the "file:" URI for the profile's location, and when I pass it
> to the translator, it works just fine-- the profile can be loaded from
> that URI and applied to the model. The problem occurs when I then try to
> open the model in the UML Model Editor in Eclipse: when the model is
> opened/expanded, I get an "Error" message. The problem is that the "href"
> for the profile is getting saved incorrectly, as evidenced by the
> following:
>
> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
> </eAnnotations>
> <appliedProfile
> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
> </profileApplication>
>
> As you can see from the "../../../../../..", the URIs are getting garbled
> when the profile URI is stored in the model.
>
> Any thoughts or suggestions on what may be going wrong and how to avoid it
> would be greatly appreciated. I am not that knowledgeable about URL/URI
> handling in Eclipse and I may well be doing something wrong. I'll be
> happy to provide further information or code snippets on request.
>
Re: Problems with profile "file:" URI in UML Model Editor [message #626185 is a reply to message #477060] Tue, 11 March 2008 18:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

I did some experimenting with pathmaps a while back and was not able to get
them to work successfully, but I will try again. Thanks for the advice.

- Ellen

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fr6gsn$i4e$2@build.eclipse.org...
> Hi Ellen,
>
> Have you tried creating a uri mapping .. something like this:
> <extension
> point="org.eclipse.emf.ecore.uri_mapping">
>
> <mapping
>
> source="pathmap://MY_PROFILES/"
>
> target="platform:/plugin/a.b.c.d/model/">
>
> </mapping>
>
> </extension>
>
>
>
> When you next try to refer to your profile you can use something like :
> pathmap://MY_PROFILES/MyProfile.profile.uml
>
>
>
> This might help?
>
> Cheers
>
> - James
>
>
>
>
>
>
>
> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
> news:fr5v2s$hf8$1@build.eclipse.org...
>> Greetings,
>>
>> I'm working on an Eclipse "translator" plugin project that will take a
>> model encapsulated in a custom Microsoft Access DB and translate it into
>> a UML2 model in Eclipse. The plugin loads a custom profile
>> programmatically, creates the model and all the elements (applying
>> stereotypes and setting tagged values from the profile as appropriate),
>> and finally saves the model to the designated folder in the workspace.
>> The final model can then be viewed in Eclipse using the UML Model Editor
>> or similar.
>>
>> All of that is working perfectly well so far. The problem I am having is
>> occurring when I try to change the URI scheme by which I locate the
>> profile. By default, the plugin accesses the profile using a "platform:/"
>> URI (profiles for the translator are stored within their own plugin). I
>> would like to have an alternative option to use a "file:/" URI to locate
>> the profile, because the output model is sometimes loaded into an
>> external UML editor (VP-UML, to be specific) and of course the
>> "platform:" URI doesn't mean anything to that tool. (The model loads
>> fine in the external editor, but because the original profile file is not
>> accessible, certain aspects of the stereotype definition are not loaded.
>> I have been working with Visual Paradigm to clarify the requirements.)
>>
>> I can get the "file:" URI for the profile's location, and when I pass it
>> to the translator, it works just fine-- the profile can be loaded from
>> that URI and applied to the model. The problem occurs when I then try to
>> open the model in the UML Model Editor in Eclipse: when the model is
>> opened/expanded, I get an "Error" message. The problem is that the
>> "href" for the profile is getting saved incorrectly, as evidenced by the
>> following:
>>
>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>> </eAnnotations>
>> <appliedProfile
>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>> </profileApplication>
>>
>> As you can see from the "../../../../../..", the URIs are getting garbled
>> when the profile URI is stored in the model.
>>
>> Any thoughts or suggestions on what may be going wrong and how to avoid
>> it would be greatly appreciated. I am not that knowledgeable about
>> URL/URI handling in Eclipse and I may well be doing something wrong.
>> I'll be happy to provide further information or code snippets on request.
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #626200 is a reply to message #477060] Wed, 12 March 2008 06:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

The pathmap approach is working-- but I don't see how it helps in my
situation. When viewing the model in an external tool, that tool still has
no understanding of what the "pathmap://" URI points to, because that's
Eclipse-specific...

(Thanks for the pointers for getting the pathmap approach working-- when I
tried it previously, I had switched the source and target entries by
mistake. Oops!)

- Ellen


"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fr6gsn$i4e$2@build.eclipse.org...
> Hi Ellen,
>
> Have you tried creating a uri mapping .. something like this:
> <extension
> point="org.eclipse.emf.ecore.uri_mapping">
>
> <mapping
>
> source="pathmap://MY_PROFILES/"
>
> target="platform:/plugin/a.b.c.d/model/">
>
> </mapping>
>
> </extension>
>
>
>
> When you next try to refer to your profile you can use something like :
> pathmap://MY_PROFILES/MyProfile.profile.uml
>
>
>
> This might help?
>
> Cheers
>
> - James
>
>
>
>
>
>
>
> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
> news:fr5v2s$hf8$1@build.eclipse.org...
>> Greetings,
>>
>> I'm working on an Eclipse "translator" plugin project that will take a
>> model encapsulated in a custom Microsoft Access DB and translate it into
>> a UML2 model in Eclipse. The plugin loads a custom profile
>> programmatically, creates the model and all the elements (applying
>> stereotypes and setting tagged values from the profile as appropriate),
>> and finally saves the model to the designated folder in the workspace.
>> The final model can then be viewed in Eclipse using the UML Model Editor
>> or similar.
>>
>> All of that is working perfectly well so far. The problem I am having is
>> occurring when I try to change the URI scheme by which I locate the
>> profile. By default, the plugin accesses the profile using a "platform:/"
>> URI (profiles for the translator are stored within their own plugin). I
>> would like to have an alternative option to use a "file:/" URI to locate
>> the profile, because the output model is sometimes loaded into an
>> external UML editor (VP-UML, to be specific) and of course the
>> "platform:" URI doesn't mean anything to that tool. (The model loads
>> fine in the external editor, but because the original profile file is not
>> accessible, certain aspects of the stereotype definition are not loaded.
>> I have been working with Visual Paradigm to clarify the requirements.)
>>
>> I can get the "file:" URI for the profile's location, and when I pass it
>> to the translator, it works just fine-- the profile can be loaded from
>> that URI and applied to the model. The problem occurs when I then try to
>> open the model in the UML Model Editor in Eclipse: when the model is
>> opened/expanded, I get an "Error" message. The problem is that the
>> "href" for the profile is getting saved incorrectly, as evidenced by the
>> following:
>>
>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>> </eAnnotations>
>> <appliedProfile
>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>> </profileApplication>
>>
>> As you can see from the "../../../../../..", the URIs are getting garbled
>> when the profile URI is stored in the model.
>>
>> Any thoughts or suggestions on what may be going wrong and how to avoid
>> it would be greatly appreciated. I am not that knowledgeable about
>> URL/URI handling in Eclipse and I may well be doing something wrong.
>> I'll be happy to provide further information or code snippets on request.
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #626206 is a reply to message #477073] Wed, 12 March 2008 14:05 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Ellen,

Something else that might be of some use is the following:
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html

Go to the section "Programmatic Migration" (toward the bottom) to see how
to programatically set up pathmaps.

Cheers,
- James


"Ellen Badgley" <ebadgley@mitre.org> wrote in message
news:fr7u3e$dfs$1@build.eclipse.org...
> The pathmap approach is working-- but I don't see how it helps in my
> situation. When viewing the model in an external tool, that tool still
> has no understanding of what the "pathmap://" URI points to, because
> that's Eclipse-specific...
>
> (Thanks for the pointers for getting the pathmap approach working-- when I
> tried it previously, I had switched the source and target entries by
> mistake. Oops!)
>
> - Ellen
>
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:fr6gsn$i4e$2@build.eclipse.org...
>> Hi Ellen,
>>
>> Have you tried creating a uri mapping .. something like this:
>> <extension
>> point="org.eclipse.emf.ecore.uri_mapping">
>>
>> <mapping
>>
>> source="pathmap://MY_PROFILES/"
>>
>> target="platform:/plugin/a.b.c.d/model/">
>>
>> </mapping>
>>
>> </extension>
>>
>>
>>
>> When you next try to refer to your profile you can use something like :
>> pathmap://MY_PROFILES/MyProfile.profile.uml
>>
>>
>>
>> This might help?
>>
>> Cheers
>>
>> - James
>>
>>
>>
>>
>>
>>
>>
>> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
>> news:fr5v2s$hf8$1@build.eclipse.org...
>>> Greetings,
>>>
>>> I'm working on an Eclipse "translator" plugin project that will take a
>>> model encapsulated in a custom Microsoft Access DB and translate it into
>>> a UML2 model in Eclipse. The plugin loads a custom profile
>>> programmatically, creates the model and all the elements (applying
>>> stereotypes and setting tagged values from the profile as appropriate),
>>> and finally saves the model to the designated folder in the workspace.
>>> The final model can then be viewed in Eclipse using the UML Model Editor
>>> or similar.
>>>
>>> All of that is working perfectly well so far. The problem I am having
>>> is occurring when I try to change the URI scheme by which I locate the
>>> profile. By default, the plugin accesses the profile using a
>>> "platform:/" URI (profiles for the translator are stored within their
>>> own plugin). I would like to have an alternative option to use a
>>> "file:/" URI to locate the profile, because the output model is
>>> sometimes loaded into an external UML editor (VP-UML, to be specific)
>>> and of course the "platform:" URI doesn't mean anything to that tool.
>>> (The model loads fine in the external editor, but because the original
>>> profile file is not accessible, certain aspects of the stereotype
>>> definition are not loaded. I have been working with Visual Paradigm to
>>> clarify the requirements.)
>>>
>>> I can get the "file:" URI for the profile's location, and when I pass it
>>> to the translator, it works just fine-- the profile can be loaded from
>>> that URI and applied to the model. The problem occurs when I then try
>>> to open the model in the UML Model Editor in Eclipse: when the model is
>>> opened/expanded, I get an "Error" message. The problem is that the
>>> "href" for the profile is getting saved incorrectly, as evidenced by the
>>> following:
>>>
>>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>> <references xmi:type="ecore:EPackage"
>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>>> </eAnnotations>
>>> <appliedProfile
>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>>> </profileApplication>
>>>
>>> As you can see from the "../../../../../..", the URIs are getting
>>> garbled when the profile URI is stored in the model.
>>>
>>> Any thoughts or suggestions on what may be going wrong and how to avoid
>>> it would be greatly appreciated. I am not that knowledgeable about
>>> URL/URI handling in Eclipse and I may well be doing something wrong.
>>> I'll be happy to provide further information or code snippets on
>>> request.
>>>
>>
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #626218 is a reply to message #477079] Thu, 13 March 2008 07:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

James,

Thanks for the info, but I'm still not seeing how pathmaps are going to be
of assistance in my situation.

I need the profile file to be accessible via a file: URI in my model, since
that is what the external tool requires. Having it as a pathmap won't help,
will it? The pathmap URI is only meaningful within Eclipse.

The problem I'm running into is that even when I use a file URI for the
profile location, somehow it is getting garbled after I save the model, such
that the model produces error messages when opened in the UML Model Editor.
Hence, the profile URI passed in is something like this:

file:C:/Documents and Settings/ebadgley/My Documents/Projects/Geospatial
Registries/Eclipse
Modeling/javaEEWorkspace/org.mitre.nas2uml2.profiles/profile s/NAS.profile.uml

(Characters should actually be escaped, and they are in the processing, I
just didn't type that here.)

My translator is able to load the profile from this URI and create the
output model-- but when I look at the appliedProfile tag, the href looks
something like this:

.../../../../..(etc.)/org.mitre.nas2uml2.profiles/profiles/N AS.profile.uml

This is what is causing the UML Model Editor to choke.

When I can I'll access the profile using a pathmap URI, but that's not an
option for the flow I'm trying to support...

Thanks,
Ellen

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fr8o02$kjq$2@build.eclipse.org...
> Hi Ellen,
>
> Something else that might be of some use is the following:
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>
> Go to the section "Programmatic Migration" (toward the bottom) to see
> how to programatically set up pathmaps.
>
> Cheers,
> - James
>
>
> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
> news:fr7u3e$dfs$1@build.eclipse.org...
>> The pathmap approach is working-- but I don't see how it helps in my
>> situation. When viewing the model in an external tool, that tool still
>> has no understanding of what the "pathmap://" URI points to, because
>> that's Eclipse-specific...
>>
>> (Thanks for the pointers for getting the pathmap approach working-- when
>> I tried it previously, I had switched the source and target entries by
>> mistake. Oops!)
>>
>> - Ellen
>>
>>
>> "James Bruck" <jbruck@ca.ibm.com> wrote in message
>> news:fr6gsn$i4e$2@build.eclipse.org...
>>> Hi Ellen,
>>>
>>> Have you tried creating a uri mapping .. something like this:
>>> <extension
>>> point="org.eclipse.emf.ecore.uri_mapping">
>>>
>>> <mapping
>>>
>>> source="pathmap://MY_PROFILES/"
>>>
>>> target="platform:/plugin/a.b.c.d/model/">
>>>
>>> </mapping>
>>>
>>> </extension>
>>>
>>>
>>>
>>> When you next try to refer to your profile you can use something like :
>>> pathmap://MY_PROFILES/MyProfile.profile.uml
>>>
>>>
>>>
>>> This might help?
>>>
>>> Cheers
>>>
>>> - James
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
>>> news:fr5v2s$hf8$1@build.eclipse.org...
>>>> Greetings,
>>>>
>>>> I'm working on an Eclipse "translator" plugin project that will take a
>>>> model encapsulated in a custom Microsoft Access DB and translate it
>>>> into a UML2 model in Eclipse. The plugin loads a custom profile
>>>> programmatically, creates the model and all the elements (applying
>>>> stereotypes and setting tagged values from the profile as appropriate),
>>>> and finally saves the model to the designated folder in the workspace.
>>>> The final model can then be viewed in Eclipse using the UML Model
>>>> Editor or similar.
>>>>
>>>> All of that is working perfectly well so far. The problem I am having
>>>> is occurring when I try to change the URI scheme by which I locate the
>>>> profile. By default, the plugin accesses the profile using a
>>>> "platform:/" URI (profiles for the translator are stored within their
>>>> own plugin). I would like to have an alternative option to use a
>>>> "file:/" URI to locate the profile, because the output model is
>>>> sometimes loaded into an external UML editor (VP-UML, to be specific)
>>>> and of course the "platform:" URI doesn't mean anything to that tool.
>>>> (The model loads fine in the external editor, but because the original
>>>> profile file is not accessible, certain aspects of the stereotype
>>>> definition are not loaded. I have been working with Visual Paradigm to
>>>> clarify the requirements.)
>>>>
>>>> I can get the "file:" URI for the profile's location, and when I pass
>>>> it to the translator, it works just fine-- the profile can be loaded
>>>> from that URI and applied to the model. The problem occurs when I then
>>>> try to open the model in the UML Model Editor in Eclipse: when the
>>>> model is opened/expanded, I get an "Error" message. The problem is
>>>> that the "href" for the profile is getting saved incorrectly, as
>>>> evidenced by the following:
>>>>
>>>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>>>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>> <references xmi:type="ecore:EPackage"
>>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>>>> </eAnnotations>
>>>> <appliedProfile
>>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>>>> </profileApplication>
>>>>
>>>> As you can see from the "../../../../../..", the URIs are getting
>>>> garbled when the profile URI is stored in the model.
>>>>
>>>> Any thoughts or suggestions on what may be going wrong and how to avoid
>>>> it would be greatly appreciated. I am not that knowledgeable about
>>>> URL/URI handling in Eclipse and I may well be doing something wrong.
>>>> I'll be happy to provide further information or code snippets on
>>>> request.
>>>>
>>>
>>>
>>
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #626220 is a reply to message #477089] Thu, 13 March 2008 13:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ebadgley.mitre.org

Well, I got it figured out-- to get a reliable file URI for my profile, I
first normalize the URI if I'm using a pathmap, then use
CommonPlugin.asLocalURI(normalizedURI) to get the file version, and it seems
to get saved in the model correctly...

Now that I've finally got the hang of URIs I've rewritten all the
unspeakable code I had in there previously, and it is a lot more
straightforward as a result!

Thanks for the information on the pathmaps; my code is a lot better as a
result.

- Ellen

"Ellen Badgley" <ebadgley@mitre.org> wrote in message
news:frakog$jea$1@build.eclipse.org...
> James,
>
> Thanks for the info, but I'm still not seeing how pathmaps are going to be
> of assistance in my situation.
>
> I need the profile file to be accessible via a file: URI in my model,
> since that is what the external tool requires. Having it as a pathmap
> won't help, will it? The pathmap URI is only meaningful within Eclipse.
>
> The problem I'm running into is that even when I use a file URI for the
> profile location, somehow it is getting garbled after I save the model,
> such that the model produces error messages when opened in the UML Model
> Editor. Hence, the profile URI passed in is something like this:
>
> file:C:/Documents and Settings/ebadgley/My Documents/Projects/Geospatial
> Registries/Eclipse
> Modeling/javaEEWorkspace/org.mitre.nas2uml2.profiles/profile s/NAS.profile.uml
>
> (Characters should actually be escaped, and they are in the processing, I
> just didn't type that here.)
>
> My translator is able to load the profile from this URI and create the
> output model-- but when I look at the appliedProfile tag, the href looks
> something like this:
>
> ../../../../..(etc.)/org.mitre.nas2uml2.profiles/profiles/NA S.profile.uml
>
> This is what is causing the UML Model Editor to choke.
>
> When I can I'll access the profile using a pathmap URI, but that's not an
> option for the flow I'm trying to support...
>
> Thanks,
> Ellen
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:fr8o02$kjq$2@build.eclipse.org...
>> Hi Ellen,
>>
>> Something else that might be of some use is the following:
>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>>
>> Go to the section "Programmatic Migration" (toward the bottom) to see
>> how to programatically set up pathmaps.
>>
>> Cheers,
>> - James
>>
>>
>> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
>> news:fr7u3e$dfs$1@build.eclipse.org...
>>> The pathmap approach is working-- but I don't see how it helps in my
>>> situation. When viewing the model in an external tool, that tool still
>>> has no understanding of what the "pathmap://" URI points to, because
>>> that's Eclipse-specific...
>>>
>>> (Thanks for the pointers for getting the pathmap approach working-- when
>>> I tried it previously, I had switched the source and target entries by
>>> mistake. Oops!)
>>>
>>> - Ellen
>>>
>>>
>>> "James Bruck" <jbruck@ca.ibm.com> wrote in message
>>> news:fr6gsn$i4e$2@build.eclipse.org...
>>>> Hi Ellen,
>>>>
>>>> Have you tried creating a uri mapping .. something like this:
>>>> <extension
>>>> point="org.eclipse.emf.ecore.uri_mapping">
>>>>
>>>> <mapping
>>>>
>>>> source="pathmap://MY_PROFILES/"
>>>>
>>>> target="platform:/plugin/a.b.c.d/model/">
>>>>
>>>> </mapping>
>>>>
>>>> </extension>
>>>>
>>>>
>>>>
>>>> When you next try to refer to your profile you can use something like :
>>>> pathmap://MY_PROFILES/MyProfile.profile.uml
>>>>
>>>>
>>>>
>>>> This might help?
>>>>
>>>> Cheers
>>>>
>>>> - James
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> "Ellen Badgley" <ebadgley@mitre.org> wrote in message
>>>> news:fr5v2s$hf8$1@build.eclipse.org...
>>>>> Greetings,
>>>>>
>>>>> I'm working on an Eclipse "translator" plugin project that will take a
>>>>> model encapsulated in a custom Microsoft Access DB and translate it
>>>>> into a UML2 model in Eclipse. The plugin loads a custom profile
>>>>> programmatically, creates the model and all the elements (applying
>>>>> stereotypes and setting tagged values from the profile as
>>>>> appropriate), and finally saves the model to the designated folder in
>>>>> the workspace. The final model can then be viewed in Eclipse using the
>>>>> UML Model Editor or similar.
>>>>>
>>>>> All of that is working perfectly well so far. The problem I am having
>>>>> is occurring when I try to change the URI scheme by which I locate the
>>>>> profile. By default, the plugin accesses the profile using a
>>>>> "platform:/" URI (profiles for the translator are stored within their
>>>>> own plugin). I would like to have an alternative option to use a
>>>>> "file:/" URI to locate the profile, because the output model is
>>>>> sometimes loaded into an external UML editor (VP-UML, to be specific)
>>>>> and of course the "platform:" URI doesn't mean anything to that tool.
>>>>> (The model loads fine in the external editor, but because the original
>>>>> profile file is not accessible, certain aspects of the stereotype
>>>>> definition are not loaded. I have been working with Visual Paradigm to
>>>>> clarify the requirements.)
>>>>>
>>>>> I can get the "file:" URI for the profile's location, and when I pass
>>>>> it to the translator, it works just fine-- the profile can be loaded
>>>>> from that URI and applied to the model. The problem occurs when I
>>>>> then try to open the model in the UML Model Editor in Eclipse: when
>>>>> the model is opened/expanded, I get an "Error" message. The problem
>>>>> is that the "href" for the profile is getting saved incorrectly, as
>>>>> evidenced by the following:
>>>>>
>>>>> <profileApplication xmi:id="_rEJLLe9oEdyqitgWLuaR9g">
>>>>> <eAnnotations xmi:id="_rEJLLu9oEdyqitgWLuaR9g"
>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>> <references xmi:type="ecore:EPackage"
>>>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_XD N8YbTEEdyfbZc0xZIVvQ "/>
>>>>> </eAnnotations>
>>>>> <appliedProfile
>>>>> href=" ../../../../../../../../eclipseNew/eclipse/configuration/org .eclipse.osgi/bundles/614/1/.cp/profiles/NAS.profile.uml#_0 "/>
>>>>> </profileApplication>
>>>>>
>>>>> As you can see from the "../../../../../..", the URIs are getting
>>>>> garbled when the profile URI is stored in the model.
>>>>>
>>>>> Any thoughts or suggestions on what may be going wrong and how to
>>>>> avoid it would be greatly appreciated. I am not that knowledgeable
>>>>> about URL/URI handling in Eclipse and I may well be doing something
>>>>> wrong. I'll be happy to provide further information or code snippets
>>>>> on request.
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: Problems with profile "file:" URI in UML Model Editor [message #1409350 is a reply to message #626220] Sun, 17 August 2014 22:37 Go to previous message
John Guerson is currently offline John GuersonFriend
Messages: 51
Registered: August 2011
Member
Hi,

I am facing this same issue but even with Ellen's response I am still stuck. She mentioned something about normalizeing URIs and pathmaps to resolve that but I still don't know how to do it (researched a lot through the forum but got nothing yet). If someone could help me out a little bit, I am feeling that I'm getting closer to the answer. Here it is:

I am failing to put my profile absolute path in "schemaLocation" at my UML model file, using a stand alone application. It is printing "../"instead of the full file path "file:/C:/Users/John/...". My profile's name is "Custom". See below how it is incorrectly printing the schemaLocation.

xsi:schemaLocation="[url]http:///schemas/Custom/_tBawQCTmEeKfN4O_IciSig/1[/url] ../SVNs/.../profile/Custom.uml#_tBawQSTmEeKfN4O_IciSig">


So, I load my profile with a absolute path as its URI, as it follows:
profileRSet = new ResourceSetImpl();
UMLResourcesUtil.init(profileRSet);
profileRSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);		
profileRSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);

myProfileUri = URI.createFileURI("file:/C:/Users/John/.../Custom.uml");      
profileResource = profileRSet.createResource(myProfileUri );

profileResource.load(null);
final Map<URI,URI> uriMap = profileRSet.getURIConverter().getURIMap();
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uml2baseURI.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uml2baseURI.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uml2baseURI.appendSegment("profiles").appendSegment(""));
...


Then I create a UML resource for my model and put in its URI mapping, the pathmap "pathmap//CUSTOM_PROFILE/" and the respective absolute file folder location.
URI uri = URI.createFileURI(umlPath);				
modelRSet = new ResourceSetImpl();				
UMLResourcesUtil.init(modelRSet);
modelRSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
modelRSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
modelResource = modelRSet.createResource(uri);
modelResource.getContents().add(umlRoot);		
try {
   modelResource.load(null);
} catch (IOException e) {
   e.printStackTrace();
}
final Map<URI,URI> uriModelMap = modelRSet.getURIConverter().getURIMap();
uriModelMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uml2baseURI.appendSegment("libraries").appendSegment(""));
uriModelMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uml2baseURI.appendSegment("metamodels").appendSegment(""));
uriModelMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uml2baseURI.appendSegment("profiles").appendSegment(""));

uriModelMap.put(URI,createURI("[url]pathmap://CUSTOM_PROFILE/[/url]"), URI.createURI("file:/C:/Users/John/.../profile/")));


Then I apply my profile to the UML model, apply some stereotypes in the elements and then save the UML model.
uprofile = (Profile)EcoreUtil.getObjectByType(profileResource.getContents(), UMLPackage.Literals.PROFILE);
umlRoot.applyProfile(custom_profile);
// applying some stereotypes....
modelResource.save(Collections.emptyMap());


That's basically all I am doing, I am missing something very important. Perhaps to register my Custom profile to that pathmap.

Thanks a lot,
John

[Updated on: Sun, 17 August 2014 22:39]

Report message to a moderator

Previous Topic:Java code on how to copy UML package to another UML Package
Next Topic:ExportAllDiagrams/Model Validation very slow on Luna
Goto Forum:
  


Current Time: Tue Mar 19 09:12:08 GMT 2024

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

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

Back to the top