The relation service defines and maintains logical relations between registered MBeans. Users define the relation type and establish the relation instance which associates any number of MBeans. The relation service provides query mechanisms to retrieve MBeans that are related to one another.
In the JMX architecture, a relation type is defined by the class and cardinality of MBeans that it associates in named roles. For example, we can say that Books and Owner are roles. Books represents any number of owned books of a given MBean class, and Owner is a single book owner of another MBean class. We might define a relation type containing these two roles and call it Personal Library: it represents the concept of book ownership.
The following diagram represents this sample relation type, as compared to the UML modeling of its corresponding association.

Through the relation service, users may create relation types and then create, access, and delete instances of a relation. In our example, a management application may add Book MBeans to a Personal Library relation, or it may replace the MBean in the Owner role with another MBean of the same class. All MBeans are referenced by their object name, so that a relation may be accessed from a remote application.
The relation service is notified when MBeans in a relation are deregistered, and it verifies that any relation involving that MBean still has the required cardinality. For example, if an Owner MBean were deregistered, the relation service would remove any Personal Library relations where that MBean was the designated owner.
The relation service can represent a relation instance either internally or externally. If the user defines a relation instance through the API of the relation service, the relation is represented by internal structures that are not accessible to the user. This is the simplest way to define relations because the relation service handles all coherence issues through its internal structures.
A relation instance may also be a separate MBean object that fulfills certain requirements. The user instantiates and registers these MBeans, insures that they represent a coherent relationship, and places these MBeans under the control of the relation service. This process places the responsibility of maintaining coherency on the user, but external relations have certain advantages: they may implement operations on a relation instance.
For example a Personal Library relation could be implemented by an MBean with an operation called Loan. This operation would search the list of book MBeans for a title and implement some mechanism to mark that book as being on loan. And because external relations are MBeans, these extended operations are available to remote management applications.