importumlpackage-diagram

Package import in UML


I found a similar question in one of the online platform and depicting here, as the answer is not convincing:

Question: Which element(s) from P3 are visible inside P2 without using a qualified name ?

For me, answer would be , because during import a copy of and will be made into P2. So no qualified name will be used, but can't be imported directly (provided visibility and hiding rules allow) because of the name conflict with the element already existing in P2. So an alias for from P3 will be created inside P2.

But the platform provides as the answer. Some say, One from P3 will be merged into in P2. In UML2.5 Package merge is already removed and can't be considered. Any reason to say as the answer ?

Package diagram


Solution

  • I think you are right. P3::Two will be accessible without qualified name in P2. Maybe, they wanted to target the clash with the outer name P1::Two, but mistyped. This would be available in P2, but is not, because of the import of P3::Two:

    UML: the outer name is hidden by an ElementImport, and the unqualified name refers to the imported element.

    Please note: Package Merge has not been removed from UML. It is no longer used for the Metamodel of UML, but still available for user models. In your example, however, the relationship is clearly an import. So, merge semantics is not relevant here.

    Also, during import nothing get's copied and no alias is created. Only the interpretation of a reference to a name is changed.