> ## Documentation Index
> Fetch the complete documentation index at: https://resources.athenaintel.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Relationships

> Define how your object types connect to each other with named, typed links.

Relationships (also called link types) define how object types are connected. They capture the real-world associations between entities — a deal belongs to a company, a person works at an organization, a candidate is applying for a position.

## Creating a Relationship

<Steps>
  <Step title="Connect two types">
    In the [Ontology Builder](/docs/ontology/ontology-builder), drag from the **connection handle** on one object type node to another, or right-click a node and select **New Relationship**. The handle appears on hover at the edges of each node.
  </Step>

  <Step title="Configure the link">
    A dialog appears with the following fields:

    * **Link Name** — A descriptive name for the relationship (e.g., "assigned\_to", "works\_at", "owns")
    * **Cardinality** — How many instances can be on each side
    * **Directional** — Whether the link goes one way or both
    * **Description** — Optional context about what this relationship means
  </Step>

  <Step title="Save">
    Click **Create** to add the relationship. It appears as an edge in the graph between the two object types.
  </Step>
</Steps>

<Tip>You can also create self-referential relationships — for example, a "Company" that has a "parent\_company" link back to itself.</Tip>

## Cardinality

Cardinality defines how many instances can participate on each side of a relationship.

| Cardinality      | Meaning                                                           | Example                             |
| ---------------- | ----------------------------------------------------------------- | ----------------------------------- |
| **One-to-One**   | Each source has exactly one target, and vice versa                | Person → *has\_passport* → Passport |
| **One-to-Many**  | Each source can have many targets, but each target has one source | Company → *employs* → Person        |
| **Many-to-One**  | Each source has one target, but each target can have many sources | Person → *works\_at* → Company      |
| **Many-to-Many** | No restrictions on either side                                    | Person → *member\_of* → Project     |

Choose the cardinality that best reflects the real-world constraint. For example, if each deal has exactly one owner but each person can own multiple deals, use **Many-to-One** (Deal → Person).

## Directionality

Relationships can be **directional** or **bidirectional**:

* **Directional** (A → B): The link has a clear source and target. "Deal *owned\_by* Person" implies the deal points to the person, not the reverse.
* **Bidirectional** (A ↔ B): The link works both ways equally. "Person *collaborates\_with* Person" has no inherent direction.

In the Ontology Builder graph, directional relationships are shown with an arrow, while bidirectional relationships show a line connecting both types equally.

## Visualizing Relationships

The Ontology Builder graph renders relationships as edges between object type nodes. Each edge displays:

* The **link name** as a label on the edge
* The **cardinality** notation (1:1, 1:N, N:1, N:N)
* **Direction** shown with an arrow (→) for directional links or a bidirectional indicator (↔) for undirected links

Self-referential relationships (where source and target are the same type) are rendered as looped edges on the node.

## Examples

Here are common relationship patterns across different domains:

<Tabs>
  <Tab title="Sales & CRM">
    ```mermaid theme={null}
    graph LR
      Deal -->|owned_by N:1| Person
      Deal -->|belongs_to N:1| Company
      Person -->|works_at N:1| Company
      Company -->|parent_of 1:N| Company
    ```
  </Tab>

  <Tab title="Recruiting">
    ```mermaid theme={null}
    graph LR
      Recruit -->|applied_to N:1| Position
      Recruit -->|referred_by N:1| Person
      Position -->|posted_by N:1| Company
      Recruit -->|interviewed_by N:N| Person
    ```
  </Tab>

  <Tab title="Private Equity">
    ```mermaid theme={null}
    graph LR
      Deal -->|sponsored_by N:1| PE_Sponsor
      PE_Sponsor -->|manages 1:N| Fund
      Fund -->|invested_in N:N| Company
      Company -->|headquartered_in N:1| Place
    ```
  </Tab>
</Tabs>

## Editing and Deleting

* To **edit** a relationship, click on the edge in the Ontology Builder graph to open it in Spaces where you can modify its properties.
* To **delete** a relationship, use the delete action from the edge's context menu.

<Note>Deleting a relationship removes the link type definition. It does not delete the object type instances on either side.</Note>

<Warning>If you delete an object type, all relationships that reference it as a source or target are also deleted automatically.</Warning>
