A model element is a relationship, if it implements one of the following interfaces:

  • com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Relationship,
  • com.nomagic.uml2.ext.magicdraw.activities.mdbasicactivities.ActivityEdge,
  • com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition,
  • com.nomagic.uml2.ext.magicdraw.activities.mdextrastructuredactivities.ExceptionHandler,
  • com.nomagic.uml2.ext.magicdraw.compositestructures.mdinternalstructures.Connector.

For checking if the model element is a relationship, call the com.nomagic.uml2.ext.jmi.helpers.CoreHelper.isRelationship(Element) method.

For getting supplier and client elements of a relationship, use CoreHelper class getSupplierElement(Element), getClientElement(Element) methods.

Use CoreHelper class setSupplierElement(Element, Element) , setClientElement(Element, Element) methods to set supplier and client elements of a relationship.


To create a new Relationship


  1. Create a new relationship model element.
  2. Set client and supplier model elements by using CoreHelper class setSupplierElement(Element, Element)setClientElement(Element, Element) methods.
  3. Add a new relationship into some parent by using the com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element.setOwner(Element) method.