Checking for role equality in type inference

I have several two-way relations in my schema. I want to get both roles from all relations where at least one role has a specific type.

Here’s my query:
match $relation relates $role1; $relation relates $role2; $ent type my-type; $ent plays $role1; get $role1, $role2;
But some results have the same role for $role1 and $role2. I would like to add a clause like: $role1 != $role2; or not {$role1 role $role2;};. But I get errors. What’s the right syntax for this? Or maybe there’s a better way to do this query?

To do concept inequality you can use not { $role1 is $role2;};

Hope that helps!

Thanks! I tried but failed to find this in the documentation (Match Clause | Vaticle). Is it documented somewhere else? There are lots of nice examples there, but doesn’t seem to be comprehensive. Some BNF or similar definition of the syntax would be nice to have in the docs I think.

Wow! You’re right we don’t have is in the docs! I will add it now.

Linking the grammar is a good idea as well, here it is for now: typeql/TypeQL.g4 at master · vaticle/typeql · GitHub

1 Like

All updated - Match Clause | Vaticle

1 Like