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

Allow multiple type constraints where permitted by the schema #268

Open
james-whiteside opened this issue Feb 28, 2023 · 1 comment
Open

Comments

@james-whiteside
Copy link

Problem to Solve

Currently, queries do not permit the following syntax:

$v isa vehicle;
$v isa $vehicle-type;
$v has license-plate "VATICLE";

This syntax allows for the types of the vehicle to be retrieved.

Current Workaround

The following syntax works instead:

$v isa $vehicle-type;
$vehicle-type sub vehicle;
$v has license-plate "VATICLE";

Proposed Solution

The problem with the currently illegal syntax is that $v can have multiple conflicting types, however both types can be satisfied by checking if $vehicle-type is a subtype of vehicle against the schema and returning an error only if not. While not necessary, improving the expressivity of the language in this way (and others) would be a nice feature and might be more intuitive for users.

@james-whiteside
Copy link
Author

It's worth noting: this applies to both isa constraints and sub constraints.

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