[ATL] href in IN model [message #78914] |
Fri, 11 April 2008 07:46  |
Eclipse User |
|
|
|
Hi,
I have another problem with references between models.
I have an element Instance in metamodel which has a reference (type) to
the Ecore element EModelElement.
When I create a model, and load UML.ecore as resource, I can select in
reference type the type of the element that I want to represente.
An example:
Instance - type = Class->EncapsuledClassifer,BehavioredClassifer
something like this:
<instance name="clase">
<type xsi:type="ecore:EClass" href="UML.ecore#//Class"/>
</instance>
I am doing a transformation and I want to compare the value of
instance.type (which is Class->EncapsuledClassifer,BehavioredClassifer)
with UML!Class but I don't know how do this.
|
|
|
|
|
|
|
Re: [ATL] href in IN model [message #79231 is a reply to message #79173] |
Tue, 15 April 2008 09:24   |
Eclipse User |
|
|
|
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.
|
|
|
|
Re: [ATL] href in IN model [message #79405 is a reply to message #79245] |
Wed, 16 April 2008 12:09   |
Eclipse User |
|
|
|
Miguel Llácer schrieb:
> Yes, I have, all the time, allow inter-model references switched on.
>
>> 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.
>
> As you say, what I want is to discriminate instance.type but the problem
> is that
> instance.type returns IN!<notnamedyet> and
> instance.type.name returns OclUndefined and not Generalization/Class.
>
> I don't understand why.
>
This is quite odd, and unexpected, based on our assumptions.
greetings, urs.
|
|
|
Re: [ATL] href in IN model [message #81098 is a reply to message #79405] |
Mon, 12 May 2008 03:44  |
Eclipse User |
|
|
|
Finally I have solved it.
The solution has been to change the type reference (to the EModelElement)
that I had put to Instance element and reference the EObject element.
It should have worked with EModelElement reference but ATL results weren't
as we thought.
That's all, thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.07058 seconds