Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Model migration with Flock(Flock problem mapping attribute with 0 value)
Model migration with Flock [message #1737317] Thu, 07 July 2016 09:27 Go to next message
Gianluigi Proserpio is currently offline Gianluigi ProserpioFriend
Messages: 30
Registered: November 2015
Member
Hi,
migrating with Flock a model to a new version, I've some problem when an attribute in the original model have value of zero.
For instance, the original element:
<cimDiagramLayout:DiagramObjectPoint UUID="_730f02b0-6f95-11e2-89cb-00219b4fe24c" xPosition="0.0" sequenceNumber="0" DiagramObject="_730edba0-6f95-11e2-89cb-00219b4fe24c" yPosition="1247.0"/>

will be translated in the migrated model with

<cimDiagramLayout:DiagramObjectPoint xmi:id="_730f02b0-6f95-11e2-89cb-00219b4fe24c" UUID="_730f02b0-6f95-11e2-89cb-00219b4fe24c" yPosition="1247.0" DiagramObject="_730edba0-6f95-11e2-89cb-00219b4fe24c"/>

missing both xPosition="0.0" and sequenceNumber="0".

The Flock code is simply
retype DiagramObjectPoint to DiagramObjectPoint

The original ecore for xPosition is
<eStructuralFeatures xsi:type="ecore:EAttribute" name="xPosition" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"

The migrated is
<eStructuralFeatures xsi:type="ecore:EAttribute" name="xPosition" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#/0/EFloat"/>

Even if I change the last definition from
... #/0/EFloat
to
... #//EFloat
doesn't change the result.

By the way I obtain "http://www.eclipse.org/emf/2002/Ecore#/0/EFloat" using
t.eType := Ecore1!EDataType.all.selectOne(dt|dt.name = 'EFloat');
but I don't know why I get the /0/.

Thanks for your support,
Gianluigi
Re: Model migration with Flock [message #1737353 is a reply to message #1737317] Thu, 07 July 2016 14:09 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Gianluigi,

EMF doesn't serialise attributes that have default values. Does this explain the behaviour you're encountering?

Cheers,
Dimitris
Re: Model migration with Flock [message #1737359 is a reply to message #1737317] Thu, 07 July 2016 14:35 Go to previous messageGo to next message
Gianluigi Proserpio is currently offline Gianluigi ProserpioFriend
Messages: 30
Registered: November 2015
Member
Thanks Dimitris,
may be that's the reason.

Let me better explain our problem.
We need to serialize this model in RDF and, for interoperability objectives, the related schema request the presence of attributes, even if their value is the default.

There is any way to force in Flock the serialisation of attributes with defaul values ?

Gianluigi
Re: Model migration with Flock [message #1737367 is a reply to message #1737359] Thu, 07 July 2016 15:09 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Gianluigi,

Yes, there's a workaround for this. First, you'll need to assign a default value to the attribute of interest in your metamodel as below:

package def;

class Obj {
	attr int value = 0;
}


You should then un-tick the "Store on disposal" option in your model configuration dialog and add the following code in the post{} block of your Flock transformation:

var saveOptions = new Map;
saveOptions.put("KEEP_DEFAULT_CONTENT", true);
M.resource.save(saveOptions); // assuming that M is the name of the migrated model in the models tab of the run configuration


Does this help?

Cheers,
Dimitris
Re: Model migration with Flock [message #1737422 is a reply to message #1737367] Fri, 08 July 2016 06:09 Go to previous messageGo to next message
Gianluigi Proserpio is currently offline Gianluigi ProserpioFriend
Messages: 30
Registered: November 2015
Member
It works ! Thanks for your support, very appreciated.
One last thing (more a curiosity), could you let me know something about my last question in the first email (the additional "0" in http://www.eclipse.org/emf/2002/Ecore#/0/EFloat) ?

It seems that I always have some problems with zeros ... Razz
Re: Model migration with Flock [message #1737642 is a reply to message #1737422] Mon, 11 July 2016 14:29 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Gianluigi,

No clue I'm afraid (but this seems to be a recent change). I'd suggest posting a message about this to the EMF forum.

Cheers,
Dimitris
Re: Model migration with Flock [message #1737694 is a reply to message #1737642] Tue, 12 July 2016 05:49 Go to previous message
Gianluigi Proserpio is currently offline Gianluigi ProserpioFriend
Messages: 30
Registered: November 2015
Member
Ok, thanks again.
Cheers,
Gianluigi
Previous Topic:EOL: String related exceptions
Next Topic:Performance of Epsilon Validation
Goto Forum:
  


Current Time: Thu Mar 28 08:23:14 GMT 2024

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

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

Back to the top