Officially out now: The TypeDB 3.0 Roadmap

type

The type keyword is used in TypeQL for matching a type by its label.

Syntax

The syntax of a type statement includes:

  • Subject — a concept variable

  • Predicate — the type keyword

  • Object — a type label

Syntax
<concept-variable> type <type label>;

Behavior

TypeQL statements with the type keyword are used in match clauses. The type keyword adds a constraint for a concept variable to be of a specified type.

Usage in a match pattern

For this example, use a database with the IAM schema and sample data loaded.

Let’s fetch the user entity type:

Fetch type example
match
$u type user;
fetch $u;
See example output
Output example
{ "u": { "label": "user", "root": "entity" } }

Learn more

Learn more about sub statement in TypeQL.

Learn about types in TypeQL.