Skip to main content

Add entity relationships

The entity data model includes a relationships component, which describe predefined relationship types between entities. Relationships allow entities to reference each other, which let you implement graph-like lookup capabilities. For example, the Lattice UI can use these relationships to link tracks with assets tracking them.

Consider a relationship as a directed edge pointing from the source entity, which has the relationship component, to the target entity defined by relationship.related_entity_id.

Relationship types

Integrations that produce entities can publish relationships directly on the entity that they publish to the environment.

Let's assume you have one entity, Entity A, representing a vessel, and another entity, Entity B, representing a radar.

Given this scenario, the following is the list of relationship types you can use:

  • TrackedBy: TrackedBy is a relationship on the vessel, Entity A, that links to the entity that is tracking it, in this case the radar, Entity B.
  • ActiveTarget: ActiveTarget is a relationship on the radar, Entity B, that links to the entity it is tracking, in this case, the vessel, Entity A.

You assign a TrackedBy relationship type to the vessel because it is being tracked, and assign an ActiveTarget relationship type to the radar because it is tracking the vessel.

For more information, see Relationships in the Lattice API Reference documentation.