-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Labels
Description
Problem to Solve
To share the Unique constraint between multiple types.
E.g., all cars have a unique ID (License plate number), including subtypes of car, like sedan and hatchback.
See the generic schema example below:
define
id sub attribute, value string;
supertype sub entity,
owns id @unique;
subtype1 sub supertype;
subtype2 sub supertype;
Current Workaround
The code above will work, but the constraint of uniqueness for the id is applied separately for every subtype.
Proposed Solution
The subtypes will share the pull of unique constrained values of id.
The following insert query should return an error:
insert
$s1 isa subtype1, has id "1";
$s2 isa subtype2, has id "1";