Relationships Between Relationships
IntermediateLet a relationship end on another relationship, for example to say what flows over a flow, and set it up in the metamodel, on the canvas and over the API.
Most relationships connect two nodes. Sometimes, though, what you want to record is about a connection itself: which data travels over a flow, which contract governs a dependency, which role a person plays in a membership. For this, a relationship can end on another relationship instead of on a node.
An example
Two processes, Receive Order and Ship Order, are joined by a Flow. A data object, Order, says what travels over that flow. You draw an Association from Order that ends on the Flow line itself. Enterprise architecture notations use exactly this pattern.
When to use it
- Use it when the thing you are attaching is part of your model, an element in its own right that other diagrams, filters and agents should be able to find: a data object, a contract, a role.
- Use a property instead when it is just a value, such as a date, a volume or a status. A property on the relationship type is simpler.
- Use an annotation connector or a sticky note instead when it is only a remark for one diagram. Those live on the diagram, not in the model.
1. Allow it in the metamodel
Like every relationship, this one needs an Allowed Connection. The difference is that one end is a relationship type instead of a node type: Data Object → Association → Flow.
On a metamodel diagram:
- Make sure the node type (Data Object) and the line of the relationship type (Flow) are on the diagram. If Flow connects Process to Process, its line is a loop on the Process box.
- Drag from a connection handle on Data Object and drop it onto the Flow line.
- In the popup, choose Association. The allowed connection is created.
You can also do it in the Properties panel. Select the relationship type Flow. Its section Relationships ending on this type lists the allowed connections that end on it and lets you add one.
Good to know:
- Allowed connections are directional, here as everywhere. Data Object → Association → Flow lets you draw from a data object onto a flow, not the other way round.
- Inheritance, containment and aggregation types always connect nodes. They cannot end on a relationship.
2. Draw it on a diagram
- Put the elements on the diagram: Order, and the Flow with both of its processes.
- Drag from a connection handle on Order and drop it onto the Flow line.
- A popup lists the relationship types that may end there, plus Annotation connector (diagram only):
- Choose Association to create a real relationship in your model.
- Choose Annotation connector (diagram only) to draw a line on this diagram only.
- A small dot marks where the new line meets the Flow.
If the metamodel allows no relationship on that line, dropping there draws an annotation connector, as it always has. If you expected a relationship, check the allowed connections.
Starting from the line
You can also start on the line instead of on the node. Select the Flow: a small teal handle appears in the middle of the line. Drag from that handle and drop it onto a node. The same popup appears.
This draws in the other direction: the Flow is the source of the new relationship. Because allowed connections are directional, it needs one that starts at the relationship type, for example Flow → Association → Data Object. You can also drop the handle onto another relationship's line, if the metamodel allows a relationship between the two relationship types.
Moving the end along the line
Select the Association and drag the end that sits on the Flow. It slides along the line and stays attached.
The end keeps its position relative to the line. When you move the processes or the Flow is rerouted, the end moves with it.
The end on the Flow stays on that Flow. To attach it to a different relationship, delete it and draw it again. The other end, on Order, can be reconnected like any other relationship end.
In the Properties panel
- Select the Association: its target is shown as the Flow, with its type. Click it to open the Flow.
- Select the Flow: it lists its Attached relationships.
Deleting
- Deleting a relationship also deletes the relationships attached to it, and any attached to those in turn. The confirmation dialog lists them first, and one undo brings everything back.
- Removing the Flow from a diagram only also takes the lines that end on it off that diagram. The model is not changed.
- Deleting a relationship type removes the allowed connections that end on it.
Merging nodes
When you merge two nodes, their relationships move to the node you keep and remain the same relationships. Anything attached to them stays attached. One undo reverses the merge.
Where they appear
Relationships that end on a relationship are shown on the canvas, in read-only diagrams and published pages, and in SVG, PNG and PDF exports.
When you place a node on a diagram, Metapad also shows its relationships that end on a line already on that diagram.
Relationship grids and the Explorer do not show them yet.
With the API and AI agents
Over MCP, set target_kind (or source_kind) to "relationship" and pass the relationship's ID where a node ID would go:
{
"relationships": [{
"relationship_type": "Association",
"source_node_id": "<Order id>",
"target_node_id": "<Flow relationship id>",
"target_kind": "relationship"
}]
}
- The allowed connection:
add_allowed_connectionwithtarget_type_kind: "relationship_type", naming the relationship type astarget_node_type. - Reading back:
get_relationshipsandget_metamodelreturn the kinds. They are left out when an end is a node, so existing scripts see no change. - Diagrams:
add_relationships_to_diagramplaces such a relationship on the middle of the line it ends on. That line must already be on the diagram, or be added in the same call. - Deleting:
delete_relationshipsreports the attached relationships it deleted inrelationships_deleted.
This content was written collaboratively with AI.