Officially out now: The TypeDB 3.0 Roadmap >>

Statements overview

A TypeQL statement is a building block of a TypeQL pattern. Statements in TypeQL are always end with a semicolon. By default, a conjunction combines all statements in a pattern. There is a specific syntax to use for a disjunction or negation.

Simple statements

A simple statement is the smallest complete TypeQL block that can be used as a pattern in a query.

Most simple statements have three parts: Subject Predicate Object. Where the predicate is a TypeQL keyword.

Some notable exceptions are: assignments (role and value), annotations (key and unique), abstract, value, and rules.

Composite statements

Multiple simple statements with the same subject can be combined into a composite statement. A composite statement starts with a single subject, and multiple comma-separated simple statements with subject omitted.

See an example
Composite statement example
$p isa person, has full-name "Kevin Morrison", has email $e;

The above example combines simple isa / isa! and has statements to the same result without repeating the subject ($p):

Equal simple statements example
$p isa person;
$p has full-name "Kevin Morrison";
$p has email $e;

The role assignment and value assignment statements do not require a comma when added in a composite statement, as they are used without any additional keyword.

Statement types