[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] Re: [ATL] href in IN model

Miguel Llácer schrieb:
I don't know if you have understood me.

It seems that I don't.

I have a metamodel CatalogMM and this metamodel has an element Instance that has a reference (called type) to EModelElement of Ecore metamodel.

That's why it is important to have allowInterModelReferences switched on, only than the transformation will follow references to other model, like your UML.ecore.

An instance of this CatalogMM could be:
..
Instance
name - Clase1
type - Class->EncapsuledClassifier,BehavioredClassifier
Instance
name - Generalizacion1
type - Generalization->DirectedRelationship
..
In this model of CatalogMM, type reference of Instance elements is a reference to elements of UML.ecore as you can see.



So CatalogMM is youre M2 and ecore is your M1.


Now, when I want to transform this Catalog to another model, I have to check in my rules what is instance.type kind ?


As you tell me, I could do instance.type.oclIsTypeOf(UML"uml::Generalization") but the problem is

I thought your are transforming an UML model.

that instance.type.oclType() is CATALOG!EClass.

Indeed it is.

let s : String = '' in ('Instance
   '+UML!"uml::Generalization".name.toString()).println();

INFO: Instance Generalization

This is what you wanted, or better what you can get, the name of the EClass. And it is what instance.type.name should return.
This would be your discriminator, the name of the EClass in instance.type Generalization/Class .... what ever name the EClass has.


greetings, urs.