Attribue "unique"?



I was wondering if it was possible to specify that an attribute should be “unique” in a MySQL sense of the word. Meaning that for a given concept, there should not be two entities sharing the same attribute value. It’s typical for IDs.

For instance, my model is:

track sub entity,
has track-id;

If I enter twice the following insert query:

insert $1234 isa track has track-id 1234;

I did not find any example in this way in the documentation.


Hey @mar,

yes you can define an attribute to be a key, grakn will guarantee uniqueness:


track sub entity,
     key track-id,
    has another-attribute;

it’s still not documented, but we are also fixing documentation, so it will be up with next release.

Please try that and let us know if it works for you,

Thank you!


That’s really a great news :slight_smile: Thanks!