Skip to content

Make annotated constraints to apply to subtypes #291

Open
@izmalk

Description

@izmalk

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";

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions