Define or undefine parent element

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

super_special_entity sub special_entity

should now inherit from “another_special_entity”, could I just run:

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:

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!

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.

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.

1 Like