Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » how to read xmi:id fields in models files?
how to read xmi:id fields in models files? [message #1834183] Wed, 04 November 2020 12:05 Go to next message
Fatima Rani is currently offline Fatima RaniFriend
Messages: 22
Registered: April 2020
Junior Member
Hi ! my all meta-models are registered,i want to read the xmi:id field of the model file but unable to retrieve its value,any suggestion?

model file :

?xml version="1.0" encoding="UTF-8"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="" xmlns:xsi="" xmlns:abcd="https://petrinetdsl" xmlns:ecore="" xmlns:notation="" xmi:id="_vSD84LHJEeq1h8ti2UwKzQ" type="Petrinetdsl" name="default.petrinetdsl_diagram" measurementUnit="Pixel">
<children xmi:type="notation:Node" xmi:id="_qLutgLHPEeqGGrut8ExKFg" type="2001">
<children xmi:type="notation:DecorationNode" xmi:id="_qLxJwLHPEeqGGrut8ExKFg" type="5001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_qLxJwbHPEeqGGrut8ExKFg" x="-78" y="7"/>
<styles xmi:type="notation:DescriptionStyle" xmi:id="_qLvUkLHPEeqGGrut8ExKFg"/>
<element xmi:type="abcd:Place" href="default.petrinetdsl#//@places.0"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_qLvUkbHPEeqGGrut8ExKFg" x="259" y="175"/>

my code for reading different key and values
[for (aNode: Node | aDiagram.children)]

Re: how to read xmi:id fields in models files? [message #1834200 is a reply to message #1834183] Wed, 04 November 2020 19:42 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7636
Registered: July 2009
Senior Member

Standard answer. The xmi:is is an artefact of XMI serialization, it is not part of your model. (If your model was read from a model database there might be a table/row id instead.) You should therefore not seek to use it for any non-debugging purpose.

If you have legitimate need to mess with the xmi:ids, perhaps to stabilize them then perhaps you should ensure that your XXXResourceImpl generates nice xmi:ids. The Eclipse OCL Locally Unique Semantically Sensitive ID generator does this.

If xmi:ids are really part of your domain then maybe you should do an XML2XML transformation so that the XMI structure is explicit. The /org.eclipse.qvtd.xml/model/XMLmodel.ecore supports this. See for more details.

Or if you are determined to undermine the modeling integrity you may find that your favourite M2M / M2T has a getXmiID helper that is useful in debug printouts. Else you can write your own helper.


Ed Willink
Previous Topic:Make Acceleo usable by non-programmers
Next Topic:Read Stereotype / compare Stereotype
Goto Forum:

Current Time: Mon Dec 11 09:23:05 GMT 2023

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

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

Back to the top