|
|
|
Re: Using EMF Resource to iterate over contents of model file [message #1779211 is a reply to message #1779200] |
Thu, 04 January 2018 05:24 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
This looks kind of nonsensical. Firstly, I can only guess what "path of model" is, and that's the key detail. Secondly, unless you're running in a stand alone environment (not in an Eclipse/Equinox container), then resourceSet.getPackageRegistry().put("path of model",ModelPackage.eINSTANCE) is not needed, and if it were, you'd use the idiom ModelPackage.eINSTANCE.eClass() force the model to register itself in the global package registry, or you'd use resourceSet.getPackageRegistry().put(ModelPackage.eNSURI, ModelPackage.eINSTANCE) to register the model's namespace URI if there was some particular need to register it also in the resource set's package registry. Any call to resourceSet.getResource(<uri>, true), will return the resource of the generated model package if <uri> is equal to the eNSURI of any registered model, so no doubt what you're showing above will return the resource of the Ecore (meta) model not your instance model corresponding to that Ecore model. I imagine you want to be iterating over your instance model so you need to load that, (perhaps as you've shown, using a platform:/resource URI if you're running with an IWorkspace) and not map its URI to the Ecore model.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04299 seconds