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

Attribute value restrictions #271

Open
PatLechevallier opened this issue Nov 19, 2021 · 2 comments
Open

Attribute value restrictions #271

PatLechevallier opened this issue Nov 19, 2021 · 2 comments

Comments

@PatLechevallier
Copy link

PatLechevallier commented Nov 19, 2021

Problem to Solve

TypeDB has regex for string attributes but no Numeric Attribute Validation (min, max, range)

Current Workaround

An idea should be to

define
max-long-value sub attribute, value long;
measure sub attribute, value long, has max-value;

And to evaluate the statement on the client side.

Or define an max-error entity in TypeDB and define a rule that would raise an error (create a relation between the attribute and error code). But still require the client to pull the error entity.

Proposed Solution

Support Natively the constraint if possible of course.
define item owns measure, must-be <= {numeric value};
or
define item owns measure, max {numerix value};
or more original, let the modeler define his own rules that raise error in the system as described above.

@flyingsilverfin
Copy link
Member

Moving to TypeQL repository

@flyingsilverfin flyingsilverfin transferred this issue from vaticle/typedb Mar 17, 2023
@flyingsilverfin flyingsilverfin changed the title Numeric Attribute Validation (min, max, range) Attribute value restrictions Mar 17, 2023
@flyingsilverfin
Copy link
Member

We can introduce a set of value restriction annotations in TypeQL.

@range(start inclusive, end inclusive)
@regex (change from the current regex keyword)

and others we can think of in the future.

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

4 participants