Skip to content

lb_link_nodes

Creates typed edges from one source node to one or more target nodes. The write is a replace operation per link_type: all existing edges of that type from the source node are replaced with the new target set.

ParameterTypeRequiredDescription
source_node_idstringYesID of the source node (the edges originate here)
target_node_idsstring[]YesIDs of target nodes. Must contain 1–16 entries
link_typestringNoOne of related, next, derived_from, supersedes, mentions, invokes. Default related
{
"source_node_id": "...",
"link_type": "related",
"targets_set": 2
}
CodeWhen
NOT_FOUNDsource_node_id does not exist, or one or more targets do not exist in the current tenant
  • Replace semantics: calling lb_link_nodes(A, [B, C], "related") then lb_link_nodes(A, [D], "related") leaves A with only a single related edge to D. Other link_type values from A are untouched.
  • target_node_ids is capped at 16 to stay under D1’s parameter-bind limit.
  • Edge writes are atomic: the DELETE of old edges and INSERT of new edges run in one db.batch() call.
  • To append rather than replace, read the current edges via lb_get_related, merge client-side, then call lb_link_nodes with the merged set.