|
Re: accessing ecore model content [message #633832 is a reply to message #633797] |
Tue, 19 October 2010 14:25 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Waqar,
In the future, it's best to use eclipse.tools.emf for questions about
EMF core. More comments below.
waqar wrote:
> hi,
> i am new to this group and also to ecore modeling.
> I created a ecore model in emf and now deserialize it using the code:
>
> --------------------------
> Resource res =
> ResourceSet.getResource(URI.createFileURI("LibV2.ecore"), true) ;
Best to ensure that you use an absolute file path
(java.io.File.getAbsolutePath()), not one relative to the current
working directly.
>
> // get the root object
> EObject root = res.getContents().get(0) ;
> ---------------------------
>
If this is an Ecore resources, the root will be an EPackage. You can
test for that and cast.
>
> Now I want to know how i further get access to the contents of my model.
Don't forget about your best friend, the debugger. She'll answer
questions faster than me.
>
> thanks.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04149 seconds