type
|
This documentation is not current - it is for TypeDB 2.x, which is no longer supported. View the documentation for TypeDB 3.x: |
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
typekeyword -
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" } }