Skip to main content


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 13:28 Go to next message
waqar  is currently offline waqar Friend
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 14:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
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/
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 Apr 18 02:56:01 GMT 2024

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

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

Back to the top