Officially out now: The TypeDB 3.0 Roadmap >>

Delete stage

A delete stage deletes data from the database. Deletable data includes instances of types, ownerships of attributes, and role players of relations.

Syntax

The body of a delete stage is a sequence of delete statements.

delete ( <variable> | has <variable> of <variable> | links ( <variable> [ , ... ] ) of <variable> ); [ ... ]

Behavior

Execution

The delete stage must be preceded by other stages. The body of the delete clause is executed once for each input row. The output is then a stream of input rows with the deleted concepts removed.

Example

match
  $person isa person, has name "<name>";
  $group isa group, has group-id "<group id>";
  $membership isa group-membership(group: $group, member: $person) has rank $rank;
  $rank == "member";
delete
  has $rank of $membership;
  links ($person) of $membership;
  $group;