Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Customizing saving Model to XMI via XMISaveImpl options
Customizing saving Model to XMI via XMISaveImpl options [message #986938] Thu, 22 November 2012 12:44 Go to next message
Alexander Unsonamed is currently offline Alexander UnsonamedFriend
Messages: 10
Registered: October 2012
Junior Member
Is there any possibility to extract model to XMI file with the following option:

<root>
...
  <box xmi:type="mymodel:Box" xmi:id="_123wefwefwjefgeg" name="GreatBox">
    <title>_k84xEzSoEeKTvczlP0YbOQ</title>
  </box>
</root>
...
<title xmi:id="_k84xEzSoEeKTvczlP0YbOQ" name="SomeTitle" elementType="NORMAL"/>


Instead of the following:
<root>
...
  <box xmi:type="mymodel:Box" xmi:id="_123wefwefwjefgeg" name="GreatBox" title="_k84xEzSoEeKTvczlP0YbOQ"/>
</root>
...
<title xmi:id="_k84xEzSoEeKTvczlP0YbOQ" name="SomeTitle" elementType="NORMAL"/>



I tried to play with Containment option of Box.title attr in Ecore model, but it seem's that I need to extends XMISaveImpl and change smth there.
Re: Customizing saving Model to XMI via XMISaveImpl options [message #986973 is a reply to message #986938] Thu, 22 November 2012 15:56 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi,

Add an annotation to your Box::title attribute in the Ecore model as follows:

source: http:///org/eclipse/emf/ecore/util/ExtendedMetaData
detail: kind -> element

Cheers,

Christian


On 2012-11-22 12:44:46 +0000, Alexander Unsonamed said:

> Is there any possibility to extract model to XMI file with the
> following option:
>
> <root>
> ..
> <box xmi:type="mymodel:Box" xmi:id="_123wefwefwjefgeg" name="GreatBox">
> <title>_k84xEzSoEeKTvczlP0YbOQ</title>
> </box>
> </root>
> ..
> <title xmi:id="_k84xEzSoEeKTvczlP0YbOQ" name="SomeTitle" elementType="NORMAL"/>
>
>
> Instead of the following:
>
> <root>
> ..
> <box xmi:type="mymodel:Box" xmi:id="_123wefwefwjefgeg"
> name="GreatBox" title="_k84xEzSoEeKTvczlP0YbOQ"/>
> </root>
> ..
> <title xmi:id="_k84xEzSoEeKTvczlP0YbOQ" name="SomeTitle" elementType="NORMAL"/>
>
>
>
> I tried to play with Containment option of Box.title attr in Ecore
> model, but it seem's that I need to extends XMISaveImpl and change smth
> there.
Re: Customizing saving Model to XMI via XMISaveImpl options [message #986975 is a reply to message #986973] Thu, 22 November 2012 16:22 Go to previous messageGo to next message
Alexander Unsonamed is currently offline Alexander UnsonamedFriend
Messages: 10
Registered: October 2012
Junior Member
Hi,

Can you be more specific?
Smth like this: http://habrastorage.org/storage2/171/efe/84c/171efe84cee2616ede4ea4c2a0633c72.png
Here, some Base class comprises semanticElement:SemanticElement attribute to which I added annotation.
Re: Customizing saving Model to XMI via XMISaveImpl options [message #986984 is a reply to message #986975] Thu, 22 November 2012 17:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Alexander,

Create an EAnnotation on the "title" EReference in your Ecore model as
Christian outlined and use XMLResource.OPTION_EXTENDED_METADATA mapped
to Boolean.TRUE in your save options map (or set save options in your
resource factory where you create your resource).

On 22/11/2012 5:22 PM, Alexander Unsonamed wrote:
> Hi,
>
> Can you be more specific?
> Smth like this: Here, some Base class comprises
> semanticElement:SemanticElement attribute to which I added annotation.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing saving Model to XMI via XMISaveImpl options [message #987041 is a reply to message #986984] Fri, 23 November 2012 07:05 Go to previous messageGo to next message
Alexander Unsonamed is currently offline Alexander UnsonamedFriend
Messages: 10
Registered: October 2012
Junior Member
Hi Ed,

> "use XMLResource.OPTION_EXTENDED_METADATA mapped
to Boolean.TRUE in your save options map" - done




> "Create an EAnnotation on the "title" EReference in your Ecore model as
Christian outlined"

I don't understand how to do that:
1. I added new child to "title" -> Eannotation
2. In the "Properties" view of "title" attr, we have only two properties:
- References: I set it's value to "title:Title"
- Source: I set it's value to http:///org/eclipse/emf/ecore/util/ExtendedMetaData

After reloading genmodel and regenerating Model Code nothing changes.
Re: Customizing saving Model to XMI via XMISaveImpl options [message #987042 is a reply to message #987041] Fri, 23 November 2012 07:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Alexander,

Comments below.

On 23/11/2012 8:05 AM, Alexander Unsonamed wrote:
> Hi Ed,
>
>> "use XMLResource.OPTION_EXTENDED_METADATA mapped
> to Boolean.TRUE in your save options map" - done
>
>
>
>
>> "Create an EAnnotation on the "title" EReference in your Ecore model as
> Christian outlined"
> I don't understand how to do that:
> 1. I added new child to "title" -> Eannotation
> 2. In the "Properties" view of "title" attr, we have only two properties:
> - References: I set it's value to "title:Title"
Don't do that.
> - Source: I set it's value to
> http:///org/eclipse/emf/ecore/util/ExtendedMetaData
Yes.

And then create a "Details Entry" under the EAnnotation to hold the
key-value pair.
>
> After reloading genmodel and regenerating Model Code nothing changes.
How do you detect changes? I'd expect the generate XyzPackageImpl to
change because of the annotation, but it's easy not to notice that. That
information is used by the serializer when you direct it to look at such
annotations via that save option.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing saving Model to XMI via XMISaveImpl options [message #987088 is a reply to message #987042] Fri, 23 November 2012 11:44 Go to previous message
Alexander Unsonamed is currently offline Alexander UnsonamedFriend
Messages: 10
Registered: October 2012
Junior Member
Ed,

Thank you, again.
That works perfectly.
Previous Topic:[CDO/SWT.Virtual] Virtual tables and CDOPrefetch
Next Topic:getting editing domain from resource set
Goto Forum:
  


Current Time: Tue Apr 23 08:14:43 GMT 2024

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

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

Back to the top