Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » defining model scope for XMI loader(model scope)
defining model scope for XMI loader [message #1782751] Wed, 28 February 2018 23:26 Go to next message
Zakir Meer is currently offline Zakir MeerFriend
Messages: 50
Registered: February 2016
Member
Hello Experts,

I am looking for a way to define model scope to a folder and load all the xmi files which are part of it in a resourceset.

Also during loading I encountered that proxy objects were not resolved as in XMI references were defined relative to a folder (which will be the model scope)

Example:
 <student name="st2">
    <address
        href="Address.xmi#/"/>
  </student>


Based on the above problem I realized that there should be a custom implementation for resolving proxies based on the model scope.

In case anyone of you have encountered similar use case and solved it by defining the custom proxy resolution mechanism and specifying folder scope. Please share the info regarding this.

Thanks a lot !!

Re: defining model scope for XMI loader [message #1782757 is a reply to message #1782751] Thu, 01 March 2018 05:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
There is no such thing as a Model Scope. Relative references are resolved against the URI used to load the resource containing those references. So if you're having problems, most likely you didn't load the resource with an absolute URI. I.e., if this resource is in the workspace say in /project/folder/Foo.xmi, you should use platform:/resource/project/folder/Foo.xmi to load it and then the relative URI will resolve to platform:/resource/project/folder/Address.xmi, i.e., in the same folder as the referencing resource. If you're loading from the file system use URI.createFileURI(new File(...).getAbsolutePath()) to create the URI you use to load the resource. In general, you should always use an absolute URI to load a resource, i.e., platform:/..., file:/..., http://...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: defining model scope for XMI loader [message #1782775 is a reply to message #1782757] Thu, 01 March 2018 09:57 Go to previous message
Zakir Meer is currently offline Zakir MeerFriend
Messages: 50
Registered: February 2016
Member
Thanks a lot for your quick response Ed !!

As specified by you, I used URI.createFileURI(new File(...).getAbsolutePath()) and the proxies were resolved.

 Resource resource1 = resourceSet.getResource( URI.createFileURI(getAbsolutePath("./model/Address.xmi" )),true);
				 
Resource resource2 = resourceSet.getResource(URI.createFileURI(getAbsolutePath("./model/School1_with_cross_document_references.xmi")),true );

EcoreUtil.resolveAll(resourceSet);
Previous Topic:What should I configure NSURI to be?
Next Topic:Copy some containments from the referenced object to the referring object
Goto Forum:
  


Current Time: Fri Apr 19 12:54:46 GMT 2024

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

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

Back to the top