Officially out now: The TypeDB 3.0 Roadmap

role assignment

Role assignment doesn’t use any specific keyword, but it uses parentheses to assign players to roles in a relation.


The syntax of a role assignment statement includes:

  • Subject — concept variable

  • Object — parentheses with comma separated list of:

    • role label and concept variable, separated by a colon

<concept-variable> ( [<role>:]<concept-variable> [,[<role>:]<concept-variable>] )

The role is optional. If no role provided for a player, its role is inferred via its type and schema.

There can be any number of players per role and at least one role specified in a role assignment statement.


TypeQL role assignment statements can be used only in data queries and rules.

Since only relations can have roles, the subject concept variable is implicitly bound to the relation type. You can specify the type of the concept variable by bounding it explicitly with an isa statement.

Usage in a match pattern

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

For example, let’s find all relations for a user with full-name of Kevin Morrison:

Role assignment query example
$rel ($person) isa! $type;
$person isa person, has full-name "Kevin Morrison";
See example output
Output example
{ "type": { "label": "permission", "root": "relation" } }

Learn more

Learn more about type statement in TypeQL.

Learn about types in TypeQL.

Provide Feedback