typedb / typedb-studio

TypeDB Studio (IDE)
https://typedb.com
Mozilla Public License 2.0
194 stars 43 forks source link

isa edges not properly rendering #766

Open james-whiteside opened 1 year ago

james-whiteside commented 1 year ago

Description

When performing a query involving the pattern tempalte $x isa $y;, the isa edge between $x and $y isa not rendered in the graph visualiser.

Environment

  1. TypeDB version: 2.19.1
  2. OS of TypeDB server: Ubuntu 18.04.5
  3. Studio version: a7da2961e8d16b19c944ac8feae946166f0c1e51
  4. OS of Studio: MacOS 12.6.1

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Define schema: https://github.com/james-whiteside/typedb-examples/blob/969beb5a2813a59fc29c31669ab47228fd6c582b/identity-and-access-management/define-schema.tql
  2. Insert data:
    insert
    $op_1 isa operation;
    $op_1 has $n_1;
    $ac_1 isa access;
    $ac_1 (valid-action: $op_1, accessed-object: $o_1);
    $at_1 isa access-time;
    $at_1 2023-05-05T10:19:17;
    $u_1 isa employee;
    $u_1 has $e_1;
    $e_1 isa email;
    $e_1 "bobbie.draper@vaticle.com";
    $h_1 isa access-history;
    $h_1 has $at_1;
    $h_1 (exercised-access: $ac_1, accessing-subject: $u_1);
    $id_1 isa email;
    $id_1 "camina.drummer@ibm.com";
    $o_1 isa customer-account;
    $o_1 has $id_1;
    $n_1 isa name;
    $n_1 "view account";
    $op_2 isa operation;
    $op_2 has $n_2;
    $ac_2 isa access;
    $ac_2 (valid-action: $op_2, accessed-object: $o_2);
    $at_2 isa access-time;
    $at_2 2023-05-16T12:20:38;
    $u_2 isa employee;
    $u_2 has $e_2;
    $u_2 has $e_5;
    $e_2 isa email;
    $e_2 "filip@vaticle.com";
    $h_2 isa access-history;
    $h_2 has $at_2;
    $h_2 (exercised-access: $ac_2, accessing-subject: $u_2);
    $id_2 isa reference;
    $id_2 "MCRN-02";
    $o_2 isa purchase-order;
    $o_2 has $id_2;
    $n_2 isa name;
    $n_2 "submit order";
    $op_3 isa operation;
    $op_3 has $n_3;
    $ac_3 isa access;
    $ac_3 (valid-action: $op_3, accessed-object: $o_3);
    $at_3 isa access-time;
    $at_3 2023-05-12T12:47:34;
    $u_3 isa employee;
    $u_3 has $e_3;
    $e_3 isa email;
    $e_3 "naomi.nagata@vaticle.com";
    $h_3 isa access-history;
    $h_3 has $at_3;
    $h_3 (exercised-access: $ac_3, accessing-subject: $u_3);
    $id_3 isa path;
    $id_3 "root/engineering/typedb/feature_roadmap.docx";
    $o_3 isa file;
    $o_3 has $id_3;
    $n_3 isa name;
    $n_3 "edit file";
    $op_4 isa operation;
    $op_4 has $n_4;
    $ac_4 isa access;
    $ac_4 (valid-action: $op_4, accessed-object: $o_2);
    $at_4 isa access-time;
    $at_4 2023-05-16T16:07:47;
    $u_4 isa employee;
    $u_4 has $e_4;
    $e_4 isa email;
    $e_4 "amos.burton@vaticle.com";
    $h_4 isa access-history;
    $h_4 has $at_4;
    $h_4 (exercised-access: $ac_4, accessing-subject: $u_4);
    $n_4 isa name;
    $n_4 "approve order";
    $e_5 isa email;
    $e_5 "filip.inaros@vaticle.com";
    $op_5 isa operation;
    $op_5 has $n_5;
    $ac_5 isa access;
    $ac_5 (valid-action: $op_5, accessed-object: $o_4);
    $at_5 isa access-time;
    $at_5 2023-05-10T10:12:21;
    $u_5 isa employee;
    $u_5 has $e_6;
    $e_6 isa email;
    $e_6 "alex.kamal@vaticle.com";
    $h_5 isa access-history;
    $h_5 has $at_5;
    $h_5 (exercised-access: $ac_5, accessing-subject: $u_5);
    $id_4 isa hash;
    $id_4 "4003ab4cf4f5776a72280e599f39553bd0c01528";
    $o_4 isa pull-request;
    $o_4 has $id_4;
    $n_5 isa name;
    $n_5 "merge pull request";
    $op_6 isa operation;
    $op_6 has $n_6;
    $ac_6 isa access;
    $ac_6 (valid-action: $op_6, accessed-object: $o_5);
    $at_6 isa access-time;
    $at_6 2023-05-07T14:11:26;
    $u_6 isa employee;
    $u_6 has $e_7;
    $e_7 isa email;
    $e_7 "joe.miller@vaticle.com";
    $h_6 isa access-history;
    $h_6 has $at_6;
    $h_6 (exercised-access: $ac_6, accessing-subject: $u_6);
    $id_5 isa name;
    $id_5 "customer";
    $o_5 isa table;
    $o_5 has $id_5;
    $n_6 isa name;
    $n_6 "insert record";
  3. Run query:
    match
    $u isa user, has email $e;
    $o isa! $type, has id $id;
    $type sub object;
    $op isa operation, has name $n;
    $ac ($o, $op) isa access;
    $h ($u, $ac) isa access-history, has access-time $at;

Expected Output

$o instances are connected to $type instances via isa edges.

Actual Output

Screenshot 2023-07-31 at 12 13 24

izmalk commented 1 year ago

I've also found this bug, but working with the IAM schema and data (from docs). It can be reproduced with a simple query of

match 
$p isa person, has $fn;
$fn isa! $type;

And the worst part - Graph visualizer creates a random number of connection lines with the type. 1 Screenshot 2023-08-17 at 19 20 30 2 Screenshot 2023-08-17 at 19 22 22

But the text-output seems correct to me:

## Running> Match query:
match
$p isa person,
    has $fn;
$fn isa! $type;

## Result> Match query successfully matched concepts in the database:
{
    $p iid 0x826e80038000000000000000 isa person;
    $fn "kevin.morrison@vaticle.com" isa email;
    $type type email sub id;
}
{
    $p iid 0x826e80038000000000000001 isa person;
    $fn "Pearle Goodman" isa full-name;
    $type type full-name sub attribute;
}
{
    $p iid 0x826e80038000000000000002 isa person;
    $fn "masako.holley@vaticle.com" isa email;
    $type type email sub id;
}
{
    $p iid 0x826e80038000000000000001 isa person;
    $fn "pearle.goodman@vaticle.com" isa email;
    $type type email sub id;
}
{
    $p iid 0x826e80038000000000000002 isa person;
    $fn "Masako Holley" isa full-name;
    $type type full-name sub attribute;
}
{
    $p iid 0x826e80038000000000000000 isa person;
    $fn "Kevin Morrison" isa full-name;
    $type type full-name sub attribute;
}
## Completed