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 08:48 Go to next message
Eclipse User
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 13:52 Go to previous messageGo to next message
james bruck is currently offline james bruck
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 14:37 Go to previous messageGo to next message
Eclipse User
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 02:43 Go to previous messageGo to next message
Eclipse User
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 10:05 Go to previous messageGo to next message
james bruck is currently offline james bruck
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 03:22 Go to previous messageGo to next message
Eclipse User
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 09:35 Go to previous message
Eclipse User
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 13:52 Go to previous message
james bruck is currently offline james bruck
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 14:37 Go to previous message
Eclipse User
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 02:43 Go to previous message
Eclipse User
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 10:05 Go to previous message
james bruck is currently offline james bruck
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 03:22 Go to previous message
Eclipse User
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 09:35 Go to previous message
Eclipse User
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.
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Previous Topic:Re: Convert a UML file to Ecore file
Next Topic:Adding a menu entry to the UML Editor Menu
Goto Forum:
  


Current Time: Tue Jul 22 03:38:55 EDT 2014

Powered by FUDForum. Page generated in 0.05179 seconds