Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » accessing ecore model content
accessing ecore model content [message #633797] Tue, 19 October 2010 09:28 Go to next message
waqar  is currently offline waqar
Messages: 5
Registered: October 2010
Junior Member
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) ;

// get the root object
EObject root = res.getContents().get(0) ;
---------------------------


Now I want to know how i further get access to the contents of my model.

thanks.
Re: accessing ecore model content [message #633832 is a reply to message #633797] Tue, 19 October 2010 10:25 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25918
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.
Previous Topic:[Texo] running tools outside eclipse
Next Topic:Re: [OCL-ECORE-JAVA] OCL Queries on Ecore model from Java code.
Goto Forum:
  


Current Time: Thu Jul 24 16:10:11 EDT 2014

Powered by FUDForum. Page generated in 0.02093 seconds