Still trying to figure out the correct way to use the key keyword. Same question I posed in CSV migration issues but I’ve gotten it down to the absolute bare minimum reproducible example. Hopefully I can get an answer to this as it is one of the last things I need to figure out to release a website powered by Grakn.
The only documentation I can find on the key keyword is this: https://dev.grakn.ai/docs/api-references/ddl#key-type. Doesn’t explain how to use it or show an example of its use.
I’ve created a project: https://github.com/BFergerson/grakn-key-test
In this project the schema is:
node sub entity key name;
name sub attribute datatype string;
From my understanding of key this should prevent me from inserting two node entities with the same name. This is not the case as I show in: https://github.com/BFergerson/grakn-key-test/blob/master/src/main/java/GraknKeyTest.java
The script above shows me inserting the following twice:
insert $x isa node has name “brandon”;
With the output of running the script above being:
Insert first “brandon”: [[$x/V12528]]
Insert duplicate “brandon”: [[$x/V8328]]
“brandon” node count: 2
At this point I’m not sure how I can make my example any more concise. I don’t understand how I’m using the key keyword incorrectly. Can I please get an example of how to use it and how it works? Would also help if the keyword was more documented.