|
|
|
|
|
Re: How can i iterate throught my emf model from a gmf editor without parsing the xml model file? [message #645150 is a reply to message #645042] |
Wed, 15 December 2010 16:55 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Comments below.
iraklis wrote:
> Thanks.I finally figure it out and i can iterate throught my model
> with the EMF API.I have another question.
> I have an EClass at my ecore metamodel which has a connection to
> another Eclass.This EReference it is called connection at my
> ecore.What i am seeing at my xmi file after the creation of an
> instance of my metamodel is something like this :
> <?xml version="1.0" encoding="UTF-8"?>
> <atagmetamodel:ATAGPlan xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:atagmetamodel="http://atagmetamodel/1.0">
> <DataItem Name="Temp" Connection="//@InputChannel.0"/>
> <InputChannel Connection="//@Task.1" Interest="efd"/>
> <Task Name="Tempgen" Connection="//@OutputChannel.0"
> BasicInstantiationParameter="h" InstantiationAbilityAttribute="12"
> InstantiationRegionAttribute="all" ParameterforFiringRule="1"/>
> <Task Name="Temp" BasicInstantiationParameter="6"
> InstantiationAbilityAttribute="3" InstantiationRegionAttribute="2"
> ParameterforFiringRule="j"/>
> <OutputChannel Connection="//@DataItem.0" Interest="local"/>
> </atagmetamodel:ATAGPlan>
>
> As you can see each connection reference is like an attribute at the
> xmi file but it has a different syntax : //@<Type of the object that
> is connected to >.<number>
> How can i take advantage of this syntax and grab the connected
> object?I mean how could i know that //@OutputChannel1.0 indexes at my
> specific OutputChannel.There is no unique id identifier.
EMF handles the for you when deserializing so when you inspect your
in-memory instances you should just see the resolved objects themselves.
>
> Thank you
>
>
> Ed Merks wrote on Thu, 09 December 2010 16:58
>> Comments below.
>>
>> iraklis wrote:
>> > Ed Merks wrote on Thu, 09 December 2010 12:26
>> >> Is your model serialized to a file that's separate from GMF's >>
>> notation model for the diagram. If so, you can load that directly >>
>> and traverse it.
>> >>
>> >> iraklis wrote:
>> >> > I have successfully created a GMF editor which draws models
>> based >> on > my EMF model.What i wanted to do is to iterate through
>> the model >> > objects .Can this be achieved at runtime my plugin
>> code from >> without > having to read the xml file that the gmf
>> editor creates ?Is >> there such > an API from EMF?
>> >
>> >
>> > What do you mean separate from GMF notation?The model finally is
>> saved > into an xmi file.
>> The notation model (diagram) is saved to a file as well. Is it a
>> separate file from your domain model or the same file.
>> > Also i do not know how to start to traverse it.I do not want to use
>> > xml parsers etc.Is there any simple example which loads the xmi
>> file > and travers it?
>> If you invoke Generate Test Code there's an XyzExample.java that
>> shows how to load and save instances. I'd suggest reading some of
>> the introductory overview documentation before asking more questions.
>> > Thanks
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03272 seconds