How to obtain the id of a node

Hi, I am exporting models from MPS. Basically I export all the models as trees, this schema works decently with children but it does not work with references. To do that I would need to assign an ID to every node. Does not have they already an ID? How can I access it?
3 comments
Comment actions Permalink
Yes, all nodes in MPS have ids, unique in scope of model. You can obtain the id from SNode class: SNode.getSNodeId().

If you have a node<Concept> - typed variable, you can cast it to SNode or use the "downcase to lower semantics level" operation:
node<Concept> n;
n/.getSNodeId();

Regards,
Mihail
0
Comment actions Permalink
thank you, this is exactly what I was looking for!

Regards,

Federico
0
Comment actions Permalink

For dearest Googlers, I'm using this now:

interface concept behavior IIdConcept {                                       public string getId() { 
this/.getConcept().getName() + this/.getNodeId().toString();
}
}
// For
concept GeographicSite extends BaseConcept implements IIdConcept

// It makes Ids like this:
// GeographicSite8458086500259349004

 

0

Please sign in to leave a comment.