Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Problem with stereotype’s property with several values
[ATL] Problem with stereotype’s property with several values [message #96833] Wed, 10 December 2008 03:44 Go to next message
Rasha is currently offline RashaFriend
Messages: 61
Registered: July 2009
Member
Hi all,

I use this helper to get the value of the stereotype’s property

helper context UML!"uml::Class" def: getTagValue(stereotype :
String ,tag : String) : String=
self.getValue(self.getAppliedStereotype(stereotype),tag);

It works fine if the property has only one value, but if it has more than
one “array of string” it can work if I specify the first or last element
in the array. But I need to iterate over all the values in the array and
see if a specific value is exist. I tried to use “for” or “iterates()”,
but it didn’t work!

Any help is greatly appreciated,

Rasha
Re: [ATL] Problem with stereotype�s property with several values [message #96901 is a reply to message #96833] Thu, 11 December 2008 09:33 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi i don't understand your question
what you want is not a select ?

myCollec->select(s | s = ...)

Rasha a écrit :
> Hi all,
>
> I use this helper to get the value of the stereotype�s property
> helper context UML!"uml::Class" def: getTagValue(stereotype :
> String ,tag : String) : String=
> self.getValue(self.getAppliedStereotype(stereotype),tag);
>
> It works fine if the property has only one value, but if it has more
> than one �array of string� it can work if I specify the first or last
> element in the array. But I need to iterate over all the values in the
> array and see if a specific value is exist. I tried to use �for� or
> �iterates()�, but it didn�t work!
>
> Any help is greatly appreciated,
>
> Rasha
>
>




Re: [ATL] Problem with stereotypeï¿œs property with several values [message #96925 is a reply to message #96901] Thu, 11 December 2008 13:01 Go to previous messageGo to next message
Rasha is currently offline RashaFriend
Messages: 61
Registered: July 2009
Member
I try to copy a class according to the value of its stereotype’s property.
There is no problem if the property has only one value. But if it has more
than one value, I want to check if a specific value exists among these
values.

Property = [value_1, value_2, value_3]
If Property has value_2, I’ll copy this class.

The getValue() method returns in this case a sequence of value. I want to
iterate over this sequence to check if value_2 exists.

In another word, I need to iterate over the result of this method
self.getValue(self.getAppliedStereotype(stereotype),tag)

I tried to use self.getValue(self.getAppliedStereotype(stereotype),tag)->
select(c | c = 'value_2')but it didn't create a target model and didn't
raise any errors.

Thanks Tristan for your help,

Rasha
Re: [ATL] Problem with stereotype?s property with several values [message #97051 is a reply to message #96925] Thu, 11 December 2008 13:41 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
did you try to do debug() after your select maybe you should do a
first() after the select to specify that you want a value and not a
selection

self.getValue(self.getAppliedStereotype(stereotype),tag)
==> sequence
self.getValue(self.getAppliedStereotype(stereotype),tag)->select(c | c =
'value_2')
==> sequence
self.getValue(self.getAppliedStereotype(stereotype),tag)->select(c | c =
'value_2')->first()
==> value


Rasha a écrit :
> I try to copy a class according to the value of its stereotype�s
> property. There is no problem if the property has only one value. But if
> it has more than one value, I want to check if a specific value exists
> among these values.
>
> Property = [value_1, value_2, value_3] If Property has value_2, I�ll
> copy this class.
>
> The getValue() method returns in this case a sequence of value. I want
> to iterate over this sequence to check if value_2 exists.
> In another word, I need to iterate over the result of this method
> self.getValue(self.getAppliedStereotype(stereotype),tag)
> I tried to use
> self.getValue(self.getAppliedStereotype(stereotype),tag)-> select(c | c
> = 'value_2')but it didn't create a target model and didn't raise any
> errors.
>
> Thanks Tristan for your help,
>
> Rasha
>
>




Re: [ATL] Problem with stereotype?s property with several values [message #97083 is a reply to message #97051] Fri, 12 December 2008 14:12 Go to previous messageGo to next message
Rasha is currently offline RashaFriend
Messages: 61
Registered: July 2009
Member
Thanks Tristan a lot. I have another question for the Lazy rule. You said
that object is created once even I match it several times. I try to copy
the association between 2 classes, but I have to call the lazy rule which
copy the association twice from the Property rule because each association
has two properties.

rule Property{
from
s : UML!Property
to
t : UML!Property (
name <- s.name,
association <- thisModule.CopyAssociation(s.association) )

}
lazy rule Association{
from
s : UML!Association
to
t : UML!Association (
name <- s.name
)
}
It raise this error
message: trying to register several rules as default for element
IN!Cource-Student: 'CopyAssociation' and 'CopyAssociation'

is this because I called it twice? what did I miss here?

Thanks so much for your help,

Rasha
Re: [ATL] Problem with stereotype?s property with several values [message #97098 is a reply to message #97083] Fri, 12 December 2008 15:14 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi Rasha this message said that you have two rules able to manage the
object which is not permitted in ATL check that you don't have 2 from
able to match your association in standard rules

and it's strange that you call your lazy rule with this instruction
thisModule.CopyAssociation(s.association) while your lazy rule is
called Association maybe you should use :
thisModule.Association(s.association)

for the fact that object is created once i said the object is created
once for one object matched with unique lazy rule maybe your lazy rule
should be like this :
unique lazy rule Association{
from
s : UML!Association to
t : UML!Association (
name <- s.name
)
}

in fact i've never used "unique" lazy rule :p



Rasha a écrit :
> Thanks Tristan a lot. I have another question for the Lazy rule. You
> said that object is created once even I match it several times. I try to
> copy the association between 2 classes, but I have to call the lazy rule
> which copy the association twice from the Property rule because each
> association has two properties.
> rule Property{ from
> s : UML!Property to t : UML!Property ( name <- s.name,
> association <-
> thisModule.CopyAssociation(s.association) )
>
> }
> lazy rule Association{
> from
> s : UML!Association to t : UML!Association (
> name <- s.name
> )
> }
> It raise this error
> message: trying to register several rules as default for element
> IN!Cource-Student: 'CopyAssociation' and 'CopyAssociation'
>
> is this because I called it twice? what did I miss here?
>
> Thanks so much for your help,
>
> Rasha
>




Re: [ATL] Problem with stereotype?s property with several values [message #97272 is a reply to message #97098] Mon, 22 December 2008 05:48 Go to previous messageGo to next message
Rasha is currently offline RashaFriend
Messages: 61
Registered: July 2009
Member
Thanks Tristan for this magic word “unique”. It works fine. I’m trying now
to compare between two transformation files doing the same job but one has
to be faster than the other in producing the target model. Is there any
way to measure the time taken by the engine to do that? Something similar
to the time function in C language.
Re: [ATL] Problem with stereotype?s property with several values [message #97287 is a reply to message #97272] Mon, 22 December 2008 07:57 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi Rasha
One of my friend have designed a ATL profiler to profile ATL
transformations. The ATL team should have this contribution but i don't
know if it will be integrated a day.

Maybe some Obeo's member could answer ...

Rasha a écrit :
> Thanks Tristan for this magic word �unique�. It works fine. I�m trying
> now to compare between two transformation files doing the same job but
> one has to be faster than the other in producing the target model. Is
> there any way to measure the time taken by the engine to do that?
> Something similar to the time function in C language.




Re: [ATL] Problem with stereotype?s property with several values [message #97302 is a reply to message #97287] Mon, 22 December 2008 10:25 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 301
Registered: July 2009
Senior Member
Hello,

The profiler contribution is still here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=230906 and should be
compatible with the ATL 2.0 maintenance builds (and 2.0.0 release).

As we recently change a lot of things in the architecture, we were not
able to directly integrate that great contribution... but we are going
to work on it. In the best case it will be integrated in the next ATL
release (Galileo version).

Best regards,

William

Tristan FAURE a écrit :
> Hi Rasha
> One of my friend have designed a ATL profiler to profile ATL
> transformations. The ATL team should have this contribution but i don't
> know if it will be integrated a day.
>
> Maybe some Obeo's member could answer ...
>
> Rasha a écrit :
>> Thanks Tristan for this magic word �unique�. It works fine. I�m trying
>> now to compare between two transformation files doing the same job but
>> one has to be faster than the other in producing the target model. Is
>> there any way to measure the time taken by the engine to do that?
>> Something similar to the time function in C language.
Re: [ATL] Problem with stereotype?s property with several values [message #97343 is a reply to message #97302] Tue, 23 December 2008 09:02 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
to obtain the time an ATL transformation takes to execute you can check
the "print execution times..." in the advanced tab of the ATL run
configuration.
Re: [ATL] Problem with stereotype?s property with several values [message #97452 is a reply to message #97343] Sun, 04 January 2009 06:40 Go to previous message
Rasha is currently offline RashaFriend
Messages: 61
Registered: July 2009
Member
Thanks Skanker. This is exactly what I need.
Previous Topic:help creating generalization
Next Topic:[ATL] Is toString() operation not working on Real type?
Goto Forum:
  


Current Time: Fri Apr 19 23:15:53 GMT 2024

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

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

Back to the top