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

Give relation and value constraints explicit keywords #301

Open
flyingsilverfin opened this issue Sep 14, 2023 · 0 comments
Open

Give relation and value constraints explicit keywords #301

flyingsilverfin opened this issue Sep 14, 2023 · 0 comments

Comments

@flyingsilverfin
Copy link
Member

flyingsilverfin commented Sep 14, 2023

Problem to Solve

All constraints in TypeQL are explicitly declared with a keyword a few exceptions.

One is the use of a relation variable and a relation tuple:

$r (friend: $x) isa friendship, has start-date...;

and the other is implicit attribute/value assignment:

$x 10;
?x 10;

These points make TypeQL harder to interpret to the user. Instead, we should consider making all constraints have an explicit keyword.

Proposed Solution

For attributes, we will simply require that we use predicates:

$x == 10;
?x == 10;

For relations, we will introduce of to denote the constraint between a variable and a role players tuple, and ban the usage of implicit value predicates.

So relations will look like the following:

$r of (friend: $x, friend: $y) isa friendship, has name ...;

Which will continue to be syntactic sugar over:

$r of (friend $x, $friend: $y);
$r isa friendship;
$r has name...

Open question: would we allow splitting of and isa into a comma separated list in the same multiple has constraints can be chained? We will need to come up with a consistent pattern for describing contractions constraints into a single comma-separated line.

$r isa friendship, of (friend: $x, friend: $y);

Additional information

Dropping a relation variable would generate an implicit variable with the of:

(friend: $x, friend: $y) isa friendship;

Should represent:

$_ of (friend: $x, friend: $y) isa friendship;
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