> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/api/guides/output-module/the-output-module-query-language/clarify-the-relationship-between-two-entities.md).

# Clarify the relationship between two entities

When two entities are related in more than one way, nesting the entities inside each other is not enough to determine which path to follow. For example, an asset can be either the `source` or `target` of a relation or a user can be the `creator` or the `lastModifier` of a resource. Depending on the entity, there are two possibilities:

* The name of the child entity is changed. For example,`SourceAsset` or `TargetAsset` should be used under `Relation` instead of `Asset`. In this case, they act and behave just like normal assets and exist for the sole purpose of clarifying the relationship followed.
* A special parameter called the `Parent Relationship Selector` is added to the child entity. For example, `Relation` has a `Type` parameter with possible values of `SOURCE` or `TARGET`. This parameter determines the relationship between the `Relation` and the parent`Asset`.

The following example shows the query going two levels deep.

{% tabs %}
{% tab title="JSON" %}

```json
{
  "ViewConfig": {
    "Resources": {
      "Asset": {
        "Id": { "name": "id" },
        "Signifier": { "name": "name" },
        "Relation": {
          "type": "SOURCE",
          "TargetAsset": {
            "Id": { "name": "relatedAssetLevelOneId" },
            "Signifier": { "name": "relatedAssetLevelOne" },
            "Relation": {
              "type": "TARGET",
              "SourceAsset": {
                "Id": { "name": "relatedAssetLevelTwoId" },
                "Signifier": { "name": "relatedAssetLevelTwo" }
              }
            }
          }
        }
      }
    }
  }
}
```

{% endtab %}

{% tab title="YAML" %}

```yaml
---
ViewConfig:
  Resources:
    Asset:
      Id:
        name: "id"
      Signifier:
        name: "name"
      Relation:
        type: "SOURCE"
        TargetAsset:
          Id:
            name: "relatedAssetLevelOneId"
          Signifier:
            name: "relatedAssetLevelOne"
          Relation:
            type: "TARGET"
            SourceAsset:
              Id:
                name: "relatedAssetLevelTwoId"
              Signifier:
                name: "relatedAssetLevelTwo"
```

{% endtab %}
{% endtabs %}

These special parameters and custom entity names only exist for a fraction of the available entities. For a complete list, see [Entities, properties and relations](/api/guides/output-module/entities-properties-and-relations.md).

{% hint style="info" %}
To reduce the number of assets returned, the query example above is not filtered. Filtering would return a large amount of data and impact performance.
{% endhint %}
