Undefine query
|
This documentation is not current - it is for TypeDB 2.x, which is no longer supported. View the documentation for TypeDB 3.x: |
An Undefine query removes type and rule definition from a schema. For a practical guide on how to send an Undefine query to TypeDB, see the Undefine query page of the TypeDB Manual.
Syntax
An Undefine query consists of a single undefine clause and always starts with the undefine keyword.
Undefine queries are written in TypeQL with the following syntax:
undefine <schema_definitions>
Behavior
An Undefine query deletes the parts of the schema specified in its undefine clause, including types, rules, roles, and ownerships. Undefining a type also undefines all ownerships of attribute types and all roles of that type.
Query execution
For an undefine query to succeed, the following must be satisfied:
-
Types that are to be deleted must exist.
-
Types that are to be deleted can have neither subtypes nor instances of data.
-
An undefine query must result in a valid schema state.
Undefining the same definition twice will result in an error.
Undefine types
For this example, use a database with the IAM schema and sample data loaded.
Use a schema statement to delete from a schema in an Undefine query:
undefine
number sub attribute;
database owns name;
The above example deletes from a schema the attribute type number and ownership of the attribute type name by the
entity type database.
Undefine rules
For this example, use a database with the IAM schema and sample data loaded.
To delete a rule, use the rule keyword with rule’s label:
undefine
rule add-view-permission;