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 matching on types using a type label directly #341

Open
dmitrii-ubskii opened this issue Jun 26, 2024 · 0 comments
Open

Allow matching on types using a type label directly #341

dmitrii-ubskii opened this issue Jun 26, 2024 · 0 comments

Comments

@dmitrii-ubskii
Copy link
Member

Problem to Solve

Corrently, when a user attempts to, e.g., match all attributes a specific type may own, they are greeted with a TypeQL error:

test::data::read> match person owns $n;
                  
[TQL03] TypeQL Error: There is a syntax error at line 1:
match person owns $n;
                     ^
no viable alternative at input 'match person owns $n;'

This is because all statements in a match query must currently start with a variable.

Current Workaround

Currently the user would have to introduce a variable binding for the type and either filter it out at the end of the query, or accept an extraneous concept in each answer.

match
  $t type person;
  $t owns $att;
get $att;

Proposed Solution

We could treat person owns $n; as a valid pattern which decomposes into $_0 type person; $_0 owns $n;.

Note that there is no danger in this allowing trivial queries like person owns name; (which would either be redundant or immediately unsatisfiable depending on the schema) because of the requirement that each statement contain a named variable.

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