Skip to main content



      Home
Home » Modeling » UML2 » need clarification about "package import"
need clarification about "package import" [message #628073] Thu, 19 November 2009 03:54 Go to next message
Eclipse UserFriend
Hi all,
after creating a "packageImport" into two packages p1 and p2 each containing a class named "class1" I get no warnings when I validate the model.
Is it normal? I would expect to get a warning to tell me that now two elements have the same name in same namespace (p1 namespace now contains two classes named "class1").

Did I miss something? or is it a bug?
Thanks
raphaël
Re: need clarification about "package import" [message #628074 is a reply to message #628073] Thu, 19 November 2009 06:22 Go to previous messageGo to next message
Eclipse UserFriend
UML2 model element creation is related to an Id and not to a name. I mean that you can have two elements having the same name in the same package but no being identical.
The difference is the UML id
The name control is a jdt compilation control which doesn't allow to have same classifier name inside the same package.

I don't see any value in adding a new model validation rule based on names inside the UML2 meta model validation process if all the logic is based on Ids management ?

A work around is when adding a package merge between two packages is to manually delete the element if you don't want to use the same name. You can also use directly the metamodel element and the UML2 editor to visualize it as a tree. You can then just drop elements to the visual diagram to display it. I mean that dropping already existing model elements into visual diagrams will avoid such a problem if at the diagram creation you never create two elements having the same name :?
Re: need clarification about "package import" [message #628075 is a reply to message #628074] Thu, 19 November 2009 06:49 Go to previous messageGo to next message
Eclipse UserFriend
Vlad,

Comments below.

Vlad Varnica wrote:
> UML2 model element creation is related to an Id and not to a name.
He didn't ask about IDs.
> I mean that you can have two elements having the same name in the same
> package but no being identical.
In this case they are in different packages.
> The difference is the UML id
> The name control is a jdt compilation control which doesn't allow to
> have same classifier name inside the same package.
There weren't any questions about Java so what does JDT have to do with
the original question.
> I don't see any value in adding a new model validation rule based on
> names inside the UML2 meta model validation process if all the logic
> is based on Ids management ?
In fact there is such logic already. You can't have two classes with
the same name in a single package.
>
> A work around is when adding a package merge between two packages is
> to manually delete the element if you don't want to use the same name.
Package merge wasn't part of the question either.
> You can also use directly the metamodel element and the UML2 editor to
> visualize it as a tree.
Nor was there a question about diagrams.
> You can then just drop elements to the visual diagram to display it. I
> mean that dropping already existing model elements into visual
> diagrams will avoid such a problem if at the diagram creation you
> never create two elements having the same name :?
Jeesh. The question was about why importing two packages that have
conflicting class names doesn't cause a problem and you've not said a
single thing about that actual question. I'm not sure the answer to
it. Hopefully someone will answer that...
Re: need clarification about "package import" [message #628076 is a reply to message #628073] Thu, 19 November 2009 07:34 Go to previous message
Eclipse UserFriend
--=-DCtQdl0gvM9gIFEa58Zg
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi, Rapha=C3=ABl,

As I understand it, the semantics of package import is to import only
elements of the package that do not clash with names already in the
importing namespace. This effectively ensures that the unique names
constraint cannot be violated by package import: in the extreme case,
the import would not bring in *any* names.

If you use element imports to import the two class1 elements, then the
constraint would be violated. However, with element import you can
assign an alias to give the imported element a distinct name in the
importing namespace.

HTH,

Christian


On Thu, 2009-11-19 at 03:54 -0500, Raphael Faudou wrote:

> Hi all,
> after creating a "packageImport" into two packages p1 and p2 each contain=
ing a class named "class1" I get no warnings when I validate the model.
> Is it normal? I would expect to get a warning to tell me that now two ele=
ments have the same name in same namespace (p1 namespace now contains two c=
lasses named "class1").
>=20
> Did I miss something? or is it a bug?
> Thanks
> rapha=C3=ABl

--=-DCtQdl0gvM9gIFEa58Zg
Content-Type: text/html; charset="utf-8"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Rapha&#235;l,<BR>
<BR>
As I understand it, the semantics of package import is to import only elements of the package that do not clash with names already in the importing namespace.&nbsp; This effectively ensures that the unique names constraint cannot be violated by package import:&nbsp; in the extreme case, the import would not bring in *any* names.<BR>
<BR>
If you use element imports to import the two class1 elements, then the constraint would be violated.&nbsp; However, with element import you can assign an alias to give the imported element a distinct name in the importing namespace.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Thu, 2009-11-19 at 03:54 -0500, Raphael Faudou wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi all,
after creating a &quot;packageImport&quot; into two packages p1 and p2 each containing a class named &quot;class1&quot; I get no warnings when I validate the model.
Is it normal? I would expect to get a warning to tell me that now two elements have the same name in same namespace (p1 namespace now contains two classes named &quot;class1&quot;).

Did I miss something? or is it a bug?
Thanks
rapha&#235;l
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-DCtQdl0gvM9gIFEa58Zg--
Previous Topic:Problem Applying Stereotype
Next Topic:Problem Applying Stereotype
Goto Forum:
  


Current Time: Mon Sep 22 03:58:41 EDT 2025

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

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

Back to the top