# Define or undefine parent element

**URL:** <https://forum.typedb.com/t/define-or-undefine-parent-element/499>\
**Category:** TypeQL\
**Tags:** schema-design\
**Created:** [1 June 2024 11:27 UTC](https://forum.typedb.com/t/define-or-undefine-parent-element/499 "2024-06-01T11:27:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![c-lare](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@c-lare](https://forum.typedb.com/u/c-lare)\
**Post date:** [1 June 2024 11:27 UTC](https://forum.typedb.com/t/define-or-undefine-parent-element/499/1 "2024-06-01T11:27:56Z")

</div>

Hi all,

I could not find any documentation on how to define or undefined parent types, e.g., remove the parent attribute so that it inherits from the attribute or add another attribute as a parent. Same for entities and relations. As removing or adding a parent element has many consequences (removing inherited features or adding new features that might conflict with the existing declared features (e.g., attributes, role plays, relates roles), I assume that there might be some restrictions and it would be great to understand this better.

If there are no restrictions, could anyone point me to how the queries for defining or undefining parent types look like in case the elements had already been declared formerly so e.g., when I would like to declare that

```auto
super_special_entity sub special_entity

```

should now inherit from “another\_special\_entity”, could I just run:

```auto
super_special_entity sub another_special_entity

```

and all changes get handled internally?

Equally, how could I remove an inheritance and change it to the default “entity”, e.g., with:

```auto
super_special_entity sub entity

```

Further, can one undefine an object or attribute as abstract? So when one has formerly defined it as abstract?

Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![krishnan](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.typedb.com/krishnan/32/36_2.png) [@krishnan](https://forum.typedb.com/u/krishnan)\
**Post date:** [1 June 2024 21:38 UTC](https://forum.typedb.com/t/define-or-undefine-parent-element/499/2 "2024-06-01T21:38:28Z")

</div>

> Can one undefine an object or attribute as abstract? So when one has formerly defined it as abstract?  
> `undefine abstract_entity abstract;`

> … could I just run: : `super_special_entity sub another_special_entity`  
> Yes. This should work too: `super_special_entity sub entity`

> and all changes get handled internally?

Yes. There’s a lot of validation that’ll run to ensure you don’t put your database into an invalid state. Some of this are when you run the `define/undefine` query, and some when you try to commit it. We’ve designed this in a way that there’s always a ‘safe’ path from your current schema to your desired schema. For small validations it should be intuitive enough. If you find yourself getting stuff on more involved refactoring, there’s a lot of information in the PR which introduced the validation [here](https://github.com/vaticle/typedb/pull/6981).

For the specific case of re-assigning super types, the only thing likely to break is that you no longer inherit some capability (ownership, or playing roles) and need to re-declare them before moving.
