Search code examples
gremlinjanusgraphgremlin-server

add Property Key Cardinality


I am working with JanusGraph db. I am trying to add Property Key Cardinality. Here I am creating new property of vertex.

name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(Cardinality.SINGLE).make()

But it doesn't work! And I have this mistake:

Adding this property for key [~T$SchemaName] and value [rtname] violates a uniqueness constraint [SystemIndex#~T$SchemaName]

I find this solution but it doesn't work too.

mgmt.makePropertyKey('name').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.SINGLE).make()

But it doesn't work too and I have the same mistake. So, how can I set this Cardinality type while adding property key.


Solution

  • The error message seems to suggest that the property key already exists. Can you verify by doing mgmt.printSchema() and checking the output? This is a comment but I'm using the answer section as I do not have enough reputation.