Janusgraph vertex property with cardinality as SET type

Hi, need a working example of how a property can be added to a vertex with cardinality as SET type and how we can retrieve it and assign it to SET of strings in JAVA.

Please note: I have tried the janusgraph doc code, google search, chat GPT but every time I put something in that property through java code it get stored in STRING format only.

Ex: "["ABC"]" --> current , ["ABC"] --> this I need.

Please help.
Solution
for JanusGraph you'd want to set up the schema for your multiproperty:
mgmt = graph.openManagement()
mgmt.makePropertyKey('p').dataType(String.class).cardinality(Cardinality.SET).make()
mgmt.commit()

then for Gremlin it should just be
g.addV().
  property(set, 'p', 'value-a').
  property(set, 'p', 'value-b')
Was this page helpful?