Undefine query
Undefine queries are used to remove existing types, constraints, or functions from the schema.
Syntax
Undefine queries start with the undefine
keyword following by undefinition statements.
undefine
<undefinition_statements>
Undefinition statements are similar to definition statements, but they have a different structure to highlight which part of the definition is to be undefined, in some cases using the from
keyword.
<label>;
<trait_definition> from <type_label>;
<@annotation> from <type_label_or_trait>;
fun <function name>;
Statements should be separated by semicolons. Schema statements in an undefine query cannot use variables or values.
Behavior
An undefine query removes the parts of the schema specified in its undefine clause, including types, traits, annotations, and functions. Undefining a type also undefines all its traits and annotations. Undefining a trait also undefines all its traits and annotations.
An error is returned (on execution or on commit), and no changes are preserved, if:
-
There is no existing definition to undefine.
-
The query results in an invalid schema.
Statements
-
relates … from
statements undefine existing relates and role types. -
as … from relates
statements undefine existing relates specializations. -
plays … from
statements undefine existing roleplayings. -
owns … from
statements undefine existing ownerships. -
value … from
statements undefine existing attribute types' value types. -
sub … from
statements undefine existing subtyping connections. -
@annotation … from
statements undefine existing annotations. Only the type of the annotation is required, so annotations with arguments can be undefined without their arguments specification. -
fun …
statements undefine existing functions.
Examples
Undefining traits
undefine relates child from parentship;
undefine sub parentship from fathership;
undefine as parent from fathership relates father;
undefine plays parentship:parent from user;
undefine value string from email;
undefine owns email from user;
Undefining annotations
undefine @abstract from parentship;
undefine @regex from email value string;
undefine
@card from user owns email;
@independent from email;