Search code examples
componentsumldiagram

A component in UML that defines an interface but does not require or provide it


As part of a larger component diagram I want to show 3 components which are working with an interface called IPrint.

  • One component implements the IPrint interface, therefore is "providing" it
  • One component uses the IPrint interface, therefore is "requiring" it

I can model this using ball-and-socket notation. The providing component would get the ball, and the requiring component would get the socket.

However, now, I want to highlight a third component which defines the interface (I want to highlight that there is no dependency between requiring and providing component)

What is the best way of drawing this with UML 2.0? My first attempt is shown here with a realization arrow

enter image description here

but it is an awkward notation because it looks like the defining component is providing an implementation, which it is not.

Here's my attempt based on Geert's answer:

enter image description here

Here's my third attempt based on bruno's comment:

enter image description here


Solution

  • What you are looking for is the ownership relation.
    The interface is owned by the component that "defines" is as you call it. enter image description here

    In the metamodel from UML 2.5 above your interface is playing the role of packagedElement with regards to the third component. The Component acts as the namespace for the Interface

    This relation is not visually represented but rather expressed by the fact that the interface element is nested inside the component element. (there is a nesting notation, but that is rarely used and hardly defined in the specs)