Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeDB 3.0: default dependent attributes #7022

Open
flyingsilverfin opened this issue Apr 3, 2024 · 0 comments
Open

TypeDB 3.0: default dependent attributes #7022

flyingsilverfin opened this issue Apr 3, 2024 · 0 comments

Comments

@flyingsilverfin
Copy link
Member

flyingsilverfin commented Apr 3, 2024

Problem to Solve

This issue is replacing #6766 after further discussion and refinement.

We, and our users, often face the issue of having to manually clean up attributes if no entity or relation owns them anymore. Currently, this is a manual operation and causes difficulty and headaches (and is easy to get wrong given concurrent transactions). We would rather take this operation into TypeDB itself.

By default, we expect most attributes to be dependent (only should exist if owned by an owner).

Proposed Solution

We will make the default behaviour of attributes to still be global, but also dependent (this will not require a keyword).

The default behaviour will be that any attribute that is not owned will be cleaned up by the system. TypeDB will handle the automatic cleanup, even given concurrent operations on the same attribute.

However, some use cases want to be able to load attributes without owners (such as a list of valid names of countries, etc.). To facilitate this, we will introduce an @independent annotation on attribute definitions:

define
  country-name sub attribute @independent,
     value string;

Alternatives considered

We also considered the annotation @retain, partially because it is shorter, but it only gives the intuition of its behaviour when owners are deleted, but implies nothing about what happens when it is inserted. independent is the opposite of dependent, which is the proper term for what we want the default behaviour to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant