You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can easily implement an extension to TypeQL - a union/disjunction of types, as an alternative to a single type label. This would make a single TypeQL query expressive without having to resort to disjunctions or separate queries.
Current Workaround
To query for instances of two types, we must do for example: match $x isa $t; { $t type person;} or { $t type house;};
or run two separate queries.
Proposed Solution
We could instead write match $x isa person|house;, which allows lumping two possibly disjoint types into the Label for the isa.
This should work for anything in the query that contains a Label constraint, and can be directly implemented by extending the grammar and the parsed Constraint to support a set of label strings.
The text was updated successfully, but these errors were encountered:
This may be a bigger change than was initially thought.
Because the type constructs are shared between different kinds of queries, viz. match and define, allowing a label to be a union of labels across the board would lead to define foo sub bar|baz, owns name|age; being a valid query from the grammar's point of view. It wouldn't make a whole lot of sense to just restrict the X|Y construct to the isa constraint either.
This can be mitigated by splitting off the definition rules off from type constraints, but that would be its own undertaking.
Problem to Solve
We can easily implement an extension to TypeQL - a union/disjunction of types, as an alternative to a single type label. This would make a single TypeQL query expressive without having to resort to disjunctions or separate queries.
Current Workaround
To query for instances of two types, we must do for example:
match $x isa $t; { $t type person;} or { $t type house;};
or run two separate queries.
Proposed Solution
We could instead write
match $x isa person|house;
, which allows lumping two possibly disjoint types into the Label for theisa
.This should work for anything in the query that contains a
Label
constraint, and can be directly implemented by extending the grammar and the parsed Constraint to support a set of label strings.The text was updated successfully, but these errors were encountered: