How to define a transitive relation in graql

I've got a hint from Grakn.ai Slack. The transitivity should be defined on the projectSharing role itself, additional transitiveProjectSharing is not necessary. So the definition should be:

transitive-project-sharing sub rule,
  when {
    (projectSourceRole: $a, projectTargetRole: $b) isa projectSharing;
    (projectSourceRole: $b, projectTargetRole: $c) isa projectSharing; 
  }, then {
    (projectSourceRole: $a, projectTargetRole: $c) isa projectSharing; 
  };

and the query works well: enter image description here

Tags:

Grakn

Graql