# Keyword glossary

## [](#_schema_queries)Schema queries

`define`

Denotes the beginning of a [Define query](../schema/define/index.md), used to add new types, constraints, or functions to the schema.

`undefine`

Denotes the beginning of a [Undefine query](../schema/undefine/index.md), used to remove existing types, constraints, or functions from the schema.

`redefine`

Denotes the beginning of a [Redefine query](../schema/redefine/index.md), used to modify existing types, constraints, or functions in the schema.

## [](#_data_pipeline_stages)Data pipeline stages

### [](#_data_manipulation_stages)Data manipulation stages

`match`

Denotes the beginning of a [Match stage](../pipelines/match/index.md) in a data pipeline, sed to match existing data instances in the database.

`fetch`

Denotes the beginning of a [Fetch stage](../pipelines/fetch/index.md) in a data pipeline, used to format the output of a data pipeline into JSON.

`insert`

Denotes the beginning of an [Insert stage](../pipelines/insert/index.md) in a data pipeline, used to add new data instances into the database.

`delete`

Denotes the beginning of a [Delete stage](../pipelines/delete/index.md) in a data pipeline, used to remove existing data instances from the database.

`update`

Denotes the beginning of an [Update stage](../pipelines/update/index.md) in a data pipeline, used to modify existing data instances in the database.

`put`

Denotes the beginning of a [Put stage](../pipelines/put/index.md) in a data pipeline, used to add new data instances to the database if they do not already exist.

### [](#_stream_manipulation_stages)Stream manipulation stages

`select`

Denotes the beginning of a [Select operator](../pipelines/select/index.md) in a data pipeline, used to keep specified variables for each element of the data stream and remove the rest.

`require`

Denotes the beginning of a [Require operator](../pipelines/require/index.md) in a data pipeline, used to remove elements from the data stream that do not contain specified optional variables.

`distinct`

Denotes the beginning of a [Distinct operator](../pipelines/distinct/index.md) in a data pipeline, used to remove duplicate elements from the data stream.

`sort`

Denotes the beginning of a [Sort operator](../pipelines/sort/index.md) in a data pipeline, used to order the elements of the data stream based on the value of specified variables.

`limit`

Denotes the beginning of a [Limit operator](../pipelines/limit/index.md) in a data pipeline, used to keep a specified number of elements of the data stream and remove the rest.

`offset`

Denotes the beginning of an [Offset operator](../pipelines/offset/index.md) in a data pipeline, used to remove a specified number of elements from the data stream.

`reduce`

Denotes the beginning of a [Reduce operator](../pipelines/reduce/index.md) in a data pipeline, used to perform reduction operations on the data stream according to specified groupings.

### [](#_special_stages)Special stages

`with`

Denotes the beginning of a [Preamble](../pipelines/with/index.md) in a data pipeline, used to define functions on an ad-hoc basis for use in the data pipeline.

`end`

When writing multiple queries together (for example in TypeQL console scripts), denotes the [End clause](../pipelines/end/index.md) of a query.

## [](#_pattern_logic)Pattern logic

`or`

Constructs a [disjunction](../patterns/disjunctions/index.md) in a query pattern.

`not`

Constructs a [negation](../patterns/negations/index.md) in a query pattern.

`try`

Constructs an [optional](../patterns/optionals/index.md) in a query pattern.

## [](#_statements)Statements

### [](#_type_definition_statements)Type definition statements

`entity`

Constructs an [`entity` statement](../statements/entity/index.md), used to define a new entity type.

`relation`

Constructs a [`relation` statement](../statements/relation/index.md), used to define a new relation type.

`attribute`

Constructs an [`attribute` statement](../statements/attribute/index.md), used to define a new attribute type.

`struct`

Constructs a [`struct` statement](../statements/struct/index.md), used to define a new struct type.

`fun`

Constructs a [`fun` statement](../statements/fun/index.md), used to define a new function.

### [](#_constraint_definition_statements)Constraint definition statements

`sub` / `sub!`

Constructs a [`sub` statement](../statements/sub/index.md), used to define the supertype of a type.

`relates` / `relates …​ as`

Constructs a [`relates` statement](../statements/relates/index.md), used to define a new role for a relation type.

`plays`

Constructs a [`plays` statement](../statements/plays/index.md), used to define a new role player for a role.

`value`

Constructs a [`value` statement](../statements/value/index.md), used to define the value type of an attribute type.

`owns`

Constructs an [`owns` statement](../statements/owns/index.md), used to define a new owner of an attribute type.

`alias`

Constructs an [`alias` statement](../statements/alias/index.md), used to define an alias label for a type.

### [](#_instance_statements)Instance statements

`isa` / `isa!`

Constructs an [`isa` statement](../statements/isa/index.md), used to specify the type of a data instance.

`links`

Constructs a [`links` statement](../statements/links/index.md), used to specify the role players in a relation.

`has`

Constructs a [`has` statement](../statements/has/index.md), used to specify an attribute of an entity or relation.

`is`

Constructs an [`is` statement](../statements/is/index.md), used to specify that two variables represent the same data instance.

`let …​ =`

Constructs a [`let …​ =` statement](../statements/let-eq/index.md), used to assign the result of an expression to a variable.

`let …​ in`

Constructs a [`let …​ in` statement](../statements/let-in/index.md), used to assign a stream or list element to a variable.

`contains`

Constructs a [comparison](../statements/comparisons/index.md#_string_comparison), used to specify that a string contains a specified substring.

`like`

Constructs a [comparison](../statements/comparisons/index.md#_string_comparison), used to specify that a string matches a specified regex pattern.

### [](#_identity_statements)Identity statements

`label`

Constructs a [`label` statement](../statements/label/index.md), used to identify a type by its label.

`iid`

Constructs an [`iid` statement](../statements/iid/index.md), used to identify a data instance by its internal ID.

## [](#_annotations)Annotations

### [](#_cardinality_constraints)Cardinality constraints

`@card`

Describes a [`@card` annotation](../annotations/card/index.md), used to specify cardinality ranges for roles and ownerships.

`@cascade`

Describes a [`@cascade` annotation](../annotations/cascade/index.md), used to specify behavior when deleting a relation’s role players.

`@independent`

Describes an [`@independent` annotation](../annotations/independent/index.md), used to prevent attributes without owners from being deleted automatically.

### [](#_modality_constraints)Modality constraints

`@abstract`

Describes an [`@abstract` annotation](../annotations/abstract/index.md), used to specify that a type or role is abstract.

`@key`

Describes a [`@key` annotation](../annotations/key/index.md), used to specify key attributes for entities and relations.

`@subkey`

Describes a [`@subkey` annotation](../annotations/subkey/index.md), used to specify composite keys built from multiple attributes.

`@unique`

Describes a [`@unique` annotation](../annotations/unique/index.md), used to specify unique attributes for entities and relations.

### [](#_value_constraints)Value constraints

`@values`

Describes a [`@values` annotation](../annotations/values/index.md), used to specify a set of permitted values for attributes.

`@range`

Describes a [`@range` annotation](../annotations/range/index.md), used to specify a range of permitted values for attributes.

`@regex`

Describes a [`@regex` annotation](../annotations/regex/index.md), used to specify a regex pattern for permitted values of attributes.

`@distinct`

Describes a [`@distinct` annotation](../annotations/distinct/index.md), used to restrict an owned list of attributes to distinct values.

## [](#_reductions)Reductions

`count`

Reduces the stream to the number of occurrences of a specified variable. See [Reduce operator](../pipelines/reduce/index.md) for more information.

`max`

Reduces the stream to the maximum value of a specified variable. See [Reduce operator](../pipelines/reduce/index.md) for more information.

`min`

Reduces the stream to the minimum value of a specified variable. See [Reduce operator](../pipelines/reduce/index.md) for more information.

`mean`

Reduces the stream to the arithmetic mean of a specified variable. See [Reduce operator](../pipelines/reduce/index.md) for more information.

`median`

Reduces the stream to the median of a specified variable. See [Reduce operator](../pipelines/reduce/index.md) for more information.

`std`

Reduces the stream to the (population) standard deviation of a given variable. See [Reduce operator](../pipelines/reduce/index.md) for more information.

`sum`

Reduces the stream to the sum over a specified variable. See [Reduce operator](../pipelines/reduce/index.md) for more information.

`list`

Reduces the stream to a list of occurrences of a specified variable. See [Reduce operator](../pipelines/reduce/index.md) for more information.

## [](#_value_types)Value types

`boolean`

Declares the values of an attribute type to be booleans. See [Value types](../values/index.md) for more information.

`integer`

Declares the values of an attribute type to be 64-bit signed integers. See [Value types](../values/index.md) for more information.

`double`

Declares the values of an attribute type to be 64-bit floating point numbers. See [Value types](../values/index.md) for more information.

`decimal`

Declares the values of an attribute type to be decimals, comprising a 64-bit signed integer component and 64-bit unsigned component representing up to 19 decimal places. See [Value types](../values/index.md) for more information.

`datetime-tz`

Declares the values of an attribute type to be nanosecond-precision ISO timestamps with timezones. See [Value types](../values/index.md) for more information.

`datetime`

Declares the values of an attribute type to be nanosecond-precision ISO timestamps without timezones. See [Value types](../values/index.md) for more information.

`date`

Declares the values of an attribute type to be ISO dates. See [Value types](../values/index.md) for more information.

`duration`

Declares the values of an attribute type to be ISO durations. See [Value types](../values/index.md) for more information.

`string`

Declares the values of an attribute type to be variable length UTF-8 encoded strings. See [Value types](../values/index.md) for more information.

## [](#_built_in_functions)Built-in functions

### [](#_value_functions)Value functions

`round(…​)`

Rounding function, returns the provided numeric argument rounded to the nearest integer. See [Value operations](../expressions/value-operations/index.md) for more information.

`ceil(…​)`

Ceiling function, returns the provided numeric argument rounded to the nearest greater integer. See [Value operations](../expressions/value-operations/index.md) for more information.

`floor(…​)`

Floor function, returns the provided numeric argument rounded to the nearest lesser integer. See [Value operations](../expressions/value-operations/index.md) for more information.

`abs(…​)`

Modulus function, returns the absolute value of the provided numeric argument. See [Value operations](../expressions/value-operations/index.md) for more information.

`len(…​)`

Length function, returns the length of the provided string or list (coming soon) argument. See [Value operations](../expressions/value-operations/index.md) for more information.

`min(…​)`

Minimum function, returns the minimum value of two provided numeric arguments. See [Value operations](../expressions/value-operations/index.md) for more information.

`max(…​)`

Maximum function, returns the maximum value of two provided numeric arguments. See [Value operations](../expressions/value-operations/index.md) for more information.

### [](#_concept_functions)Concept functions

`iid(…​)`

IID function, returns the internal ID of the provided instance argument as a string. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`label(…​)`

Label function, returns the label of the provided type argument as a string. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

### [](#_documentation_functions)Documentation functions

`get_doc(t)`

Returns the documentation string of the provided type argument. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_owns_doc(owner, attribute)`

Returns the documentation string of the provided `owns`. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_plays_doc(player, role)`

Returns the documentation string of the provided `plays`. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_relates_doc(relation, role)`

Returns the documentation string of the provided `relates`. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_sub_doc(sub, sup)`

Returns the documentation string of the provided `sub`. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_fun_doc(function_name)`

Returns the documentation string of the provided function. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_struct_doc(struct_name)`

Returns the documentation string of the provided struct. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_struct_field_doc(struct_name, field_name)`

Returns the documentation string of the provided struct field. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

### [](#_metadata_functions)Metadata functions

`get_meta(key, t)`

Returns the metadata of the provided type with the specified key. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_all_meta(t)`

Returns all metadata of the provided type as a stream of key-value pairs. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_owns_meta(key, owner, attribute)`

Returns the metadata of the provided `owns` with the specified key. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_owns_all_meta(owner, attribute)`

Returns all metadata of the provided `owns` as a stream of key-value pairs. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_plays_meta(key, player, role)`

Returns the metadata of the provided `plays` with the specified key. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_plays_all_meta(player, role)`

Returns all metadata of the provided `plays` as a stream of key-value pairs. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_relates_meta(key, relation, role)`

Returns the metadata of the provided `relates` with the specified key. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_relates_all_meta(relation, role)`

Returns all metadata of the provided `relates` as a stream of key-value pairs. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_sub_meta(key, sub, sup)`

Returns the metadata of the provided `sub` with the specified key. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_sub_all_meta(sub, sup)`

Returns all metadata of the provided `sub` as a stream of key-value pairs. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_fun_meta(key, function_name)`

Returns the metadata of the provided function with the specified key. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_fun_all_meta(function_name)`

Returns all metadata of the provided function as a stream of key-value pairs. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_struct_meta(key, struct_name)`

Returns the metadata of the provided struct with the specified key. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_struct_all_meta(struct_name)`

Returns all metadata of the provided struct as a stream of key-value pairs. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_struct_field_meta(key, struct_name, field_name)`

Returns the metadata of the provided struct field with the specified key. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

`get_struct_field_all_meta(struct_name, field_name)`

Returns all metadata of the provided struct field as a stream of key-value pairs. See [Built-in functions](../expressions/builtin-functions/index.md) for more information.

## [](#_literals)Literals

`true`

Represents the boolean literal "true".

`false`

Represents the boolean literal "false".

## [](#_miscellaneous)Miscellaneous

`asc`

Used to specify ascending order for [Sort stages](../pipelines/sort/index.md) in data pipelines.

`desc`

Used to specify descending order for [Sort stages](../pipelines/sort/index.md) in data pipelines.

`return`

Denotes the return signature of a function. See [Writing functions](../functions/writing/index.md) for more information.

`of`

Used to remove ownership of attributes and players of roles in [Delete stages](../pipelines/delete/index.md) of data pipelines.

`from`

Used to remove capabilities, role specialisation, and annotations in [Undefine queries](../schema/undefine/index.md).

`in`

Used to access stream or list elements. See [`let …​ in` statement](../statements/let-in/index.md) for more information.

`as`

Used to specialise a role. See [`relates` statement](../statements/relates/index.md) for more information.

[Lists](../expressions/lists/index.md) [TypeDB Academy](../../academy/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/typeql-reference/modules/ROOT/pages/keywords.adoc) Edit this page on GitHub.