Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] href in IN model
[ATL] href in IN model [message #78914] Fri, 11 April 2008 11:46 Go to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
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 #78924 is a reply to message #78914] Fri, 11 April 2008 12:08 Go to previous messageGo to next message
urs zeidler is currently offline urs zeidlerFriend
Messages: 91
Registered: July 2009
Member
Miguel Llácer schrieb:

> 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.
>
>
What do mean with compare ?
Do you want to test instance.type is a Type of "uml::Class" ?
It would be instance.type.oclIsTypeOf(UML!"uml::Class") .

urs.
Re: [ATL] href in IN model [message #79056 is a reply to message #78924] Mon, 14 April 2008 14:47 Go to previous messageGo to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
That's a good idea but the problem is that instance.type.oclType() always
returns MyMETAMODEL!EClass and it is correct because instance.type is a
reference to EModelElement from Ecore.

Another problem is that instance.type or instance.type.name should return
something like UML!Class or UML!Generalization but in screen appears
IN<notnamedyet>.

The only I think that I could do is to obtain the value of href
("UML.ecore#//Generalization") and compare as strings with
UML!"uml::Class".name. Is it possible ?¿?

Thanks
Re: [ATL] href in IN model [message #79151 is a reply to message #79056] Tue, 15 April 2008 08:05 Go to previous messageGo to next message
urs zeidler is currently offline urs zeidlerFriend
Messages: 91
Registered: July 2009
Member
Miguel Llácer schrieb:
> That's a good idea but the problem is that instance.type.oclType()
> always returns MyMETAMODEL!EClass and it is correct because
> instance.type is a reference to EModelElement from Ecore.
>
OK you transform ECORE 2 ECORE so you don't have a metamodel UML.
> Another problem is that instance.type or instance.type.name should
> return something like UML!Class or UML!Generalization but in screen
> appears IN<notnamedyet>.
>
Did you switch allowInterModelReferences on ? On Ecore Level
UML.ecore#//Class is an EClass with name Class, instance.type.name
should return "Class"
> The only I think that I could do is to obtain the value of href
> ("UML.ecore#//Generalization") and compare as strings with
> UML!"uml::Class".name. Is it possible ?¿?
>
If you don't have a metamodel called UML in your transformation, forget
about UML!xxx if your M1 is Ecore you need to work with Ecore not UML.

greetings, urs.
Re: [ATL] href in IN model [message #79173 is a reply to message #79151] Tue, 15 April 2008 10:20 Go to previous messageGo to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
I don't know if you have understood me.

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

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.


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
that instance.type.oclType() is CATALOG!EClass.
I thought that instance.type.name as you tell me too, should return
Generalization or Class but it return as this reference (instance.type)
doesn't reference to any element of UML.ecore.

I copy a fragment of my atl code an its result:
ATL CODE
let s : String = '' in ('Instance '+elem.type.toString()).println();
let s : String = '' in ('Instance
'+elem.type.oclType().toString()).println();
let s : String = '' in ('Instance
'+elem.type.name.oclType().toString()).println();
let s : String = '' in ('Instance
'+UML!"uml::Generalization".name.toString()).println();
let s : String = '' in ('Instance
'+UML!"uml::Generalization".oclType().toString()).println();

RESULT EXECUTION
INFO: Instance IN!<notnamedyet>
INFO: Instance OclUndefined
INFO: Instance CATALOG!EClass
INFO: Instance Generalization
INFO: Instance MOF!EClass

What is it happening ?¿
Re: [ATL] href in IN model [message #79231 is a reply to message #79173] Tue, 15 April 2008 13:24 Go to previous messageGo to next message
urs zeidler is currently offline urs zeidlerFriend
Messages: 91
Registered: July 2009
Member
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 #79245 is a reply to message #79231] Tue, 15 April 2008 13:45 Go to previous messageGo to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
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.
Re: [ATL] href in IN model [message #79405 is a reply to message #79245] Wed, 16 April 2008 16:09 Go to previous messageGo to next message
urs zeidler is currently offline urs zeidlerFriend
Messages: 91
Registered: July 2009
Member
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 07:44 Go to previous message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
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.
Previous Topic:[ATL] ATL API strangeness
Next Topic:Assertion Failed Exception
Goto Forum:
  


Current Time: Wed Jul 17 21:48:55 GMT 2019

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

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

Back to the top