Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to save model file using xmi?
how to save model file using xmi? [message #635306] Tue, 26 October 2010 11:08 Go to next message
popjxc is currently offline popjxcFriend
Messages: 36
Registered: March 2010
Member
Hi all,

I use gmf generate a editor, and save graphics and model in two different files.

in my model file, it use xsi like the following:

<?xml version="1.0" encoding="UTF-8"?>
<model:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:model="http://model/1.0" name="Diagram">
  <transitions from="_tsqBwODtEd-r576wsnzzcA" to="_t1tQEODtEd-r576wsnzzcA" id="_uHgxwODtEd-r576wsnzzcA" type="transition"/>
  <nodes xsi:type="model:SQL" name="SQL" targets="_uHgxwODtEd-r576wsnzzcA" id="_tsqBwODtEd-r576wsnzzcA"/>
  <nodes xsi:type="model:File" name="File" sources="_uHgxwODtEd-r576wsnzzcA" id="_t1tQEODtEd-r576wsnzzcA"/>
</model:Diagram>


But I saw the saved file of the eclipse bpmn, in the model file it use xmi, like the following:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:BpmnDiagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:bpmn="http://stp.eclipse.org/bpmn" xmi:id="_6m9gIdK3Ed-akOyjfwNYew" iD="_6m9gINK3Ed-akOyjfwNYew">
  <artifacts xmi:type="bpmn:DataObject" xmi:id="_Rsf9UdTyEd-W5N3rDCZOsQ" iD="_Rsf9UNTyEd-W5N3rDCZOsQ">
    <associations xmi:type="bpmn:Association" xmi:id="_RtifINTyEd-W5N3rDCZOsQ"/>
  </artifacts>
  <pools xmi:type="bpmn:Pool" xmi:id="_6nQbEdK3Ed-akOyjfwNYew" iD="_6nQbENK3Ed-akOyjfwNYew" associations="_RtifINTyEd-W5N3rDCZOsQ" name="Pool">
    <vertices xmi:type="bpmn:Activity" xmi:id="_6clugeDhEd-Q7Yw7T3vQ_w" iD="_6clugODhEd-Q7Yw7T3vQ_w" activityType="Task" looping="true"/>
  </pools>
</bpmn:BpmnDiagram>


So, how can I change my 'xsi:type' to 'xmi:type', and add 'xmi:id' ?

Thanks very much!
Re: how to save model file using xmi? [message #635400 is a reply to message #635306] Tue, 26 October 2010 15:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Be sure to use a resource factory that created XMIResourceImpl instances
for serializing and deserializing your model.

popjxc wrote:
> Hi all,
>
> I use gmf generate a editor, and save graphics and model in two
> different files.
>
> in my model file, it use xsi like the following:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <model:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:model="http://model/1.0" name="Diagram">
> <transitions from="_tsqBwODtEd-r576wsnzzcA"
> to="_t1tQEODtEd-r576wsnzzcA" id="_uHgxwODtEd-r576wsnzzcA"
> type="transition"/>
> <nodes xsi:type="model:SQL" name="SQL"
> targets="_uHgxwODtEd-r576wsnzzcA" id="_tsqBwODtEd-r576wsnzzcA"/>
> <nodes xsi:type="model:File" name="File"
> sources="_uHgxwODtEd-r576wsnzzcA" id="_t1tQEODtEd-r576wsnzzcA"/>
> </model:Diagram>
>
>
> But I saw the saved file of the eclipse bpmn, in the model file it
> use xmi, like the following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <bpmn:BpmnDiagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:bpmn="http://stp.eclipse.org/bpmn"
> xmi:id="_6m9gIdK3Ed-akOyjfwNYew" iD="_6m9gINK3Ed-akOyjfwNYew">
> <artifacts xmi:type="bpmn:DataObject"
> xmi:id="_Rsf9UdTyEd-W5N3rDCZOsQ" iD="_Rsf9UNTyEd-W5N3rDCZOsQ">
> <associations xmi:type="bpmn:Association"
> xmi:id="_RtifINTyEd-W5N3rDCZOsQ"/>
> </artifacts>
> <pools xmi:type="bpmn:Pool" xmi:id="_6nQbEdK3Ed-akOyjfwNYew"
> iD="_6nQbENK3Ed-akOyjfwNYew" associations="_RtifINTyEd-W5N3rDCZOsQ"
> name="Pool">
> <vertices xmi:type="bpmn:Activity" xmi:id="_6clugeDhEd-Q7Yw7T3vQ_w"
> iD="_6clugODhEd-Q7Yw7T3vQ_w" activityType="Task" looping="true"/>
> </pools>
> </bpmn:BpmnDiagram>
>
>
> So, how can I change my 'xsi:type' to 'xmi:type', and add 'xmi:id' ?
>
> Thanks very much!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: how to save model file using xmi? [message #635481 is a reply to message #635400] Wed, 27 October 2010 02:16 Go to previous messageGo to next message
popjxc is currently offline popjxcFriend
Messages: 36
Registered: March 2010
Member
Ed Merks wrote on Tue, 26 October 2010 11:44
Be sure to use a resource factory that created XMIResourceImpl instances
for serializing and deserializing your model.



I have already use the extension:
   <extension point="org.eclipse.emf.ecore.extension_parser" id="resource-factory">
      <?gmfgen generated="true"?>
      <parser
         type="apj"
         class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
      </parser>
   </extension>


And the GMFResourceFactory is the subclass of XMIResourceFactoryImpl. I guess it will use XMIResourceImpl to serialize my model. Need I to do something more?

I'm a beginner of GMF, So could you give me a detail explain?

Thanks.
Re: how to save model file using xmi? [message #635561 is a reply to message #635481] Wed, 27 October 2010 10:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
It sounds like you'll want to use XMIResource.OPTION_USE_XMI_TYPE.


popjxc wrote:
> Ed Merks wrote on Tue, 26 October 2010 11:44
>> Be sure to use a resource factory that created XMIResourceImpl
>> instances for serializing and deserializing your model.
>
>
> I have already use the extension:
> <extension point="org.eclipse.emf.ecore.extension_parser"
> id="resource-factory">
> <?gmfgen generated="true"?>
> <parser
> type="apj"
>
> class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
> </parser>
> </extension>
>
>
> And the GMFResourceFactory is the subclass of XMIResourceFactoryImpl.
> I guess it will use XMIResourceImpl to serialize my model. Need I to
> do something more?
>
> I'm a beginner of GMF, So could you give me a detail explain?
>
> Thanks.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Cut, Copy, Paste EditPart: how to inhibit?
Next Topic:Custom behaviour for starting a swing application
Goto Forum:
  


Current Time: Fri Mar 29 09:19:37 GMT 2024

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

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

Back to the top