Relation
A first-class directed edge between two entities. Relations have their own UUID, their own type (a Property entity defining the edge kind), and a fractional-index position for ordered collections. Unlike SQL foreign keys, relations are addressable graph entities you can query and traverse independently.
type Relation implements Node {
nodeId: ID!
id: UUID!
entityId: UUID!
typeId: UUID!
fromEntityId: UUID!
fromSpaceId: UUID
fromVersionId: UUID
toEntityId: UUID!
toSpaceId: UUID
toVersionId: UUID
position: String
spaceId: UUID!
verified: Boolean
typeEntity: Entity
entity: Entity
fromEntity: Entity
toEntity: Entity
space: Space
fromSpace: Space
toSpace: Space
type: PropertyInfo
}
Fields
Relation.nodeId ● ID! non-null scalar
A globally unique identifier. Can be used in various places throughout the system to identify this single value.
Relation.id ● UUID! non-null scalar
The relation's UUID. Use this to delete or update a specific edge — relations are addressable independently from their endpoints.
Relation.entityId ● UUID! non-null scalar
The relation's identity entity ID — equal to id (every relation is also an entity, so it has its own entity row).
Relation.typeId ● UUID! non-null scalar
The Property entity ID that defines what kind of edge this is — e.g., the Authors property ID, the Types property ID, the Topics property ID.
Relation.fromEntityId ● UUID! non-null scalar
Source entity (the edge starts here).
Relation.fromSpaceId ● UUID scalar
The space context of the from-side. Same logical relation can exist in multiple spaces.
Relation.fromVersionId ● UUID scalar
Relation.toEntityId ● UUID! non-null scalar
Target entity (the edge ends here).
Relation.toSpaceId ● UUID scalar
The space context of the to-side.
Relation.toVersionId ● UUID scalar
Relation.position ● String scalar
Fractional-index ordering string. Used by ordered collections like Blocks so consumers can render relations in a stable order. See Position.generateBetween in the SDK for generating these.
Relation.spaceId ● UUID! non-null scalar
The space the relation was published in.
Relation.verified ● Boolean scalar
Whether this relation has been signed-off in a verification flow. Most relations are unverified.
Relation.typeEntity ● Entity object
Reads a single Entity that is related to this Relation.
Relation.entity ● Entity object
Reads a single Entity that is related to this Relation.
Relation.fromEntity ● Entity object
Reads a single Entity that is related to this Relation.
Relation.toEntity ● Entity object
Reads a single Entity that is related to this Relation.
Relation.space ● Space object
Reads a single Space that is related to this Relation.
Relation.fromSpace ● Space object
Reads a single Space that is related to this Relation.
Relation.toSpace ● Space object
Reads a single Space that is related to this Relation.
Relation.type ● PropertyInfo object
PropertyInfo for this relation's type. Lighter than the full type entity.
Interfaces
Node interface
An object with a globally unique ID.
Returned By
relation query ● relationByNodeId query ● relations query
Member Of
Entity object ● RelationsConnection object ● RelationsEdge object ● Space object
:::tip See also
Cookbook recipes that use this:
:::