incubator-hugegraph
incubator-hugegraph copied to clipboard
Optimize the semantics of ifNotExist
check two schema all the same when create with ifNotExist(). to avoid issues like #977
Check for 4 types of schema: propertyKey,vertexLabel,indexLabel,and edgeLabel. If the two or more create statements as the code follows are identical, the system will only create one schema quietly.
schema.propertyKey("name").asText().ifNotExist().create();
schema.propertyKey("name").asText().checkExist(false).create();
If the two or more create statements as the code follows with same name and at least one property different, the system will throw an ExistedException.
schema.propertyKey("name").asText().ifNotExist().create();
schema.propertyKey("name").asDouble().checkExist(false).create();
There is a bug executing the following statement twice:
graph.schema().vertexLabel('person').useCustomizeStringId().ifNotExist().create();
graph.schema().edgeLabel('next').sourceLabel('person').targetLabel('person').ifNotExist().create();
