-
Notifications
You must be signed in to change notification settings - Fork 336
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: enumerated value restrictions #7023
Comments
This is brilliant, but can we slightly expand the use case please? Controlled dictionaries using Vocabularies and Enums are very common in many fields, including cybersecurity, and super valuable. The key difference between a vocab or an enum is whether one can add more values or not, viz:
Controlled vocabularies are most often displayed in User Interfaces in drop down list boxes (Enum), or combo list boxes (Vocab) that enables extra values to be added. The key differences between your current proposition and more formal Controlled Vocabulary Types is:
This goes beyond the simple enum, but perhaps this functionality could be put together by combining an enum and a struct. Assuming this can be done, then the critical issue is that we need a second type of Enum, one that can be added to dynamically |
Problem to Solve
TypeQL doesn't have a way to represent enums, or even values restricted to a set of values for an attribute, a very common use case (example: a form's
title
may beMr|Ms...
).Current Workaround
Users try to use a
regex
:@regex("Mr|Ms")
, which works but is non-canonical and not particularly performant to insert.Proposed Solution
We will introduce a value restriction such as
@values(...)
which takes a list of values. This allows restricting values to a set of values. (note: syntax not finalised?)This also allows using specific longs or dates very naturally:
Although the use case for these may be somewhat unusual.
The text was updated successfully, but these errors were encountered: