Attribue "unique"?


#1

Hello.

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.


#2

Hey @mar,

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

define

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!


#3

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