Officially out now: The TypeDB 3.0 Roadmap >>

@independent annotation

The @independent annotation is used to prevent attributes without owners from being deleted automatically.

Syntax

Syntax
<type label> @independent;

The @independent annotation does not accept any arguments.

Usage

The @independent annotation enforces the independent constraint for an attribute type, allowing instances of the type to exist independently of their owner.

By default, attributes (instances of attribute types) depend on their owners: * Attributes cannot be inserted without a has clause. * Attributes are automatically deleted when their owners are deleted.

In contrast, attributes of independent types can exist without owners.

Independent attribute types definition
define
  attribute language @independent, value string;
Independent attributes insertion
insert
  $english isa language "English";

Subtyping

The independent constraint is inherited. This means that all subtypes of an independent type are also independent, and it cannot be changed.