Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Yet another problem with programmatically loading a UML model with a profile.
Yet another problem with programmatically loading a UML model with a profile. [message #84389] Thu, 12 June 2008 10:07 Go to next message
Eclipse UserFriend
Originally posted by: karp.no-mail.com

Hi,

I've got a simple transformation that take ModelA.uml in input and
ModelB.uml in output
ModelA.uml uses sterotypes from a profile 'Test.profile.uml'

Here is what I do in my program to register the resources.


------------------------8<------------------------
ResourceSet resourceSet = ASMEMFModel.getResourceSet();
resourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/2.1.0/UML",
UMLPackage.eINSTANCE);
// Profile registration
resourceSet.getPackageRegistry().put("http:///schemas/Test/_UiwQwDhYEd2PFcRE_i9KZg/0",
UMLPackage.eINSTANCE);
URI uri =
URI.createURI(" jar:file:///D:/eclipse/eclipse-modeling-ganymede-RC1-win32/A TL_LIBS_RC3/org.eclipse.uml2.uml.resources_2.2.0.v2008051310 30.jar!/");
Map<URI, URI> uRIMap = resourceSet.getURIConverter().getURIMap();
uRIMap.put(URI.createURI(""), URI.createFileURI("PATH"));
uRIMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
uri.appendSegment("libraries").appendSegment(""));
uRIMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));
uRIMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
uri.appendSegment("profiles").appendSegment(""));
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
------------------------8<-------------------------

I've got a Java project from which I launch programatically the
transformation.
And I've got an ATL project where are located my models, profile, and my
transformation.

Now the problem is that when I launch (programmatically) my
transformation, I obtain this error :
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
uri 'http:///schemas/Test/_UiwQwDhYEd2PFcRE_i9KZg/0' not found.
( file:///D:/Stage/eclipse-modeling-ganymede-RC1-win32/workspa ce/LaunchAtlUml/A,
23, 93)
EMF is looking for the profile in my Java project. If I put it there, it
works fine.
But I would like to keep my profile in my Transformation project.
I suppose I can do that with the URIConverter or something like that.
Any idea ?
Re: [ATL] Yet another problem with programmatically loading a UML model with a profile. [message #84418 is a reply to message #84389] Thu, 12 June 2008 12:15 Go to previous message
Eclipse UserFriend
Originally posted by: karp.no-mail.com

I forgot the [ATL] in the title, sorry.

karp has written :
> Hi,
>
> I've got a simple transformation that take ModelA.uml in input and
> ModelB.uml in output
> ModelA.uml uses sterotypes from a profile 'Test.profile.uml'
>
> Here is what I do in my program to register the resources.
>
>
> ------------------------8<------------------------
> ResourceSet resourceSet = ASMEMFModel.getResourceSet();
> resourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/2.1.0/UML",
> UMLPackage.eINSTANCE);
> // Profile registration
> resourceSet.getPackageRegistry().put("http:///schemas/Test/_UiwQwDhYEd2PFcRE_i9KZg/0",
> UMLPackage.eINSTANCE);
> URI uri =
> URI.createURI(" jar:file:///D:/eclipse/eclipse-modeling-ganymede-RC1-win32/A TL_LIBS_RC3/org.eclipse.uml2.uml.resources_2.2.0.v2008051310 30.jar!/");
>
> Map<URI, URI> uRIMap = resourceSet.getURIConverter().getURIMap();
> uRIMap.put(URI.createURI(""), URI.createFileURI("PATH"));
> uRIMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));
> uRIMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));
> uRIMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> ------------------------8<-------------------------
>
> I've got a Java project from which I launch programatically the
> transformation.
> And I've got an ATL project where are located my models, profile, and my
> transformation.
>
> Now the problem is that when I launch (programmatically) my
> transformation, I obtain this error :
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
> uri 'http:///schemas/Test/_UiwQwDhYEd2PFcRE_i9KZg/0' not found.
> ( file:///D:/Stage/eclipse-modeling-ganymede-RC1-win32/workspa ce/LaunchAtlUml/A,
> 23, 93)
> EMF is looking for the profile in my Java project. If I put it there, it
> works fine.
> But I would like to keep my profile in my Transformation project.
> I suppose I can do that with the URIConverter or something like that.
> Any idea ?
Previous Topic:[ATL] random crashes?
Next Topic:[ATL] Help with 'The side effect example'
Goto Forum:
  


Current Time: Tue Apr 16 14:27:55 GMT 2024

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

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

Back to the top