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
orTargetAsset
should be used underRelation
instead ofAsset
. 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 aType
parameter with possible values ofSOURCE
orTARGET
. This parameter determines the relationship between theRelation
and the parentAsset
.
The following example shows the query going two levels deep.
- JSON
- 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" }
}
}
}
}
}
}
}
}
---
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"
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.
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.