Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » template expansion
template expansion [message #472105] Tue, 03 April 2007 03:31 Go to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
I only recently started to get familiar with the support for templates
in UML2. One thing that I am missing is the ability of expanding a
template binding in a way that would generate a new element from a bound
element by effecting all template parameter substitutions. Is there
anything like that in UML or at least in UML2? Or is this something that
tools have to do themselves?

Thanks,

Rafael
Re: template expansion [message #472210 is a reply to message #472105] Tue, 03 April 2007 14:38 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
This is my motivation for asking this question: imagine you have the
following classes in your model:

class Car

class List<T>
operation get(i : Integer) : T

Now consider an activity wants to call get(Integer) on an object whose
type is List<Car>. In the CallOperationAction, what would be the operation
element referred to? The generic version? Or should the generic get
operation be somehow expanded, generating a List<Car> specific operation,
and that operation be referred?
Re: template expansion [message #472211 is a reply to message #472105] Tue, 03 April 2007 14:47 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Rafael,

That is currently lacking from the UML API but it is on the TODO list.
The way I see it, it would work somewhat like the package merge does now in
UMLUtil.

I don't think there is a bugzilla for that so you if you really need that
functionality, you can create a bugzilla to make an official request.

Regards,

- James.


"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:eushp4$bpd$1@build.eclipse.org...
> I only recently started to get familiar with the support for templates
> in UML2. One thing that I am missing is the ability of expanding a
> template binding in a way that would generate a new element from a bound
> element by effecting all template parameter substitutions. Is there
> anything like that in UML or at least in UML2? Or is this something that
> tools have to do themselves?
>
> Thanks,
>
> Rafael
Re: template expansion [message #472212 is a reply to message #472211] Tue, 03 April 2007 16:06 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
James Bruck wrote:

> That is currently lacking from the UML API but it is on the TODO list.
> The way I see it, it would work somewhat like the package merge does now in
> UMLUtil.

That is what I expected too.

> I don't think there is a bugzilla for that so you if you really need that
> functionality, you can create a bugzilla to make an official request.

Done. https://bugs.eclipse.org/bugs/show_bug.cgi?id=180744

Thanks,

Rafael
Re: template expansion [message #472213 is a reply to message #472210] Tue, 03 April 2007 16:37 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Rafael,

There is no menu option to create a new "merged" version of a class with all
the substitutions applied.
What does exist is the ability to convert your fully specified UML to ecore
and vice versa.

- James.


"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
> This is my motivation for asking this question: imagine you have the
> following classes in your model:
>
> class Car
>
> class List<T>
> operation get(i : Integer) : T
>
> Now consider an activity wants to call get(Integer) on an object whose
> type is List<Car>. In the CallOperationAction, what would be the operation
> element referred to? The generic version? Or should the generic get
> operation be somehow expanded, generating a List<Car> specific operation,
> and that operation be referred?
>
Re: template expansion [message #472215 is a reply to message #472213] Tue, 03 April 2007 17:20 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
James, it seems you misunderstood my comment (I did not ask for any UI
support, for instance). It was just an expansion of my own original post
(that one you understood correctly, as you replied with very relevant
comments). Let me try to rephrase my question.

I understand per your other reply that there is no support for automatic
expansion of templates, but let's ignore that fact for now, as my question
here has more to do with UML practices than with UML2 per se.

I was just trying to make sure I understood what to do if I wanted to
reference elements in a bound element that are actually defined in the
template, should I expand the bound element first (so it has all the
elements defined in the template), or should I just reference the original
element.

Again, in my example:

class Car

class List<T>
operation get(i : Integer) : T

If I wanted to refer to invoke the operation "get" on a List<Car>, should
I just refer to the generic operation as defined in List<T>, or should I
first expand List<Car> as:

class List_Of_Car
operation get(i : Integer) : Car

and then refer to this specific "get" operation instead.

I looked for info on this in the spec but could not find anything.

Thanks

Rafael

James Bruck wrote:

> Rafael,

> There is no menu option to create a new "merged" version of a class with all
> the substitutions applied.
> What does exist is the ability to convert your fully specified UML to ecore
> and vice versa.

> - James.


> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>> This is my motivation for asking this question: imagine you have the
>> following classes in your model:
>>
>> class Car
>>
>> class List<T>
>> operation get(i : Integer) : T
>>
>> Now consider an activity wants to call get(Integer) on an object whose
>> type is List<Car>. In the CallOperationAction, what would be the operation
>> element referred to? The generic version? Or should the generic get
>> operation be somehow expanded, generating a List<Car> specific operation,
>> and that operation be referred?
>>
Re: template expansion [message #472220 is a reply to message #472215] Tue, 03 April 2007 20:47 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Rafael,

The two representations are supposed to be semantically equivalent, but I
would think that it's not generally a good idea to reference the template
representations of things from non-templates...

Kenn

"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:556811df69c76fc7cc955159ea8a7703$1@www.eclipse.org...
> James, it seems you misunderstood my comment (I did not ask for any UI
> support, for instance). It was just an expansion of my own original post
> (that one you understood correctly, as you replied with very relevant
> comments). Let me try to rephrase my question.
>
> I understand per your other reply that there is no support for automatic
> expansion of templates, but let's ignore that fact for now, as my question
> here has more to do with UML practices than with UML2 per se.
>
> I was just trying to make sure I understood what to do if I wanted to
> reference elements in a bound element that are actually defined in the
> template, should I expand the bound element first (so it has all the
> elements defined in the template), or should I just reference the original
> element.
>
> Again, in my example:
>
> class Car
>
> class List<T>
> operation get(i : Integer) : T
>
> If I wanted to refer to invoke the operation "get" on a List<Car>, should
> I just refer to the generic operation as defined in List<T>, or should I
> first expand List<Car> as:
>
> class List_Of_Car
> operation get(i : Integer) : Car
>
> and then refer to this specific "get" operation instead.
>
> I looked for info on this in the spec but could not find anything.
>
> Thanks
>
> Rafael
>
> James Bruck wrote:
>
>> Rafael,
>
>> There is no menu option to create a new "merged" version of a class with
>> all
>> the substitutions applied.
>> What does exist is the ability to convert your fully specified UML to
>> ecore
>> and vice versa.
>
>> - James.
>
>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>>> This is my motivation for asking this question: imagine you have the
>>> following classes in your model:
>>>
>>> class Car
>>>
>>> class List<T>
>>> operation get(i : Integer) : T
>>>
>>> Now consider an activity wants to call get(Integer) on an object whose
>>> type is List<Car>. In the CallOperationAction, what would be the
>>> operation
>>> element referred to? The generic version? Or should the generic get
>>> operation be somehow expanded, generating a List<Car> specific
>>> operation,
>>> and that operation be referred?
>>>
>
>
Re: template expansion [message #472227 is a reply to message #472220] Wed, 04 April 2007 19:57 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
Kenn, so if I understood well, there isn't a single right way.

I guess I agree with your position on the issue of referring to
templates from non-template elements. But at the same time, I feel that
expanding bound elements will lose information that might be useful
later on (for instance, when generating code in a language that supports
parametric types). Unless I am missing something.

I guess what I would really like to see was some way of figuring out the
template binding that generated any given bound element in expanded form
(just annotated bug 180744 with that information).

Rafael

Kenn Hussey wrote:
> Rafael,
>
> The two representations are supposed to be semantically equivalent, but I
> would think that it's not generally a good idea to reference the template
> representations of things from non-templates...
>
> Kenn
>
> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
> news:556811df69c76fc7cc955159ea8a7703$1@www.eclipse.org...
>> James, it seems you misunderstood my comment (I did not ask for any UI
>> support, for instance). It was just an expansion of my own original post
>> (that one you understood correctly, as you replied with very relevant
>> comments). Let me try to rephrase my question.
>>
>> I understand per your other reply that there is no support for automatic
>> expansion of templates, but let's ignore that fact for now, as my question
>> here has more to do with UML practices than with UML2 per se.
>>
>> I was just trying to make sure I understood what to do if I wanted to
>> reference elements in a bound element that are actually defined in the
>> template, should I expand the bound element first (so it has all the
>> elements defined in the template), or should I just reference the original
>> element.
>>
>> Again, in my example:
>>
>> class Car
>>
>> class List<T>
>> operation get(i : Integer) : T
>>
>> If I wanted to refer to invoke the operation "get" on a List<Car>, should
>> I just refer to the generic operation as defined in List<T>, or should I
>> first expand List<Car> as:
>>
>> class List_Of_Car
>> operation get(i : Integer) : Car
>>
>> and then refer to this specific "get" operation instead.
>>
>> I looked for info on this in the spec but could not find anything.
>>
>> Thanks
>>
>> Rafael
>>
>> James Bruck wrote:
>>
>>> Rafael,
>>> There is no menu option to create a new "merged" version of a class with
>>> all
>>> the substitutions applied.
>>> What does exist is the ability to convert your fully specified UML to
>>> ecore
>>> and vice versa.
>>> - James.
>>
>>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>>> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>>>> This is my motivation for asking this question: imagine you have the
>>>> following classes in your model:
>>>>
>>>> class Car
>>>>
>>>> class List<T>
>>>> operation get(i : Integer) : T
>>>>
>>>> Now consider an activity wants to call get(Integer) on an object whose
>>>> type is List<Car>. In the CallOperationAction, what would be the
>>>> operation
>>>> element referred to? The generic version? Or should the generic get
>>>> operation be somehow expanded, generating a List<Car> specific
>>>> operation,
>>>> and that operation be referred?
>>>>
>>
>
>
Re: template expansion [message #472497 is a reply to message #472227] Mon, 09 April 2007 01:09 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Some comments below...

"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:ev0vv0$hie$1@build.eclipse.org...
> Kenn, so if I understood well, there isn't a single right way.
>
> I guess I agree with your position on the issue of referring to
> templates from non-template elements. But at the same time, I feel that
> expanding bound elements will lose information that might be useful later
> on (for instance, when generating code in a language that supports
> parametric types). Unless I am missing something.
>
> I guess what I would really like to see was some way of figuring out the
> template binding that generated any given bound element in expanded form
> (just annotated bug 180744 with that information).

From the above paragraph it seems that... to paraphrase...: Given a bound
element in expanded form, you want to know the template binding that
generated it. Since there are many different ways that an element could
be bound ... ie by either substituting default parameters or via multiple
bindings I'm not sure if there is a definitive way of doing this (although I
have not thought about this in great detail)
This seems to be a little bit different from what you ask for in the bug
detail... "Ideally, on the expanded form, there would be a way of telling
apart things that were defined in the element itself from those coming from
a template binding expansion.". This request seems possible since we could
annotate the expanded model while applying the substitutions.

- James


>
> Rafael
>
> Kenn Hussey wrote:
>> Rafael,
>>
>> The two representations are supposed to be semantically equivalent, but I
>> would think that it's not generally a good idea to reference the template
>> representations of things from non-templates...
>>
>> Kenn
>>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:556811df69c76fc7cc955159ea8a7703$1@www.eclipse.org...
>>> James, it seems you misunderstood my comment (I did not ask for any UI
>>> support, for instance). It was just an expansion of my own original post
>>> (that one you understood correctly, as you replied with very relevant
>>> comments). Let me try to rephrase my question.
>>>
>>> I understand per your other reply that there is no support for automatic
>>> expansion of templates, but let's ignore that fact for now, as my
>>> question here has more to do with UML practices than with UML2 per se.
>>>
>>> I was just trying to make sure I understood what to do if I wanted to
>>> reference elements in a bound element that are actually defined in the
>>> template, should I expand the bound element first (so it has all the
>>> elements defined in the template), or should I just reference the
>>> original element.
>>>
>>> Again, in my example:
>>>
>>> class Car
>>>
>>> class List<T>
>>> operation get(i : Integer) : T
>>>
>>> If I wanted to refer to invoke the operation "get" on a List<Car>,
>>> should I just refer to the generic operation as defined in List<T>, or
>>> should I first expand List<Car> as:
>>>
>>> class List_Of_Car
>>> operation get(i : Integer) : Car
>>>
>>> and then refer to this specific "get" operation instead.
>>>
>>> I looked for info on this in the spec but could not find anything.
>>>
>>> Thanks
>>>
>>> Rafael
>>>
>>> James Bruck wrote:
>>>
>>>> Rafael,
>>>> There is no menu option to create a new "merged" version of a class
>>>> with all
>>>> the substitutions applied.
>>>> What does exist is the ability to convert your fully specified UML to
>>>> ecore
>>>> and vice versa.
>>>> - James.
>>>
>>>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>>>> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>>>>> This is my motivation for asking this question: imagine you have the
>>>>> following classes in your model:
>>>>>
>>>>> class Car
>>>>>
>>>>> class List<T>
>>>>> operation get(i : Integer) : T
>>>>>
>>>>> Now consider an activity wants to call get(Integer) on an object whose
>>>>> type is List<Car>. In the CallOperationAction, what would be the
>>>>> operation
>>>>> element referred to? The generic version? Or should the generic get
>>>>> operation be somehow expanded, generating a List<Car> specific
>>>>> operation,
>>>>> and that operation be referred?
>>>>>
>>>
>>
>>
>
Re: template expansion [message #472498 is a reply to message #472215] Mon, 09 April 2007 01:20 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Rafael,

.... I meant additional API that could be exposed through the example UI ..
but I understand that you are requesting support for template expansion...

....I believe Kenn answered your second question about how to refer to
specific "get" operation in the example below....

- James.

"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:556811df69c76fc7cc955159ea8a7703$1@www.eclipse.org...
> James, it seems you misunderstood my comment (I did not ask for any UI
> support, for instance). It was just an expansion of my own original post
> (that one you understood correctly, as you replied with very relevant
> comments). Let me try to rephrase my question.
>
> I understand per your other reply that there is no support for automatic
> expansion of templates, but let's ignore that fact for now, as my question
> here has more to do with UML practices than with UML2 per se.
>
> I was just trying to make sure I understood what to do if I wanted to
> reference elements in a bound element that are actually defined in the
> template, should I expand the bound element first (so it has all the
> elements defined in the template), or should I just reference the original
> element.
>
> Again, in my example:
>
> class Car
>
> class List<T>
> operation get(i : Integer) : T
>
> If I wanted to refer to invoke the operation "get" on a List<Car>, should
> I just refer to the generic operation as defined in List<T>, or should I
> first expand List<Car> as:
>
> class List_Of_Car
> operation get(i : Integer) : Car
>
> and then refer to this specific "get" operation instead.
>
> I looked for info on this in the spec but could not find anything.
>
> Thanks
>
> Rafael
>
> James Bruck wrote:
>
>> Rafael,
>
>> There is no menu option to create a new "merged" version of a class with
>> all
>> the substitutions applied.
>> What does exist is the ability to convert your fully specified UML to
>> ecore
>> and vice versa.
>
>> - James.
>
>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>>> This is my motivation for asking this question: imagine you have the
>>> following classes in your model:
>>>
>>> class Car
>>>
>>> class List<T>
>>> operation get(i : Integer) : T
>>>
>>> Now consider an activity wants to call get(Integer) on an object whose
>>> type is List<Car>. In the CallOperationAction, what would be the
>>> operation
>>> element referred to? The generic version? Or should the generic get
>>> operation be somehow expanded, generating a List<Car> specific
>>> operation,
>>> and that operation be referred?
>>>
>
>
Re: template expansion [message #604245 is a reply to message #472105] Tue, 03 April 2007 14:38 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
This is my motivation for asking this question: imagine you have the
following classes in your model:

class Car

class List<T>
operation get(i : Integer) : T

Now consider an activity wants to call get(Integer) on an object whose
type is List<Car>. In the CallOperationAction, what would be the operation
element referred to? The generic version? Or should the generic get
operation be somehow expanded, generating a List<Car> specific operation,
and that operation be referred?
Re: template expansion [message #604252 is a reply to message #472105] Tue, 03 April 2007 14:47 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Rafael,

That is currently lacking from the UML API but it is on the TODO list.
The way I see it, it would work somewhat like the package merge does now in
UMLUtil.

I don't think there is a bugzilla for that so you if you really need that
functionality, you can create a bugzilla to make an official request.

Regards,

- James.


"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:eushp4$bpd$1@build.eclipse.org...
> I only recently started to get familiar with the support for templates
> in UML2. One thing that I am missing is the ability of expanding a
> template binding in a way that would generate a new element from a bound
> element by effecting all template parameter substitutions. Is there
> anything like that in UML or at least in UML2? Or is this something that
> tools have to do themselves?
>
> Thanks,
>
> Rafael
Re: template expansion [message #604254 is a reply to message #472211] Tue, 03 April 2007 16:06 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
James Bruck wrote:

> That is currently lacking from the UML API but it is on the TODO list.
> The way I see it, it would work somewhat like the package merge does now in
> UMLUtil.

That is what I expected too.

> I don't think there is a bugzilla for that so you if you really need that
> functionality, you can create a bugzilla to make an official request.

Done. https://bugs.eclipse.org/bugs/show_bug.cgi?id=180744

Thanks,

Rafael
Re: template expansion [message #605362 is a reply to message #472210] Tue, 03 April 2007 16:37 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Rafael,

There is no menu option to create a new "merged" version of a class with all
the substitutions applied.
What does exist is the ability to convert your fully specified UML to ecore
and vice versa.

- James.


"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
> This is my motivation for asking this question: imagine you have the
> following classes in your model:
>
> class Car
>
> class List<T>
> operation get(i : Integer) : T
>
> Now consider an activity wants to call get(Integer) on an object whose
> type is List<Car>. In the CallOperationAction, what would be the operation
> element referred to? The generic version? Or should the generic get
> operation be somehow expanded, generating a List<Car> specific operation,
> and that operation be referred?
>
Re: template expansion [message #605374 is a reply to message #472213] Tue, 03 April 2007 17:20 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
James, it seems you misunderstood my comment (I did not ask for any UI
support, for instance). It was just an expansion of my own original post
(that one you understood correctly, as you replied with very relevant
comments). Let me try to rephrase my question.

I understand per your other reply that there is no support for automatic
expansion of templates, but let's ignore that fact for now, as my question
here has more to do with UML practices than with UML2 per se.

I was just trying to make sure I understood what to do if I wanted to
reference elements in a bound element that are actually defined in the
template, should I expand the bound element first (so it has all the
elements defined in the template), or should I just reference the original
element.

Again, in my example:

class Car

class List<T>
operation get(i : Integer) : T

If I wanted to refer to invoke the operation "get" on a List<Car>, should
I just refer to the generic operation as defined in List<T>, or should I
first expand List<Car> as:

class List_Of_Car
operation get(i : Integer) : Car

and then refer to this specific "get" operation instead.

I looked for info on this in the spec but could not find anything.

Thanks

Rafael

James Bruck wrote:

> Rafael,

> There is no menu option to create a new "merged" version of a class with all
> the substitutions applied.
> What does exist is the ability to convert your fully specified UML to ecore
> and vice versa.

> - James.


> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>> This is my motivation for asking this question: imagine you have the
>> following classes in your model:
>>
>> class Car
>>
>> class List<T>
>> operation get(i : Integer) : T
>>
>> Now consider an activity wants to call get(Integer) on an object whose
>> type is List<Car>. In the CallOperationAction, what would be the operation
>> element referred to? The generic version? Or should the generic get
>> operation be somehow expanded, generating a List<Car> specific operation,
>> and that operation be referred?
>>
Re: template expansion [message #605398 is a reply to message #472215] Tue, 03 April 2007 20:47 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Rafael,

The two representations are supposed to be semantically equivalent, but I
would think that it's not generally a good idea to reference the template
representations of things from non-templates...

Kenn

"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:556811df69c76fc7cc955159ea8a7703$1@www.eclipse.org...
> James, it seems you misunderstood my comment (I did not ask for any UI
> support, for instance). It was just an expansion of my own original post
> (that one you understood correctly, as you replied with very relevant
> comments). Let me try to rephrase my question.
>
> I understand per your other reply that there is no support for automatic
> expansion of templates, but let's ignore that fact for now, as my question
> here has more to do with UML practices than with UML2 per se.
>
> I was just trying to make sure I understood what to do if I wanted to
> reference elements in a bound element that are actually defined in the
> template, should I expand the bound element first (so it has all the
> elements defined in the template), or should I just reference the original
> element.
>
> Again, in my example:
>
> class Car
>
> class List<T>
> operation get(i : Integer) : T
>
> If I wanted to refer to invoke the operation "get" on a List<Car>, should
> I just refer to the generic operation as defined in List<T>, or should I
> first expand List<Car> as:
>
> class List_Of_Car
> operation get(i : Integer) : Car
>
> and then refer to this specific "get" operation instead.
>
> I looked for info on this in the spec but could not find anything.
>
> Thanks
>
> Rafael
>
> James Bruck wrote:
>
>> Rafael,
>
>> There is no menu option to create a new "merged" version of a class with
>> all
>> the substitutions applied.
>> What does exist is the ability to convert your fully specified UML to
>> ecore
>> and vice versa.
>
>> - James.
>
>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>>> This is my motivation for asking this question: imagine you have the
>>> following classes in your model:
>>>
>>> class Car
>>>
>>> class List<T>
>>> operation get(i : Integer) : T
>>>
>>> Now consider an activity wants to call get(Integer) on an object whose
>>> type is List<Car>. In the CallOperationAction, what would be the
>>> operation
>>> element referred to? The generic version? Or should the generic get
>>> operation be somehow expanded, generating a List<Car> specific
>>> operation,
>>> and that operation be referred?
>>>
>
>
Re: template expansion [message #605428 is a reply to message #472220] Wed, 04 April 2007 19:57 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
Kenn, so if I understood well, there isn't a single right way.

I guess I agree with your position on the issue of referring to
templates from non-template elements. But at the same time, I feel that
expanding bound elements will lose information that might be useful
later on (for instance, when generating code in a language that supports
parametric types). Unless I am missing something.

I guess what I would really like to see was some way of figuring out the
template binding that generated any given bound element in expanded form
(just annotated bug 180744 with that information).

Rafael

Kenn Hussey wrote:
> Rafael,
>
> The two representations are supposed to be semantically equivalent, but I
> would think that it's not generally a good idea to reference the template
> representations of things from non-templates...
>
> Kenn
>
> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
> news:556811df69c76fc7cc955159ea8a7703$1@www.eclipse.org...
>> James, it seems you misunderstood my comment (I did not ask for any UI
>> support, for instance). It was just an expansion of my own original post
>> (that one you understood correctly, as you replied with very relevant
>> comments). Let me try to rephrase my question.
>>
>> I understand per your other reply that there is no support for automatic
>> expansion of templates, but let's ignore that fact for now, as my question
>> here has more to do with UML practices than with UML2 per se.
>>
>> I was just trying to make sure I understood what to do if I wanted to
>> reference elements in a bound element that are actually defined in the
>> template, should I expand the bound element first (so it has all the
>> elements defined in the template), or should I just reference the original
>> element.
>>
>> Again, in my example:
>>
>> class Car
>>
>> class List<T>
>> operation get(i : Integer) : T
>>
>> If I wanted to refer to invoke the operation "get" on a List<Car>, should
>> I just refer to the generic operation as defined in List<T>, or should I
>> first expand List<Car> as:
>>
>> class List_Of_Car
>> operation get(i : Integer) : Car
>>
>> and then refer to this specific "get" operation instead.
>>
>> I looked for info on this in the spec but could not find anything.
>>
>> Thanks
>>
>> Rafael
>>
>> James Bruck wrote:
>>
>>> Rafael,
>>> There is no menu option to create a new "merged" version of a class with
>>> all
>>> the substitutions applied.
>>> What does exist is the ability to convert your fully specified UML to
>>> ecore
>>> and vice versa.
>>> - James.
>>
>>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>>> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>>>> This is my motivation for asking this question: imagine you have the
>>>> following classes in your model:
>>>>
>>>> class Car
>>>>
>>>> class List<T>
>>>> operation get(i : Integer) : T
>>>>
>>>> Now consider an activity wants to call get(Integer) on an object whose
>>>> type is List<Car>. In the CallOperationAction, what would be the
>>>> operation
>>>> element referred to? The generic version? Or should the generic get
>>>> operation be somehow expanded, generating a List<Car> specific
>>>> operation,
>>>> and that operation be referred?
>>>>
>>
>
>
Re: template expansion [message #607421 is a reply to message #472227] Mon, 09 April 2007 01:09 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Some comments below...

"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:ev0vv0$hie$1@build.eclipse.org...
> Kenn, so if I understood well, there isn't a single right way.
>
> I guess I agree with your position on the issue of referring to
> templates from non-template elements. But at the same time, I feel that
> expanding bound elements will lose information that might be useful later
> on (for instance, when generating code in a language that supports
> parametric types). Unless I am missing something.
>
> I guess what I would really like to see was some way of figuring out the
> template binding that generated any given bound element in expanded form
> (just annotated bug 180744 with that information).

From the above paragraph it seems that... to paraphrase...: Given a bound
element in expanded form, you want to know the template binding that
generated it. Since there are many different ways that an element could
be bound ... ie by either substituting default parameters or via multiple
bindings I'm not sure if there is a definitive way of doing this (although I
have not thought about this in great detail)
This seems to be a little bit different from what you ask for in the bug
detail... "Ideally, on the expanded form, there would be a way of telling
apart things that were defined in the element itself from those coming from
a template binding expansion.". This request seems possible since we could
annotate the expanded model while applying the substitutions.

- James


>
> Rafael
>
> Kenn Hussey wrote:
>> Rafael,
>>
>> The two representations are supposed to be semantically equivalent, but I
>> would think that it's not generally a good idea to reference the template
>> representations of things from non-templates...
>>
>> Kenn
>>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:556811df69c76fc7cc955159ea8a7703$1@www.eclipse.org...
>>> James, it seems you misunderstood my comment (I did not ask for any UI
>>> support, for instance). It was just an expansion of my own original post
>>> (that one you understood correctly, as you replied with very relevant
>>> comments). Let me try to rephrase my question.
>>>
>>> I understand per your other reply that there is no support for automatic
>>> expansion of templates, but let's ignore that fact for now, as my
>>> question here has more to do with UML practices than with UML2 per se.
>>>
>>> I was just trying to make sure I understood what to do if I wanted to
>>> reference elements in a bound element that are actually defined in the
>>> template, should I expand the bound element first (so it has all the
>>> elements defined in the template), or should I just reference the
>>> original element.
>>>
>>> Again, in my example:
>>>
>>> class Car
>>>
>>> class List<T>
>>> operation get(i : Integer) : T
>>>
>>> If I wanted to refer to invoke the operation "get" on a List<Car>,
>>> should I just refer to the generic operation as defined in List<T>, or
>>> should I first expand List<Car> as:
>>>
>>> class List_Of_Car
>>> operation get(i : Integer) : Car
>>>
>>> and then refer to this specific "get" operation instead.
>>>
>>> I looked for info on this in the spec but could not find anything.
>>>
>>> Thanks
>>>
>>> Rafael
>>>
>>> James Bruck wrote:
>>>
>>>> Rafael,
>>>> There is no menu option to create a new "merged" version of a class
>>>> with all
>>>> the substitutions applied.
>>>> What does exist is the ability to convert your fully specified UML to
>>>> ecore
>>>> and vice versa.
>>>> - James.
>>>
>>>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>>>> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>>>>> This is my motivation for asking this question: imagine you have the
>>>>> following classes in your model:
>>>>>
>>>>> class Car
>>>>>
>>>>> class List<T>
>>>>> operation get(i : Integer) : T
>>>>>
>>>>> Now consider an activity wants to call get(Integer) on an object whose
>>>>> type is List<Car>. In the CallOperationAction, what would be the
>>>>> operation
>>>>> element referred to? The generic version? Or should the generic get
>>>>> operation be somehow expanded, generating a List<Car> specific
>>>>> operation,
>>>>> and that operation be referred?
>>>>>
>>>
>>
>>
>
Re: template expansion [message #607422 is a reply to message #472215] Mon, 09 April 2007 01:20 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Rafael,

.... I meant additional API that could be exposed through the example UI ..
but I understand that you are requesting support for template expansion...

....I believe Kenn answered your second question about how to refer to
specific "get" operation in the example below....

- James.

"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:556811df69c76fc7cc955159ea8a7703$1@www.eclipse.org...
> James, it seems you misunderstood my comment (I did not ask for any UI
> support, for instance). It was just an expansion of my own original post
> (that one you understood correctly, as you replied with very relevant
> comments). Let me try to rephrase my question.
>
> I understand per your other reply that there is no support for automatic
> expansion of templates, but let's ignore that fact for now, as my question
> here has more to do with UML practices than with UML2 per se.
>
> I was just trying to make sure I understood what to do if I wanted to
> reference elements in a bound element that are actually defined in the
> template, should I expand the bound element first (so it has all the
> elements defined in the template), or should I just reference the original
> element.
>
> Again, in my example:
>
> class Car
>
> class List<T>
> operation get(i : Integer) : T
>
> If I wanted to refer to invoke the operation "get" on a List<Car>, should
> I just refer to the generic operation as defined in List<T>, or should I
> first expand List<Car> as:
>
> class List_Of_Car
> operation get(i : Integer) : Car
>
> and then refer to this specific "get" operation instead.
>
> I looked for info on this in the spec but could not find anything.
>
> Thanks
>
> Rafael
>
> James Bruck wrote:
>
>> Rafael,
>
>> There is no menu option to create a new "merged" version of a class with
>> all
>> the substitutions applied.
>> What does exist is the ability to convert your fully specified UML to
>> ecore
>> and vice versa.
>
>> - James.
>
>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:a374ee74f94d65b1bb16603f9c8cf50c$1@www.eclipse.org...
>>> This is my motivation for asking this question: imagine you have the
>>> following classes in your model:
>>>
>>> class Car
>>>
>>> class List<T>
>>> operation get(i : Integer) : T
>>>
>>> Now consider an activity wants to call get(Integer) on an object whose
>>> type is List<Car>. In the CallOperationAction, what would be the
>>> operation
>>> element referred to? The generic version? Or should the generic get
>>> operation be somehow expanded, generating a List<Car> specific
>>> operation,
>>> and that operation be referred?
>>>
>
>
Previous Topic:[Announce] MDT UML2 2.1.0 2.1M6 is available
Next Topic:UML(2) constraints
Goto Forum:
  


Current Time: Tue Apr 23 07:45:28 GMT 2024

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

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

Back to the top