typedb icon indicating copy to clipboard operation
typedb copied to clipboard

When using `isa!` rather than `isa`, query returns no results - for no good reason

Open JonThom opened this issue 3 years ago • 0 comments

Description

Given A and C, both known, which do NOT share any relations, but both share a different relation with B (unknown), we wish to retrieve the chain connecting A and C:

A - relation1 - B - relation2 - C

the following query tries to achieve this:

match 
$relation1 ($A_role:$A, $B_role_1:$B) isa! $reltype1; 
$relation2 ($B_role_2:$B, $C_role:$C) isa! $reltype2; 
$A iid 0x826e80048000000000000003; 
$C iid 0x826e80028000000000000002; 
$reltype1 relates $A_role; 
$reltype1 relates $B_role_1; 
$reltype2 relates $B_role_2; 
$reltype2 relates $C_role; 
$reltype1 sub relation; 
$reltype2 sub relation; 
get $A, $A_role, $relation1, $B_role_1, $B, $B_role_2, $relation2, $C_role, $C; limit 1000;

Environment

  1. OS: Mac OS 12.1
  2. TypeDB version (and platform): 2.6.3
  3. TypeDB client: client-python and console

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. set up any database where such a constellation of thing exist
  2. find two things A and B which are known to be indirectly linked as described above. Replace their iids in the query.
  3. Run the query
  4. See no answers

Expected Output

Expected to see answers

Actual Output

No answers.

Additional information

Replacing isa! $reltype1; with isa $reltype1;, and doing the same with isa! $reltype2, makes the query work, although there seems to be no good reason for the query to not work with isa!.

JonThom avatar Feb 22 '22 19:02 JonThom