[Solved] URI reference between XMI files [message #1075538] |
Mon, 29 July 2013 11:46  |
Eclipse User |
|
|
|
Hello everyone,
I have a slight problem with references between two XMI files, a model and a profile which is applied on it. It is OK with absolute or relative URIs within the Eclipse platform but I didn't manage to get working relative URIs outside Eclipse environment. I'm not sure about that, but it seems that the base URI is somewhat located in the workspace.
The URI below works both outside and inside the Eclipse environment :
file:/aaa/bbb/ccc/uml2src/database.profile.uml#_x2g4kKEJEeKGtN90QVAToA
but this one doesn't :
../uml2src/database.profile.uml#_OrGTsKEJEeKGtN90QVAToA
and I would like something like this :
file:../../aaa/bbb/ccc/uml2src/database.profile.uml#_x2g4kKEJEeKGtN90QVAToA
because my application has to work in standalone mode and the files are in separated folders.
Any help is welcome.
Thanks in advance.
[Updated on: Wed, 31 July 2013 10:16] by Moderator
|
|
|
|
|
Re: URI reference between XMI files [message #1075924 is a reply to message #1075903] |
Tue, 30 July 2013 06:37   |
Eclipse User |
|
|
|
Vincent,
Comments below.
On 30/07/2013 11:53 AM, Vincent Verdier wrote:
> Thank you for your answer.
>
> I had a look at the
> org.eclipse.emf.ecore.resource.URIConverter.getURIMap()'s Javadoc then
> I tried to implement the convertion :
>
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> File dir = new File(""); // current location (directory where
> the standalone JAR belongs)
You mention it's a jar....
> URI resourceURI = URI.createPlatformResourceURI("uml2src",
> true).appendSegment(""); URI physicalURI =
> URI.createFileURI(dir.getAbsolutePath()).appendSegment("");
> System.out.println("{" + resourceURI + ", " + physicalURI + "}");
> uriMap.put(resourceURI, physicalURI);
>
> What is printed by the sysout debug :
>
> {platform:/resource/uml2src/, file:/aaa/bbb/ccc/uml2src/}
>
> (aaa, bbb, ccc are of course obfuscated directories)
>
> The result seems good but it is still not working, though my uml
> software displays this URI for the path to the profile :
>
>
> platform:/resource/uml2src/database.profile.uml
So that looks better.
>
>
> I also looked at the XMI code and the paths to the profile are like
> below :
>
>
> href="../uml2src/database.profile.uml"
So it's properly resolving the URI to
platform:/resource/uml2src/database.profile.uml... So does
file:/aaa/bbb/ccc/uml2src/ exist in the file system? It sounds to me
like it doesn't, because you mention a jar. So if the jar that contains
database.profile.uml is abc.jar you should use a URI of the form
archive:file:/<path-to-jar>/abc.jar!/ so that all access to URIs
prefixed by platform:/resource/uml2src/ will be redirected to look in
the root of the abc.jar file.
>
>
> Do I need to do something more with the
> org.eclipse.emf.ecore.plugin.EcorePlugin.getPlatformResourceMap() ?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09332 seconds