Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » [newbie] Basic Types in UML
[newbie] Basic Types in UML [message #531588] Wed, 05 May 2010 13:39 Go to next message
orlin  is currently offline orlin Friend
Messages: 13
Registered: April 2010
Junior Member
How can I use basic types, such as Map, String, etc?

Can I represent generic types (Map <String, String>) in UML (or can I do so only in OCL)?
Re: [newbie] Basic Types in UML [message #532254 is a reply to message #531588] Fri, 07 May 2010 16:56 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi,

UML has a template construct call TemplateSignature that you can use to
define parameters for types. To see how it works, I suggest that you
look at the Ecore.UML model provided by the UML2 project, or convert any
Ecore model that defines generic types to UML.

As for OCL, it defines a few parameterized types in the standard
library, but provides no means to define new parameterized types of your
own nor even a syntax to for working with parameterized types in your
UML model. It's a pretty big hole in the language ...

HTH,

Christian


On 05/05/10 09:39 AM, orlin wrote:
> How can I use basic types, such as Map, String, etc?
>
> Can I represent generic types (Map <String, String>) in UML (or can I do
> so only in OCL)?
Re: [newbie] Basic Types in UML [message #532918 is a reply to message #531588] Tue, 11 May 2010 14:50 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 05.05.2010 15:39, schrieb orlin:
> How can I use basic types, such as Map, String, etc?
>
> Can I represent generic types (Map <String, String>) in UML (or can I do
> so only in OCL)?

Map is a platform library and as such very low level in terms of model
abstraction. Better use qualified associations!

Best,
Erhard

--
Meet us online!
w http://www.yatta.de
tw @YattaSolutions
fb http://www.facebook.com/pages/Yatta-Solutions-GmbH/933852562 69
Re: [newbie] Basic Types in UML [message #532957 is a reply to message #531588] Tue, 11 May 2010 16:54 Go to previous messageGo to next message
orlin  is currently offline orlin Friend
Messages: 13
Registered: April 2010
Junior Member
thanks for both answers.

@Christian, generics are a newer concept then OCL, so I was actually quite skeptical about it. And for OCL I did mean to specify in the pre condition, that key is of type X and value of type Y

@Erhard, can you give me an example of such a qualified association?
The reason why I am searching for something less generic and more java orientated is, in order to be able to automaticly generate the (java) structure from the uml specification. If I am to create my own maps, then probably the code generation will recreate them as well.

Orlin
Re: [newbie] Basic Types in UML [message #533187 is a reply to message #532957] Wed, 12 May 2010 13:27 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 11.05.2010 18:54, schrieb orlin:

> @Erhard, can you give me an example of such a qualified association?

Have a look at this picture:

http://weinell.de/bin/qualified.png
(might not work at the moment due to DNS problems in germany)

A Person can have multiple addresses, and refers to each with a specific
kind (qualifier) such as "home", "work", etc. Note the cardinality
constraint 0..1 on the Address side. This means that for each qualifier
there is at most one address.

This is presumably the closest (and most highlevel) way to express maps
in UML. In theory, your UML tool should generate code that maps the
qualifier to a Map field.

BTW, UML comes with a set of primitive types.

Best,
Erhard

--
Meet us online!
w http://www.yatta.de
tw @YattaSolutions
fb http://www.facebook.com/pages/Yatta-Solutions-GmbH/933852562 69
Re: [newbie] Basic Types in UML [message #533198 is a reply to message #531588] Wed, 12 May 2010 14:32 Go to previous message
orlin  is currently offline orlin Friend
Messages: 13
Registered: April 2010
Junior Member
thanks, now I know what you mean.

The reason I want (need) to use java maps (and probably other java classes), is because I need to be able to use some frameworks, for example (apache) commons chain, where I need the execute(Map) method.

My current solution is to create another model, where I create as primitive type Map (in package java.util), when I think about it, it might be the only possible way...
Re: [newbie] Basic Types in UML [message #628446 is a reply to message #532957] Wed, 12 May 2010 13:27 Go to previous message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 11.05.2010 18:54, schrieb orlin:

> @Erhard, can you give me an example of such a qualified association?

Have a look at this picture:

http://weinell.de/bin/qualified.png
(might not work at the moment due to DNS problems in germany)

A Person can have multiple addresses, and refers to each with a specific
kind (qualifier) such as "home", "work", etc. Note the cardinality
constraint 0..1 on the Address side. This means that for each qualifier
there is at most one address.

This is presumably the closest (and most highlevel) way to express maps
in UML. In theory, your UML tool should generate code that maps the
qualifier to a Map field.

BTW, UML comes with a set of primitive types.

Best,
Erhard

--
Meet us online!
w http://www.yatta.de
tw @YattaSolutions
fb http://www.facebook.com/pages/Yatta-Solutions-GmbH/933852562 69
Previous Topic:network access causing long delay in XMI deserialization
Next Topic:[newbie] Basic Types in UML
Goto Forum:
  


Current Time: Fri Mar 29 01:54:06 GMT 2024

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

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

Back to the top