Skip to content

Allow matching on types using a type label directly #341

Description

@dmitrii-ubskii

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions