RE: namespace & element ownership



Date view Thread view Subject view Author view Attachment view

From: Ivan Porres (iporres@abo.fi)
Date: Wed 22 Jan 2003 - 11:55:29 GMT


Hola Gonzalo,

> It seems in UML v1.4 that a namespace owns the NAMES of the elements it
> contains, but not the DEFINITIONS of the elements. 
I disagree. UML 1.4, page 5-4 shows that there is an aggregation between
Namespace and ModelElement with the ends named namespace and ownedElement. A
namespace owns its model elements, not the names of the model elements.

> Then, an element's
> definition could be spread among different packages. 
This is how UML works since all associations at the metamodel level are
bidirectional (they are relations). 

Take as an example the metamodel association
AssociationEnd.participant<->Classifier.association from page 5-3 of the UML
1.4 standard. This metamodel association implies that if we "connect" two
classes with an association, we have to modify the definition of the
classes. 

> For example, you
> could
> declare class A in package P, and then declare in package Q that A is a
> subclass of B.
> 
> But this seems incorrect to me. 
Yes. 

But if we declare that C is a subclass of A in package R we may also have
modularity/encapsulation issues. What happens if the definition of A is
changed by the designer?


> I think an element should not be modified
> out of the owner package or namespace. 
Then all model elements should be in the same package!

>I would like to hear some opinions
> about this.
I understand your point, but there is no general solution. What you can do
is define well-formed rules for your specific profile. In the previous
example you could define a WFR like

context Classifier:
  self.generalization.forAll(lambda g: g.namespace==self.namespace)

This forces a class and its generalizations in the same namespace. The
syntax is not OCL but I am sure you get the idea.

There are many things in UML 1.4 that do not make too much sense. A
recursive example: data types are model elements. There is a data type
called "Name" (page 5-10). Therefore an instance of "Name", since it is also
a model element, has an attribute called name of type "Name".

Un saludo,

Ivan

> 
> Gonzalo
> 
> ==========================================================================
> 
> Gonzalo Genova                        ggenova@inf.uc3m.es
> Research and Teaching Assistant       http://www.ie.inf.uc3m.es/ggenova/
> Department of Computer Science        http://inf.lab.inf.uc3m.es/
> Carlos III University of Madrid       http://www.uc3m.es/
> 
> Escuela PolitÚcnica Superior
> Avda. de la Universidad, 30
> 28911 LeganÚs - Madrid - Spain
> Tel. (34) 91 624 91 07
> Fax (34) 91 624 91 29
> 
> 
> 
> To remove yourself from this list please mail puml-list-
> request@cs.york.ac.uk
> with a message containing the word "unsubscribe".

Date view Thread view Subject view Author view Attachment view